discrepancy while running the eval funcion
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
The source code is below. R1 is just a multinomial in terms of T1 and T2. There is a discrepancy for the values m1 and m2. I am supposing them to be identical but they are not. Worse still, the third entries of them are quite different. Is there anything wrong when I used the eval function in the code? Does this discrepancy disappear if I used higher resolution (i.e., more digits) for the calculation? How? Thanks.
clc;clear all;
format long;
syms T1 T2;
R1=-(20*T1*T2 + 51*T1*T2^2 + 10*T2^2)*(146272*T1^2*T2^3 + 41342*T1^2*T2^2 + 1040*T1^2*T2 + 200*T1^2 + 27099*T1*T2^3 + 2040*T1*T2^2 + 400*T1*T2 + 1690*T2^3 + 200*T2^2)*(- 250710208*T1^3*T2^5 + 41873972*T1^3*T2^4 + 14400044*T1^3*T2^3 - 1797278*T1^3*T2^2 + 869840*T1^3*T2 - 9800*T1^3 + 54996498*T1^2*T2^5 + 75095644*T1^2*T2^4 + 8271756*T1^2*T2^3 + 1257020*T1^2*T2^2 + 10800*T1^2*T2 + 2000*T1^2 + 16185776*T1*T2^5 + 7516322*T1*T2^4 + 819720*T1*T2^3 + 78200*T1*T2^2 + 4000*T1*T2 + 1209560*T2^5 + 427020*T2^4 + 57600*T2^3 + 2000*T2^2)*(2002492630154240*T1^5*T2^6 - 1241222117102912*T1^5*T2^5 - 191601385814160*T1^5*T2^4 + 32207386732184*T1^5*T2^3 - 11523881039144*T1^5*T2^2 + 1400056482720*T1^5*T2 - 17878754400*T1^5 - 3809563673058304*T1^4*T2^7 + 2827038395565216*T1^4*T2^6 + 140073437800760*T1^4*T2^5 - 2811507824820*T1^4*T2^4 + 21912078533196*T1^4*T2^3 - 42466040126*T1^4*T2^2 - 171398217520*T1^4*T2 + 6002953400*T1^4 + 205333666033664*T1^3*T2^8 - 1324036748127328*T1^3*T2^7 + 654778663392480*T1^3*T2^6 - 98796906066260*T1^3*T2^5 - 13089768910652*T1^3*T2^4 - 3618893057244*T1^3*T2^3 - 59609267456*T1^3*T2^2 + 2257369680*T1^3*T2 - 556801600*T1^3 - 45042571833984*T1^2*T2^8 - 165802236565568*T1^2*T2^7 + 105699179029248*T1^2*T2^6 + 899931973192*T1^2*T2^5 + 313813414778*T1^2*T2^4 - 12802978208*T1^2*T2^3 - 16720825360*T1^2*T2^2 - 644966400*T1^2*T2 + 11204000*T1^2 - 13256280030208*T1*T2^8 - 3828427453056*T1*T2^7 + 7580810037504*T1*T2^6 + 1081612069392*T1*T2^5 - 12485342896*T1*T2^4 - 191758960*T1*T2^3 + 532846400*T1*T2^2 + 22408000*T1*T2 - 990639316480*T2^8 + 227077392640*T2^7 + 379437840640*T2^6 + 113723069920*T2^5 + 12752559640*T2^4 + 621011200*T2^3 + 11204000*T2^2);
T1=-0.4;
R11=eval(R1);
rt=eval(solve(R11));
rt_2=rt(find(rt>-0.9 & rt<-0.4));
m1=zeros(1,length(rt_2));
m2=zeros(1,length(rt_2));
for ii=1:length(rt_2)
T2=rt_2(ii);
m1(ii)=eval(R11);
m2(ii)=eval(R1);
end
m1
m2
Antworten (0)
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!