SOLVE wrong answers - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: SOLVE wrong answers (/thread-18410.html) |
SOLVE wrong answers - ks2000 - 05-26-2022 08:03 AM Hi, When inputting solve(15=1.7*10*x^(3/2) ,x) into the CAS page, it yields an answer of {0.456...} which is incorrect. I have used lowercase 'x'. the answer is supposed to be 0.9199... please advise on why this is happening and how to fix it. thank you in advance! RE: SOLVE wrong answers - Albert Chan - 05-26-2022 11:21 AM Try purge(x), or x='x', before solve. This may fix it. RE: SOLVE wrong answers - jonmoore - 05-26-2022 01:22 PM 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. Luckily the Prime gracefully uses Newton's bisection method as a symbolic solve isn't apt for the problem, but it's good to get in the habit of using the apt solve for the job at hand. You can't always be sure that the Prime OS will gracefully fix your error. RE: SOLVE wrong answers - C.Ret - 05-26-2022 05:35 PM (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: 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. [attachment=10740] 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. RE: SOLVE wrong answers - Albert Chan - 05-26-2022 06:57 PM (05-26-2022 05:35 PM)C.Ret Wrote: An alternative method is to use solve, but deliberately giving a guess value or limiting the resolution to a specified interval. I would advise faithfully solving with "purged" variables. Purging not only remove its value, but its assumption (if any) Alternative method(s) work (because we tried it ?), but it may not. (unless documentation stated otherwise) |