Hi there,
I have just discovered sympy and am making my first tentative experiments.
Over the years I've probably forgotten more maths than I remember so my knowledge is somewhere between basic engineering maths and multiplication tables. Having retired I'm trying to dredge some of it back from the depths.
I'm comfortable with programming and have been writing some python lately, primarily for use in Rhino3D.
I have some simultaneous equations to solve for four variables, F1, F2, F3 and F4. and a lot of given values V1x, V2x etc. Given the number of parameters, making substitutions manually is error prone, so I figured I'd get sympy to do the grunt work. However, subs() doesn't seem to be working for me. Could somebody show me where I am going wrong?
Here's a simplified interactive example:
>>> import sympy as s
>>> s.init_printing()
>>> F1,F2,F3,F4=s.symbols('F1 F2 F3 F4')
>>> V1x,V2x,V3x,V4x=s.symbols('V1x V2x V3x V4x')
>>> V1y,V2y,V3y,V4y=s.symbols('V1y V2y V3y V4y')
>>>
>>> eqx=F1*V1x+F2*V2x+F3*V3x+F4*V4x
>>> eqy=F1*V1y+F2*V2y+F3*V3y+F4*V4y
>>> eqx
F₁⋅V1x + F₂⋅V2x + F₃⋅V3x + F₄⋅V4x
>>> eq1=s.solve(eqx, F1)
>>> eq1
⎡-F₂⋅V2x - F₃⋅V3x - F₄⋅V4x⎤
⎢─────────────────────────⎥
⎣ V1x ⎦
>>> eq2=eqy.subs(F1, eq1)
>>> eq2
F₁⋅V1y + F₂⋅V2y + F₃⋅V3y + F₄⋅V4y
>>>
I was expecting sympy to substitute the solution in eq1 into the formula in eqy, but that hasn't happened. Why not?
TIA
Jeremy