Help with solve()
|
03-31-2017, 02:07 PM
Post: #1
|
|||
|
|||
Help with solve()
Just got this calculator, coming from a Ti89
Trying to do a simple solve(3*x^2+3*x=5,x) All I ever get is a result of {x} I am on the home screen, not in Cas. What am I doing wrong? |
|||
03-31-2017, 03:19 PM
Post: #2
|
|||
|
|||
RE: Help with solve()
Hello,
home upper case cas lower case |
|||
03-31-2017, 03:22 PM
Post: #3
|
|||
|
|||
RE: Help with solve()
You should try that in CAS-environment, there it provides the desired results, lower-case x, you did it in HOME with upper case X.
Arno |
|||
03-31-2017, 04:03 PM
Post: #4
|
|||
|
|||
RE: Help with solve()
(03-31-2017 02:07 PM)AngryNapkin Wrote: Trying to do a simple As for the reasoning why, A-Z in capital letters are "real number" variables. They contain by default a 0. So in essence, evaluating what you have written is: solve(3*0^2+3*0=5*0,0) The basic rule is this - if you are just working with plain numbers, and want everything evaluated to an approximate numerical value, work in home. If you are working with "unknown" variables and want expression results, work in the CAS screen. TW Although I work for HP, the views and opinions I post here are my own. |
|||
03-31-2017, 04:18 PM
Post: #5
|
|||
|
|||
RE: Help with solve()
I tried using lower case variables and I get a syntax error.
Any other ideas other than using CAS? Should this not work in home? |
|||
03-31-2017, 04:26 PM
Post: #6
|
|||
|
|||
RE: Help with solve()
I am actually trying to use it within a program, and I keep getting an error. So I tried it manually in home to find out what's going on.
|
|||
04-01-2017, 01:02 AM
Post: #7
|
|||
|
|||
RE: Help with solve()
In home try:
solve(3*X^2+3*X-5,X) -road |
|||
04-01-2017, 01:22 AM
Post: #8
|
|||
|
|||
RE: Help with solve() | |||
04-01-2017, 01:44 AM
Post: #9
|
|||
|
|||
RE: Help with solve() | |||
04-01-2017, 02:31 AM
Post: #10
|
|||
|
|||
RE: Help with solve()
Thank you for the help. Now that this seems to be working with this syntax, I notice the result is returned as a list.
It seems the user manual is pretty poor. How do I extract the value from the list to use it in a calculation with variables? |
|||
04-01-2017, 03:48 AM
(This post was last modified: 04-01-2017 03:49 AM by Brad Barton.)
Post: #11
|
|||
|
|||
RE: Help with solve()
You can set it equal to a variable such as L1, as in
L1:={<obj0>, <obj1>} Then each element in the list can be referred to as L1(0) and L1(1) respectively. |
|||
04-02-2017, 09:38 PM
Post: #12
|
|||
|
|||
RE: Help with solve()
This is truly driving me nuts.
I am simply trying to use solve() inside a program. Here is a simple example. EXPORT EXAMPLE() LOCAL TMP; LOCAL A,B,C; A:=2000.0; B:=1.0; C:=0.0; TMP:=solve((C/(π*B/12.0))-A,C); MSGBOX("RESULT = " + TMP); END; If I create these variables on the home page, solve returns a result as expected. If I run this program, solve() returns an empty list {}. What is going on? Is this a bug? |
|||
04-03-2017, 12:00 AM
Post: #13
|
|||
|
|||
RE: Help with solve()
A, B, and C already exist so declaring them local confuses the compiler. Try this:
Code: EXPORT EXAMPLE() -road |
|||
04-03-2017, 01:00 AM
Post: #14
|
|||
|
|||
RE: Help with solve()
Quote:A, B, and C already exist so declaring them local confuses the compiler. Try this: Well this does work using them as global variables, I am puzzled as to why? Does A-Z exist by default and so this is why they are already declared? Does the solve() seem to only look at global variables and not local? |
|||
04-03-2017, 01:25 AM
Post: #15
|
|||
|
|||
RE: Help with solve()
Yes, A-Z and θ are built in global variables. They can only hold real numbers. There are also built in graphic, list, matrix, and complex variables.
I don't know if you can pass local variables to HOME; never tried it. You can pass local variables to CAS, but it's tricky. If you have to use local variables with the solve() command in a non CAS program I suggest you study up on the CAS() command. Start with cyrille de brébisson's document in post #9 here: http://www.hpmuseum.org/forum/thread-6218.html -road |
|||
11-09-2017, 06:00 PM
Post: #16
|
|||
|
|||
RE: Help with solve()
(04-03-2017 12:00 AM)roadrunner Wrote: A, B, and C already exist so declaring them local confuses the compiler. Try this: MohrCircle() BEGIN //Declare Local Variables LOCAL theta1,theta3,thetaPrime1,thetaPrime3,phiPrime,u,ch1; LOCAL c:=1; MSGBOX("Mohr's Circle Equations"); INPUT({{theta1,1},{theta3,1},{thetaPrime1,1},{thetaPrime3,1},{phiPrime,1},{u,1},{c,1}},"Select given values"); CASE IF c==0 THEN INPUT({A,B,C,D,E,F},"Enter given values", {"σ1=","σ3=","σ'1=","σ'3=","Ø'=","u="}, {"Major Princ Stress [kN/m²]","Min Princ Stress [kN/m²]", "Maj Princ Eff Stress [kN/m²]","Min Princ Eff Stress [kN/m²]", "Friction Angle [°]","Pore Water Pressure [kN/m²]"}); theta1:=A; theta3:=B; thetaPrime1:=C; thetaPrime3:=D; phiPrime:=E; u:=F; // Solve.SOLVE(thetaPrime1 = thetaPrime3*(TAN(45+(phiPrime/2)))^2 + 2*X*TAN(45+(phiPrime/2)),X); c:=solve(C=D*(TAN(45+(E/2)))^2+2*X*TAN(45+(E/2)),X); MSGBOX("c = "+c); RETURN c; END; END; Hi, I tried the suggestion, however I also get "{X}" returned to the Home Screen. Not sure how to implement solve() in a program? Any suggestions? |
|||
11-09-2017, 09:07 PM
Post: #17
|
|||
|
|||
RE: Help with solve()
You can try the following App functions:
Solve.SOLVE(equation, variable to solve for, guess) Any variables have constants, store the values in those variables first before executing Solve.SOLVE. Example: X^2 + 2*T*X + 1 = T Solve for X when T = -3, with guess X = 0 -3 > T (or T:=-3) Solve.SOLVE(X^2 + 2*T*X 1 = T, X, 0) returns with 0.7639320225 To store the result in X: X := Solve.SOLVE(X^2 + 2*T*X 1 = T, X, 0) Function.ROOT( f(X) [=0], guess) Example: Find the root nearest to 3 for X^3 - 1.2*X - 1. Root: 1.3861532869 Caution: ROOT could find a nearby extremum (spelling?) rather than a root. Example, try the above when X= 0. |
|||
11-09-2017, 09:48 PM
Post: #18
|
|||
|
|||
RE: Help with solve()
Hi thank you for replying, I realised my mistake soon after I posted. But thank you for the help!
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)