I am trying to make a demo of using the symbolic pkg to solve
2 simultaneous Laplace equations, and the use the results with a function_handle.
syms f1 f2 x y1 y2 s k1 k2 c m1 m2
f1 = m1*s^2 * y1 == s*(c*(y2-y1))+k1*(y2-y1)
f2 =m2*s^2 * y2 == s*(c*(y1-y2)) + k1*(y1-y2)+k2*(x-y2)
[y1a, y2a]=solve(f1,f2,y1,y2)
This code works and gives
y1a = (sym)
-k₂⋅x⋅(c⋅s + k₁)
────────────────────────────────────────────────────────
2 ⎛ 2⎞ ⎛ 2⎞
(c⋅s + k₁) - ⎝c⋅s + k₁ + m₁⋅s ⎠⋅⎝c⋅s + k₁ + k₂ + m₂⋅s ⎠
Now I want it to be shown in power of s
I have found a poly2sym but I need a sym2poly
I also tried expand and it does show s^4 etc, but I can't get it to contract back to powers of s
Colin do you know how to do this?
--