Simplifying output in Matlab
Mostrar comentarios más antiguos
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 comentarios
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
el 7 de Nov. de 2021
Walter Roberson
el 7 de Nov. de 2021
Is the rule that you want the numerator coefficient of x^1 to be in the range [1, 10) ?
Aleem Andrew
el 7 de Nov. de 2021
Star Strider
el 7 de Nov. de 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
el 7 de Nov. de 2021
The computation of smaller numbers is easier for human, but does not change the speed when performing the calculations on a computer.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Numerical Integration and Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

