solve(eqn,x) giving wrong answer
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am working with some polynomials and am solving for x and unfortunately I am not getting the correct answer which is really baffling. You can run it to get the answer, but if you take both solutions and work backwards for some value of x and y they are not correct. I was wondering if maybe my use of FloatingPointOutput is the issue?
sympref('FloatingPointOutput',true)
syms x y
eqn = -1.5960e-06*x^2 + 0.0367*x - 2.0468 == y
solx = solve(eqn,x)
I plugged this same formula into symbolab.com and got the correct answer (0.00133... is truncated but I confirmed the first one is the correct answer)
Not sure what's going on here...
Thanks!
0 Kommentare
Antworten (2)
Cris LaPierre
am 24 Aug. 2021
It looks the same to me. Just do the algebra.
b = -0.0367;
d = 0.000003192;
% Note that these values match what MATLAB is giving you
your_R1Coeff1 = -b/d
your_R1coeff2 = 1/d
0 Kommentare
Steven Lord
am 24 Aug. 2021
You can check the answer.
sympref('FloatingPointOutput',true)
syms x y
eqn = -1.5960e-06*x^2 + 0.0367*x - 2.0468 == y
solx = solve(eqn,x)
simplify(subs(eqn, x, solx))
leftside = lhs(eqn)
simplify(subs(leftside, x, solx))
Looks right to me.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Number Theory finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!