MD.
Posts:
3
Registered:
6/9/12
|
|
Using muller() function to solve polynomial equations
Posted:
Jun 10, 2012 8:24 PM
|
|
Can anyone help me for the problem I am describing below:
I generate equations using following programme:
clear all; close all;
syms z c=4; lamda=0.5; b= 0.04; er= [0.5 0.5 0.1 0.1 0.7 ];
for r=1:c y(r+1)=er(r+1)*(exp(-lamda*b*(1-z))^r)*z^(c-r); y2=sum(y); end
y3=collect(z^c-y2)
Here, I assumed c=4. The equation come as follows;
y3=z^4 + (-exp(z/50 - 1/50)/2)*z^3 + (-exp(z/25 - 1/25)/10)*z^2 + (-exp((3*z)/50 - 3/50)/10)*z - (7*exp((2*z)/25 - 2/25))/10
I want to solve the equation using "muller()" function. Now, if I write "muller()" function in following way, it gives me error massage.
muller(@(z) y3, 0,500,[-1,1],[-1,1],0,zeros(c,1))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Error using sym>notimplemented (line 2682) Function 'lt' is not implemented for MuPAD symbolic objects.
Error in sym/lt (line 812) notimplemented('lt');
Error in muller (line 63) if fnreal*real(sqr)<0.0, sqr=0.0; else sqr=sqrt(sqr); end
Error in f (line 32) muller(@(z)y3, 0,500,[-1,1],[-1,1],0,zeros(c,1)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
But, If I copy and past the above equation in following manner in "muller()" function, it gives me nice result. muller(@(z) z^4 + (-exp(z/50 - 1/50)/2)*z^3 + (-exp(z/25 - 1/25)/10)*z^2 + (-exp((3*z)/50 - 3/50)/10)*z - (7*exp((2*z)/25 - 2/25))/10, 0,500,[-1,1],[-1,1],0,zeros(c,1))
(ans = -0.7780 0.0675 - 0.8544i 0.0675 + 0.8544i 1.1421 - 0.0000i)
However, in my programme "c" is not a constant. It will have a array like c = [ 50 60 70 80 90...... and so on ]. (The array "er" will also be changed accordingly). It is difficult to copy and paste every time the equations generated from the above programme in "muller()" function and find roots.
Can anyone suggest me how can I solve equations generated from the programme for different values of c.
|
|