replace fraction by decimal value in expression

asked 2019-02-07 18:36:35 +0200

horte gravatar image

hello i use the function of simplification of sagemath but after full simplification some value like 5.55e-22 are replace by equivalent fraction of integer like 1/27450512014448776

can we force a symbolic expression to replace fraction by decimal value ? it s more easy to see something near zero like 5.55e-22 thant 1/27450512014448776

exemple of my problem :

equ = -1.41421356237309*lambda4*cos(q0)^2 - 1.41421356237310*lambda5*cos(q0)^2 - 1.41421356237309*lambda4*sin(q0)^2 - 1.41421356237310*lambda5*sin(q0)^2 - (3.64291929955129e-17)*lambda5*cos(q0) + (5.55111512312578e-17)*lambda4*sin(q0) + lambda0
print equ
print "-"*50
print equ.simplify_full()

result :

 -1.41421356237309*lambda4*cos(q0)^2 - 1.41421356237310*lambda5*cos(q0)^2 - 1.41421356237309*lambda4*sin(q0)^2 - 1.41421356237310*lambda5*sin(q0)^2 - (3.64291929955129e-17)*lambda5*cos(q0) + (5.55111512312578e-17)*lambda4*sin(q0) + lambda0
 --------------------------------------------------
 -1/27450512014448776*lambda5*cos(q0) + 1/18014398509481992*lambda4*sin(q0) + lambda0 - 69466132/49119973*lambda4 - 35869755/25363747*lambda5
edit retag flag offensive close merge delete

Comments

This is something that the simplification mechanism (Maxima) does do in these situations. There is a Maxima flag to unset that, though I cannot find it currently on http://maxima.sourceforge.net/docs/ma...

kcrisman gravatar imagekcrisman ( 2019-02-09 05:10:22 +0200 )edit