CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 128 users online: 7 members, 101 guests and 20 bots.
Members: Ashbad, GISdude, lafferjm, shkaboinka.
Bots: VoilaBot (1), Magpie Crawler (2), Googlebot (17).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
timijan


Newbie


Joined: 26 Jun 2011
Posts: 21

Posted: 28 Jan 2012 02:01:41 pm    Post subject: Graph problem

Hey,

I got a problem with plotting a function stored in a variable.

For example:

x+2 -> w
Graph w

but this doesn't work. What am i doing wrong or is this even possible?
(TI 89T)
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55879
Location: Earth, Sol, Milky Way

Posted: 28 Jan 2012 02:03:03 pm    Post subject:

Can I safely assume that you're using a TI-89 here, Timijan? W is a number, not an equation, so you'll be literally storing the value of x plus 2 into w; this means you'll get a horizontal line when you graph it. You instead want to store the equation "x+2" into one of the graph functions and graph that.
_________________


Back to top
Ashbad


I am governor Jerry Brown


Joined: 01 Dec 2010
Posts: 2423
Location: There lived a certain man in Russia long ago

Posted: 28 Jan 2012 02:03:22 pm    Post subject:

You actually aren't storing an equation into that variable, you're actually storing the value of X + 2 into W. Is this in a program, or just in general with the equation inputter/graph button?
_________________
-Ashbad
Back to top
timijan


Newbie


Joined: 26 Jun 2011
Posts: 21

Posted: 28 Jan 2012 03:32:56 pm    Post subject:

@KermMartian indeed i am using TI-89. You managed to replay before i could edit my post Smile

@Ashbad i try to use this in a program.

Based on input data and some derivation function is formed and than i try to graph that function.

Now if i try to put this function in "x+2"-> w and graph w, nothing happens. Graph screen is shown but nothing is drawn. If i try to store it in y1 instead of w it says name is reserved.

So even though i thing what i was doing wrong, i still don't know how to make this work.
Back to top
timijan


Newbie


Joined: 26 Jun 2011
Posts: 21

Posted: 29 Jan 2012 05:45:59 am    Post subject:

Ok, I managed to sole it like this:


Code:
x+2->w
string(w)->w
"Define y1(x)="&w->q
expr(q)
DispG
Pause


Last edited by timijan on 29 Jan 2012 02:11:47 pm; edited 1 time in total
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55879
Location: Earth, Sol, Milky Way

Posted: 29 Jan 2012 11:09:18 am    Post subject:

I wrapped your code in [code] tags, good sir. Yup, that's a good way to do things, although why can't you just directly run the Define command?
_________________


Back to top
CharlieMAC


Advanced Newbie


Joined: 02 Jan 2012
Posts: 58

Posted: 01 Feb 2012 08:52:09 am    Post subject:

I have a similar problem. I want to plot a function (particularly, a polinomial) which depends on the variable t. the polinomial is stored in the variable p, so according to the user's guide I should proceed like this:


Code:
graph p, t


But when I do this it gives me an error that says "Undefined Variable". I also tried the solution timijan found but it didn't work.

Any idea?

Thanks in advance
Charlie
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55879
Location: Earth, Sol, Milky Way

Posted: 02 Feb 2012 01:31:18 pm    Post subject:

Have you tried the obvious solution of checking that p is defined? Are you sure you don't have to put the t in quotes?
_________________


Back to top
Travis


Advanced Member


Joined: 03 Feb 2011
Posts: 218
Location: Kansas, USA

Posted: 02 Feb 2012 02:49:41 pm    Post subject:

The Graph command wants an equation entered exactly the same way it would be entered on the Y= screen. You can either do something like:

Graph x+2,x

to graph x+2. Or, you can define the function in a separate variable:

Define w(x)=x+2

and then:

Graph w(x),x

This syntax should work. Make sure the graphing mode in the Mode screen is set to Function first.
_________________
Back to top
CharlieMAC


Advanced Newbie


Joined: 02 Jan 2012
Posts: 58

Posted: 02 Feb 2012 08:12:45 pm    Post subject:

It's weird. If I execute for example:


Code:
graph 2*t + 1, t


From the home screen, the calculator plots the function 2*t+1, but if I put it in a program it gives an error saying "Undefined variable".

I solved the problem I had, but I had to do this:


Code:
"define pos(t)="&p
graph pos(t),t



Where p is an expression that depends on t and it was previously defined.
Back to top
Travis


Advanced Member


Joined: 03 Feb 2011
Posts: 218
Location: Kansas, USA

Posted: 03 Feb 2012 05:56:39 am    Post subject:

CharlieMAC wrote:
It's weird. If I execute for example:


Code:
graph 2*t + 1, t


From the home screen, the calculator plots the function 2*t+1, but if I put it in a program it gives an error saying "Undefined variable".


Do you happen to have ‘t’ defined as local with the Local command? It seems that this will cause the error. If so, removing it from Local may help.
_________________
Back to top
CharlieMAC


Advanced Newbie


Joined: 02 Jan 2012
Posts: 58

Posted: 03 Feb 2012 08:38:01 am    Post subject:

Travis wrote:
CharlieMAC wrote:
It's weird. If I execute for example:


Code:
graph 2*t + 1, t


From the home screen, the calculator plots the function 2*t+1, but if I put it in a program it gives an error saying "Undefined variable".


Do you happen to have ‘t’ defined as local with the Local command? It seems that this will cause the error. If so, removing it from Local may help.


I tried both things (t as local and not local), but none of them worked.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.032949 seconds.