Solve eqn and get real solution
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to solve an eqn and get the real solution. This is the code:
...
s=solve(R_);
...
And this is solution: s =
0.3971412063699492853956558622094
-0.8763850946630804323385057262195
- 0.13537805585343442652857506799495 - 0.83663803641655759940578883730279*i
- 0.13537805585343442652857506799495 + 0.83663803641655759940578883730279*i
As you can see "s" has two solutions are real (0.3971 and -0.87638) and two imaginary (with i). The real solution is needed. Which command can be used in this case? Give the example is helpful.
0 commentaires
Réponses (2)
Torsten
le 8 Oct 2015
syms s
y=-(2*((622930548819969075*s^4)/147573952589676412928 - (45369884049352485*s^3)/576460752303423488 + (69272938975695885*s^2)/144115188075855872 - (2396595835289415*s)/2251799813685248 + 2755552026909489/4503599627370496)*((124586109763993815*s^5)/147573952589676412928 - (45369884049352485*s^4)/2305843009213693952 + (23090979658565295*s^3)/144115188075855872 - (2396595835289415*s^2)/4503599627370496 + (2755552026909489*s)/4503599627370496 - 8557508135623347/36028797018963968) + 2*((10728642163125225*s^3)/288230376151711744 - (938834444243547705*s^4)/295147905179352825856 - (72312578171060145*s^2)/576460752303423488 + (3614047914544827*s)/36028797018963968 + 17054950948113267/1152921504606846976)*((10728642163125225*s^4)/1152921504606846976 - (187766888848709541*s^5)/295147905179352825856 - (24104192723686715*s^3)/576460752303423488 + (3614047914544827*s^2)/72057594037927936 + (17054950948113267*s)/1152921504606846976 - 1819839641949093/72057594037927936))/(2*(((17054950948113267*s)/1152921504606846976 + (3614047914544827*s^2)/72057594037927936 - (24104192723686715*s^3)/576460752303423488 + (10728642163125225*s^4)/1152921504606846976 - (187766888848709541*s^5)/295147905179352825856 - 1819839641949093/72057594037927936)^2 + ((2755552026909489*s)/4503599627370496 - (2396595835289415*s^2)/4503599627370496 + (23090979658565295*s^3)/144115188075855872 - (45369884049352485*s^4)/2305843009213693952 + (124586109763993815*s^5)/147573952589676412928 - 8557508135623347/36028797018963968)^2)^(3/2))
m=solve(y,s)
ix=arrayfun(@isreal,double(m));
m=m(ix);
disp(m);
Best wishes
Torsten.
1 commentaire
Voir également
Catégories
En savoir plus sur Formula Manipulation and Simplification dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!