python - Equation roots: parameter doesn't get simplified -
i using python sympy.
i need solve following equation, finding 4 roots (omega unknown):
deter= 0.6*omega**4*cos(omega*t)**2 - 229.0*omega**2*cos(omega*t)**2 + 5880.0*cos(omega*t)**2
i tried use solve:
eqcarr=solve(deter,omega,exclude=[t])
i output:
[-18.8143990830350, -5.26165884593044, 5.26165884593044, 18.8143990830350, 1.5707963267949/t, 4.71238898038469/t]
i need first 4 values, , not values t coefficient. expect cos(omega*t)**2 simplified in solve, doesn't happen.
according documentation solve
not solve of free symbols passed in exclude
.
'exclude=[] (default)' don't try solve of free symbols in exclude; if expressions given, free symbols in them extracted automatically.
it not meant filter solution.
you can solve problem doing this:
in [10]: sympy import * in [11]: sympy.abc import omega, t in [12]: deter= 0.6*omega**4*cos(omega*t)**2 - 229.0*omega**2*cos(omega*t)**2 + 5880.0*cos(omega*t)**2 in [13]: eqcarr=solve(deter,omega,exclude=[t]) in [14]: filtered = [i in eqcarr if not i.has(t)] in [15]: filtered out[15]: [-18.8143990830350, -5.26165884593044, 5.26165884593044, 18.8143990830350]
Comments
Post a Comment