| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
Variable X
So I'm working on a program that does certain calculations that require "x" as a variable instead of a stored number.
How can I get the calculator to treat an "x" in something like: (4x-2)^2 instead of whatever is stored for x? |
|
|||
|
Quote:
I'm looking to use the derivative function, which is: Code:
nDeriv(x²,x,2) a.k.a Code:
nDeriv(f(x),x,value of x) Here's my code: Code:
:ClrHome :Output(3,5,"Finding") :Output(4,7,"the") :Output(5,4,"Derivative") :Pause :ClrHome :Disp "f(x)?" :Input A :ClrHome :Disp "X?" :Input B :ClrHome :solve(nDeriv(A,x,B)→C :Disp C :End I have highlighted the x variable in red, to show what needs to be a variable instead of a variable. I'm getting syntax at the ")" after B and before the store arrow on line 7. What am I doing wrong? |
|
|||
|
So the variable would be X, and the guess would be...?
|
|
|||
|
But the catch is that I'm trying to make this be able to work for any equation, like f(x)=sin(x) @ x=π/2
Sorry for seeming stubborn, but I'm a little noobish/rusty when it comes to stuff like this. |
|
||||
|
Quote:
No, that won't work A will be stored as a value still. If you put (X+1)^2 in as A, then it would use the value of X it already has, solve it, and then store that as A You'd have to store it as a String Code:
:input "EQUATION-",Str1 :input "GUESS=",B :solve(Str1,X,B) This may work, but I don't know, because i have never used solve before. Anyways if you don't know already, you access your list of Strings by pressing [VARS], [7], and then choose which of then 10 you want. Here I used number 1. |
|
||||
|
Quote:
Code:
:input "equation ",str1 :input "guess ",B :solve(string>Equ(str1),X,B)->C You have to convert the string to an equation first otherwise the calc gives you a nifty little error. |
|
||||
|
Quote:
So I'm not the only one who thinks that errors are nifty... Anyways, I've never actualy done anthing like this, so after looking over my code again before reading yours, I thought something looked wrong, but I never tested it so I just went with it. Does it work now you added that little part? |
|
||||
|
no, i had to change some stuff. here's the new code. this is tested and works... well...no errors at least.
Code:
:input "equation ",str1 :input "guess ",B :string>Equ(str1,Y1) :solve(Y1,X,A)->C Y1 is a function variable that can be found buy pushing [VARS] > [->] > [ENTER] > [ENTER] Last edited by gumbee : April 22nd, 2009 at 11:36 PM. Reason: parentheses mix-up/colors |
|
|||
|
I typicaaly input a string, change it to a Y= and store it as Y1 then use seg(Y1,X,X,X) Seq is under list. That mught not be right right but its close, i don't have my calc. with me now so I apologize if that is incorrect
|
|
||||
|
Quote:
Hold on there, you had it input variable B, but then in the solve code, you used variable A. Was that a typo, or did you intentionally do it? And if so, then why? |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > TI 83/84 > Variable X |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|