Re: Transforming a nonlinear equation [message #55217 is a reply to message #55214] |
Tue, 07 August 2007 09:12   |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
wlandsman wrote:
> The following task probably can't be done with IDL, but maybe some IDL
> users can point me in the right direction.
>
> I have a nonlinear equation in x, e.g.
>
> (1) y = 3.2 + 1.2*x + 3.1*x^2 - 4.2*x^3
>
> and I have a linear transformation in x: x' = 1.2*x + 0.4
> so I want to find the new coefficients of equation (1) under the
> transformation. If I were to do this with pencil and paper, I
> would put the transformation equation into (1), and collect all the
> cubic terms, quadratic terms etc. to find the new coefficients.
>
> I presume (but am not certain) that this is something that is very
> simple to do with Mathematica or Maple. But right now I only
> need it for a couple of equations so I'd prefer not to have to learn
> Mathematica (or do it by hand). Thanks, --Wayne
>
This should be feasible using the binomial expansion formula
(a+b)^n =sum_i^n binomial(i,n) * a^i * b^(n-i)
If the original polynomial is given by an array a with the coefficients
index equal its order, and x=alpha*y+beta is the linear transformation,
then the following code should deliver the new coefficients of the
y-polynomial:
degree=n_elements(a)-1
newarray=a*0
FOR i=0,degree DO BEGIN
FOR j=0,i DO BEGIN
newarray[j]=newarray[j]+a[i]*binomial(j,i)*alpha^j*beta^(i-j )
ENDFOR
ENDFOR
where the binomial(j,n) function returns
factorial(n)/(factorial(j)*factorial(n-j))
Ciao,
Paolo
|
|
|