Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

replace fraction by decimal value in expression

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