Post Reply 
SOLVE wrong answers
05-26-2022, 05:35 PM (This post was last modified: 05-26-2022 05:44 PM by C.Ret.)
Post: #4
RE: SOLVE wrong answers
(05-26-2022 11:21 AM)Albert Chan Wrote:  Try purge(x), or x='x', before solve. This may fix it.

Purging the 'x' variable is strongly recommended. See, in the following capture, I deliberately give a value to the symbolic variable x, this does affect the resolution of a non-symbolic expression by taking x=2 as the initial value.
Consequently, the format of the input is of great importance since a non-symbolic expression greatly affects the behavior of the CAS.

(05-26-2022 01:22 PM)jonmoore Wrote:  I get the proper answer in CAS of 0.9199... However, as well as following Albert's advice it's worth bearing in mind that you should be using fsolve for that particular problem, as it's a numerical solve problem.

An alternative method is to use solve, but deliberately giving a guess value or limiting the resolution to a specified interval. See the following screenshot.

All the power of the solve function in CAS mode is summarized in its online help:
Quote:Syntax:
solve(Expr,[Var] ) or solve({Eq1, Eq2,…}, [Var]) or solve(Expr, Var=Guess) or solve(Expr, Var=Val1..Val2)

Returns a list of the solutions (real and complex) to a polynomial equation or a set of polynomial equations.

The user is advised to supply a guess or define an interval in which to search for a solution to get the best results in cases where the solution is known to be approximate. To supply a guess, use the syntax Var=Guess. To supply an interval, use the syntax Var=Val1..Val2. In the latter case, the search is confined to the closed interval [Val1, Val2].

Examples:
solve(x²-3=1) → {-2,2}
solve([x²-y²=0,x²-z²=0],[x,y,z]) → {[x,x,x],[x,-x,-x],[x,x,-x],[x,-x,x]}
solve(x^2-(LN(x)+5)=0, x=2) → 2.42617293082
solve(x^2-(LN(x)+5)=0, x=2..3) → 2.42617293082

The most important fact, missing from the help explanations, is that the symbolic resolve function returns a list while the numeric resolve subroutine gives only a numeric output.

   

The key detail in the user's equation is that ks2000 enters 1.7*10, which does not have the same meaning as the exact, symbolic integer 17. This has a determining effect on how the CAS of the HP Prime interprets the data and on the type of resolution.

See in the screen capture the format of the result depending of entry containing a symbolic 17 versus a 1.7*10 expression.

In case of a non-symbolic expression, giving an intial guess (or a range interval) is strongly recommended.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
SOLVE wrong answers - ks2000 - 05-26-2022, 08:03 AM
RE: SOLVE wrong answers - Albert Chan - 05-26-2022, 11:21 AM
RE: SOLVE wrong answers - C.Ret - 05-26-2022 05:35 PM
RE: SOLVE wrong answers - Albert Chan - 05-26-2022, 06:57 PM
RE: SOLVE wrong answers - jonmoore - 05-26-2022, 01:22 PM



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