Simplifying output in Matlab
Afficher commentaires plus anciens
If you get an expression like this as output
syms x
fx = -(1.0*(1.82e+39*x^2 + 1.81e+32*x - 3.04e+39))/(6.35e+41*x + 4.27e+37)
How do you simplify the output and use smaller numbers, for example
fx = -(1.0*(1.82e+7*x^2 + 1.81*x - 3.04e+7))/(6.35e+9*x + 4.27e+5)
6 commentaires
Likely the best to be hoped for is —
syms x
fx = -(1.0*(1.82e+39*x^2 + 1.81e+32*x - 3.04e+39))/(6.35e+41*x + 4.27e+37)
fx = vpa(fx, 3)
fx = vpa(simplifyFraction(fx), 3)
.
Aleem Andrew
le 7 Nov 2021
Walter Roberson
le 7 Nov 2021
Is the rule that you want the numerator coefficient of x^1 to be in the range [1, 10) ?
Aleem Andrew
le 7 Nov 2021
Star Strider
le 7 Nov 2021
The integration proceeded very quickly, running it in Input argument for ode45 function type error (running R2021b), however the coefficient magnitudes are large, although not so different between them that this could be regarded as a ‘stiff’ system. It could be worth experimenting with ode15s or other stiff solvers to see if the speed increases significantly.
Jan
le 7 Nov 2021
The computation of smaller numbers is easier for human, but does not change the speed when performing the calculations on a computer.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

