Hi I was working on a model for oscilation problems with Lagrangian mechanichs for my Classical Mechanics I course.
My problem is the following:
When I try to Simplify some expressions like the one in the image below, sympy just shows the division and doesn´t reduce the expression.
I was wondering whether this is some kind of limitation of SymPy (probably that´s not the case) or is just me missing something. enter image description here
If SymPy doesn't know enough about the variables (like whether they are positive or zero) then it doesn't make a simplification. For
sqrtyou will get better results if you indicate that the variables are positive. Alternatively, you can useposifyon the expression before attempting the simplification.This would not be true if x were positive and y were negative (in which case the answer would be
-x/y)