HP Forums
desolve() with decimals - 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: desolve() with decimals (/thread-13869.html)



desolve() with decimals - Wes Loewer - 10-25-2019 07:21 PM

When solving differential equations, this works:

desolve((y' = a*(b-y)^2-c) AND (y(0) = 0),x,y)|a>0,b>0,c>0

or when using specific values

desolve((y' = a*(b-y)^2-c) AND (y(0) = 0),x,y)|a=3,b=5,c=7

but if decimals are used (in physics),

desolve((y' = a*(b-y)^2-c) AND (y(0) = 0),x,y)|a=3.1,b=5.2,c=7.3

then no solution is found. For some Diff Eq, using decimals works fine, such as this (with no square term)

desolve((y' = a*(b-y)-c) AND (y(0) = 0),x,y)|a=3.1,b=5.2,c=7.3

but for others it does not. Is using decimals something that should be avoided, or is this suppose to work?


I know I can work around the issue by either converting to exact fractions such as 3.1=31/10 or 0.12345=12345/100000 but that can get awkward for longer decimals. Or I can take the result of

desolve((y' = a*(b-y)^2-c) AND (y(0) = 0),x,y)|a>0,b>0,c>0

and evaluate the result at a=3.1,b=5.2,c=7.3, but I was wondering if there was a better way of handling this.


RE: desolve() with decimals - parisse - 10-26-2019 06:32 AM

If you are using floating point coefficients, solving for initial conditions is not the same as with exact coefficients. And unfortunately, using | interfers with desolve auto-quote mechanism for a,b,c evaluation.
I'll try to improve this, but I'm not certain it will work.