Is it bug? CAS solve function.
|
04-18-2018, 04:16 AM
Post: #1
|
|||
|
|||
Is it bug? CAS solve function.
Hello
![]() I got new HP prime a month ago. I write 'solve ([a+5.6=6.6 -a+3b-1.2=-2.2], [a b])' in CAS mode. Answer is a=1, b=3.88578058619E-16. But, It is inaccurate. actually i think a=1, b=0. This happend same in Solve App. There is something I missed? about my prime Hardware Version C Software Version 2018 02 12 CAS 1.4.9 |
|||
04-18-2018, 05:31 AM
Post: #2
|
|||
|
|||
RE: Is it bug? CAS solve function.
If you want exact results from CAS, you must use exact inputs (no decimal points allowed). Try this version of your problem (obviously equivalent but using exact numbers) and you'll get the exact answers you expected.
solve([a+56/10=66/10, -a+3b-12/10=-22/10], [a b]) <0|ɸ|0> -Joe- |
|||
04-18-2018, 04:17 PM
(This post was last modified: 04-18-2018 04:18 PM by Tim Wessman.)
Post: #3
|
|||
|
|||
RE: Is it bug? CAS solve function.
Note that your numbers are correct as well!
0.000000000000000388578058619 is what it found.... which is basically 0 When solving using numerical methods, the computer changes the values by smaller and smaller amounts and attempts to converge onto a single number. However, it is very common that it can't "perfectly" find a number that works because computer numbers are not perfect! They have error built in, and algorithms can't be perfect in all situations. A human can look at a number and say "that should be 0" but that isn't always the case and a computer can't know it! Much of the work in making good math libraries is figuring out how to reduce or cancel as much of the error as possible. For example, what is 1/3 ? Well, if you are using exact, CAS type systems then it is the "concept of 1 divided by 3" or a "ratio of 1 over 3". You CANNOT numerically represent .333333....... as it repeats infinitely however. In this case, the generic "solve a number using a repetitive numerical calculation" algorithm in use can't perfectly converge down to 0. It does "almost" get there however. ![]() TW Although I work for HP, the views and opinions I post here are my own. |
|||
04-18-2018, 08:01 PM
Post: #4
|
|||
|
|||
RE: Is it bug? CAS solve function.
You can also use the EXACT command to convert your equations from approximate to exact. Here I used within the solve command in the CAS environment (see one of the pictures below. The equation is outlined in red). You get the exact answers of 1 and 0 in this case.
You can also use the Solve APP to get the answers (In two more pictures below). This solver only uses approximate answers so your 0 will just be a really small number. Extremely useful APP. |
|||
04-19-2018, 03:55 PM
(This post was last modified: 04-19-2018 03:55 PM by compsystems.)
Post: #5
|
|||
|
|||
RE: Is it bug? CAS solve function.
Why Xcas returns [[1,0]] if hp-prime & Xcas use the same math engine?
solve([a+56/10=66/10, -a+3*b-12/10=-22/10],[a,b]) => [[1,0]] list2exp(solve([a+56/10=66/10, -a+3*b-12/10=-22/10],[a,b]),[a,b]) => a=1 and b=0 exp2list(ans(-1)) => [[1,0]] |
|||
04-19-2018, 04:00 PM
Post: #6
|
|||
|
|||
RE: Is it bug? CAS solve function.
(04-19-2018 03:55 PM)compsystems Wrote: Why Xcas returns [[1,0]] if hp-prime & Xcas use the same math engine? Joe already answered your question. If the user wants exact values, then exact inputs are needed (i.e. no decimals). Graph 3D | QPI | SolveSys |
|||
04-19-2018, 04:22 PM
Post: #7
|
|||
|
|||
RE: Is it bug? CAS solve function.
in the following example if you see two different results.
HP-prime solve(x^3-1.1*x^2-65.4*x+229.5=0,x) {-9.,5.00000000001,5.09999999999} Xcas solve(x^3-1.1*x^2-65.4*x+229.5=0,x) list[-9.0,5.0,5.1] |
|||
04-19-2018, 06:25 PM
Post: #8
|
|||
|
|||
RE: Is it bug? CAS solve function.
(04-19-2018 04:22 PM)compsystems Wrote: in the following example if you see two different results. Prime's CAS uses a 48-bit binary mantissa for floating-point numbers. Hence: format(1.1,"d17") --> "1.099999999999994" format(65.4,"d17") --> "-65.39999999999963" format(229.5,"d17") --> "229.4999999999999" So it's no great surprise that inexact inputs result in inexact outputs. What does Xcas use for its internal representation of floating-point numbers? <0|ɸ|0> -Joe- |
|||
04-19-2018, 07:08 PM
Post: #9
|
|||
|
|||
RE: Is it bug? CAS solve function.
It's the same representation and you get the same answer (change the default value of Digits to 13 or 14 to see non rounded values).
|
|||
04-21-2018, 02:47 AM
Post: #10
|
|||
|
|||
RE: Is it bug? CAS solve function.
All replies are helpful.
Thank you. |
|||
04-21-2018, 01:23 PM
Post: #11
|
|||
|
|||
RE: Is it bug? CAS solve function.
in the configuration of the hp-prime only allows up to 12 digits, in the Xcas which is the highest number of digits?
|
|||
04-21-2018, 02:58 PM
(This post was last modified: 04-21-2018 02:59 PM by DrD.)
Post: #12
|
|||
|
|||
RE: Is it bug? CAS solve function. | |||
04-21-2018, 05:06 PM
(This post was last modified: 04-21-2018 05:23 PM by compsystems.)
Post: #13
|
|||
|
|||
RE: Is it bug? CAS solve function.
but in the hpprime it only allows up to 12 digits on home view
HDigits := 13 returns "HDigits(13) Error: Bad Argument Value" on cas view Digits := 1000; approx(π); returns 3.14159265359 Bug? Digits := 13; solve(x^3-1.1*x^2-65.4*x+229.5=0,x) returns {-9.,5.00000000001,5.09999999999} /!\ Digits command does not appear in the catalog |
|||
04-21-2018, 05:26 PM
Post: #14
|
|||
|
|||
RE: Is it bug? CAS solve function. | |||
04-21-2018, 08:44 PM
Post: #15
|
|||
|
|||
RE: Is it bug? CAS solve function.
(04-18-2018 04:17 PM)Tim Wessman Wrote: You CANNOT numerically represent .333333....... as it repeats infinitely however...If I'm not misunderstood (I'm not mathematician) this is true only in number bases like 2 or 10, but in base 3 (or other bases divisible by 3) it is exact. However in base 3 system the fractions like the 1/2 repeats infinitely. All of our common bases just happen to be the multiples of 2 and not 3. Nitpicking. ![]() PS. Hopefully my understanding is correct. |
|||
04-22-2018, 03:00 AM
Post: #16
|
|||
|
|||
RE: Is it bug? CAS solve function.
(04-21-2018 10:45 PM)moonbeam Wrote:(04-21-2018 08:44 PM)Vtile Wrote: PS. Hopefully my understanding is correct. I use either octal or hex so I'd like eight fingers on each hand! ![]() Tom L Cui bono? |
|||
04-22-2018, 04:03 PM
Post: #17
|
|||
|
|||
RE: Is it bug? CAS solve function.
(04-22-2018 03:00 AM)toml_12953 Wrote: I use either octal or hex so I'd like eight fingers on each hand! As Tom Lehrer once said, "Base-8 is just like base-10 really --- if you're missing two fingers." https://www.youtube.com/watch?v=W6OaYPVueW4 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)