Thomas, These look like quantum energy level equations. Have you looked at sympy.physics.quantum to see if they have solved your problem? I seem to remember they have defined some special quantities for quantum numbers that are limited to integer and half-integer values. I make no promises as I have not actually used the package. This is just a recollection from scanning through the documents.
Jonathan On Wednesday, January 6, 2021 at 11:16:46 AM UTC-6 [email protected] wrote: > If I use 1/3 in an expression, I get 0.333..., but I know that I can write > Rational(1,3) instead. Now I have some expressions, such as > > -((s)/(j))*((4*(j-1)*s+4*j**2+4*j-2-4*(s-j+1)*m+m**2)/(2*(4*j**2-1)-4*m+m**2)) > where m is a symbol that will ultimately be replaced by a floating-point > number, and s and j are integers (positive or negative, but never zero). > They are replaced (using subs), and when I substitute s by 3 and j by 1, I > get 0.333.... In the formula, I can't write Rational(s,j), because Rational > does not accept a symbol as an argument. > Is there a way to do this? > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/920850a7-ed50-49cb-9f00-d07553b42c04n%40googlegroups.com.
