Post Reply 
Need help with solve&fsolve with stored equations
06-21-2014, 11:02 PM (This post was last modified: 06-21-2014 11:03 PM by alexzkter.)
Post: #1
Need help with solve&fsolve with stored equations
As the title says, I'm having a hard time in the attempt of solving stored equations (on Apps).

The equation is P=((R*T)/(x-b))-(a/x^2)

Here's the definition of the needed variables on CAS:
[Image: xf3j3b.png]

In order to store the 3 equations on a Solve app, (a,b and P equations) I also need to define the 'v' as v:=0 so I don't get syntaxis error:
[Image: 2d7x2lf.png]

fsolve and solve are working if v is an undefined variable. But if I create this variable, I can't solve the equation anymore (fsolve and solve shows [] )


Then...how am I supposed to easily type in solve() on CAS and then copy-paste the expression from Solve app or such ???

Thanks in advance
Find all posts by this user
Quote this message in a reply
06-22-2014, 12:02 AM
Post: #2
RE: Need help with solve&fsolve with stored equations
Not easy at all I am afraid.

To get equations into solver, it seems you have to either use Home variables only (A,B, C etc) or first define the equation in CAS then save it using Solve.E1:= . For example

   

You can do the same for the other two equations a and b. Unfortunately, Solver will then require you to create user variables before running the solver.

If you go back to CAS, you will then need to delete some or all of the recently created user variables before running solve() or fsolve().

Its a pain and I would avoid the Solver app and stick with CAS solve(), fsolve().
Find all posts by this user
Quote this message in a reply
06-22-2014, 12:22 AM
Post: #3
RE: Need help with solve&fsolve with stored equations
(06-22-2014 12:02 AM)CR Haeger Wrote:  Not easy at all I am afraid.

To get equations into solver, it seems you have to either use Home variables only (A,B, C etc) or first define the equation in CAS then save it using Solve.E1:= . For example



You can do the same for the other two equations a and b. Unfortunately, Solver will then require you to create user variables before running the solver.

If you go back to CAS, you will then need to delete some or all of the recently created user variables before running solve() or fsolve().

Its a pain and I would avoid the Solver app and stick with CAS solve(), fsolve().


Thanks for the quick reply.

I was reading through the forums and saw the shift+Notes method, which doesn't seem to be that much longer in keystrokes (the copy-paste part seems longer) and has the benefit of allowing comments.
Find all posts by this user
Quote this message in a reply
06-22-2014, 07:47 AM
Post: #4
RE: Need help with solve&fsolve with stored equations
Bisection can not solve your equation (without precise boundaries), because the root and the singular point 0 are too close. I'm going to improve the solver so that it recognizes your equation is polynomial-like, even if v is assigned.
Find all posts by this user
Quote this message in a reply
06-22-2014, 09:41 AM (This post was last modified: 06-22-2014 09:46 AM by alexzkter.)
Post: #5
RE: Need help with solve&fsolve with stored equations
(06-22-2014 07:47 AM)parisse Wrote:  Bisection can not solve your equation (without precise boundaries), because the root and the singular point 0 are too close. I'm going to improve the solver so that it recognizes your equation is polynomial-like, even if v is assigned.

Are you sure that's the problem here?
I rebooted the virtual calculator so all stored equations and variables are purged, then did the example above again..same result.
Typed in only the equation, without the solve/fsolve command, and I get 7000000=-Inf
[Image: 4rymfp.png]


Take a look at this example:
[Image: 167qd0k.png]
No matter how close the root is to the singular point 0, fsolve&solve shows proper result unless the variable was previously defined, even if its v:=5 or any other number than 0)
Find all posts by this user
Quote this message in a reply
06-22-2014, 02:33 PM
Post: #6
RE: Need help with solve&fsolve with stored equations
Yes, because if the variable is not assigned, the equation is found to be reducible to a polynomial equation, and proot is called. If the variable is assigned, it is not found to be reducible to a polynomial equation, and bisection is called. That's what I'm going to improve.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 5 Guest(s)