Reputation: 123
Given a polynomial in t and it's inverse, I want to figure out a way in MATLAB to implement the following function (the polynomial is defined using syms):
From c1*t^(x1)+c2*t^(x2)+...+cn*t^(xn), get c1*x1+c2*x2+...+cn*xn
Upvotes: 2
Views: 65
Reputation: 101064
Assuming y = c1*t^(x1)+c2*t^(x2)+...+cn*t^(xn)
, maybe you can use the following code
yt = diff(y);
k = subs(yt, t,1)
This is actually a calculus problem, you can use the property that
y'(t) = c1*x1*t^(x1-1) + c2*x2*t^(x2-1) + ... cn*xn*t^(xn-1)
and then evaluate y'(t)
with t=1
Upvotes: 2