Ask Your Question

horte's profile - activity

2019-02-07 14:47:52 -0500 received badge  Student (source)
2019-02-07 14:12:46 -0500 asked a question 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