comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Transforming a nonlinear equation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Transforming a nonlinear equation [message #55217 is a reply to message #55214] Tue, 07 August 2007 09:12 Go to previous messageGo to previous message
Paolo Grigis is currently offline  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
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: byte offset in POINT_LUN
Next Topic: Re: the last line of a large file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 22:35:01 PDT 2025

Total time taken to generate the page: 3.12105 seconds