find a root problem

syms hr;
Bo=2106192442915567908282078859207/4494983136974228414275670063706112 - (2106192442915567908282078859207*exp(-18446744073709551616/(1147831826363933*(81508471552582434684928/(3187597375937011*hr) + 22182.30127333101796019592417497))))/4494983136974228414275670063706112
hr1=solve(hr-661*230*Bo^0.5,hr)
I found a hr1=2.3145157172213798324089674315726e-40 - 1.8416117030019738856259409912694e-48*i through matlab
But It must be,true answers are 1997.001744 and 0,
I'm waiting your solutions pls Thanks,,

回答(1 个)

You are encountering round=off error. 2106192442915567908282078859207/4494983136974228414275670063706112 is being converted to floating point by MATLAB before the expression reaches MuPAD.
V2106 = sym('2106192442915567908282078859207');
V4494 = sym('4494983136974228414275670063706112');
Bo = V2106/V4494 - (V2106 * exp( sym('-18446744073709551616') / (sym('1147831826363933') * (sym('81508471552582434684928') / (sym('3187597375937011') * hr) + sym('22182.30127333101796019592417497'))))) / V4494;
hr1 = solve( hr - sym('661') * sym('230') * sqrt(Bo), hr)

5 个评论

Actually the numbers you said not a numbers.These are symbols' value.They change for each iterations in the program. So i can't fix the numbers as a sym.
Also if i do this type,result is 0 but i want to use other result(hr=1997)
You did not code them as symbolic values, not here and not in your duplicate question. If you are generating this code, then alter the generation routine to generate symbolic numbers.
Try using assume() to add the assumption that hr > 0.
emre karakoc
emre karakoc 2013-3-28
编辑:emre karakoc 2013-3-28
Thanks Walter, i can find '0'.But the answers must be 0 and 1997.After the calculation i can see only 0 as a result. why can't I see the other root?I used assume ()command but it doesn't work. when i use this command, the answer is seen as [empty sym]
You are encountering round-off error, and the slope is very very steep near the 1997 solution. The program probably cannot isolate the root. You might need to increase Digits a fair bit (to 40 or so) to find the second root.
I do not have MuPAD, so I cannot test in MuPAD. The symbolic package I use does find the 1997-ish root.

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by