Question: Solving simultaeous equations/comparing coefficients

Hey folks. I have a massively complicated equation I'm trying to solve and the internal memory can't take it.

 

Here is the problem.

 

Let f(x) := 1 - lambda*x^2

alpha := 1/f(1)

 

By solving the following equation,

 

alpha*f(f(x/alpha)) = f(x) + O(x^4)

 

We can determine a value of lambda and hence alpha (for which the real value is roughly -2.5 and the calculated value here is roughly -2.7).

 

Now, if we add in extra higher terms to f(x) we can increase the accuracy of the calculated value of alpha.

 

For example, Let f(x) := 1 - lambda*x^2 + a*x^4

alpha := 1/f(1) = 1/(1 - lambda + a)

 

Now solving the equation alpha*f(f(x/alpha) = f(x) + higher order terms as before, we can find a value for alpha and lambda by comparing coefficients. This gives a value of alpha of roughly -2.53, much closer than the -2.7 we had before.

 

This is the code I used to find -2.53 (note I found it differently (pretty much by hand) at first but then created this code to speed things up).

 

f := x -> 1 - lambda*x^2 + a*x^4;

g := 1 - lambda*x^2 + a*x^4;

 

alpha := 1/f(1);

Lambda := select(has, collect(alpha*f(f(x/alpha)),x), x^2):

lambda := [evalf(solve(A = select(has, g, x^2), a))][2];

 

A := select(has, collect(alpha*f(f(x/alpha)),x), x^4):

a := [evalf(solve(A = select(has, g, x^4), a))][1];

 

alpha := evalf(1/f(1));

 

Which seems to work. I used the [1] and [2] parts since this isolated the non-zero, non-complex solutions although I don't like using it since I'm not sure if it works for when I add in higher terms.

 

So now I'm trying to improve on this by adding another +b*x^6 term.

 

I then added the following lines of code to the above;

 

B := select(has, collect(alpha*f(f(x/alpha)),x), x^6):

b := [evalf(solve(A = select(has, g, x^6), b))][1];

 

and of course added in the extra term to f and g.

 

Now things become pretty grim. this won't compute before I run out of internal memory.

 

So, can anyone think of a much more efficient code to compare the coefficients and solve for lambda, a and b?

 

I'm trying to drop higher order terms as early as possible, i.e in this case anyhting above x^6 but I'm having no luck in doing this as it seems Order only applies to the series command.

 

So thanks in advance to anyone who helps!

 

Oh, I should also say that lambda > 0 is that makes a difference.

Please Wait...