Norwegian explorer

MaplePrimes Activity


These are replies submitted by Norwegian explorer

@acer Of course! (thank you for taking the time). The full code is displayed below. Here, I wish to solve for i for a given set of F,L and sigma. This should be done by giving i and initial value (say 0.01) and solving nstar before conditioning i so that it corresponds in the solving of both i and nstar. The same procedure can as said be done fairly easily by applying goal-seek in Excel. There i have put an initial value for i in calculating nstar, and then calculating the implicit value for i from the i function below. Then i goal-seek the difference between the initial and implicit i to zero by changing the initial i only.

 

>B := 100;
>r := 0.01;
>t := 5;
>F := 80;
                            B := 100
                           r := 0.01
                             t := 5
                            F := 70
>gam := sigma -> 2*r/sigma^2;

>c := (L, sigma) -> fsolve(x*(1 - (L*x*gam(sigma)/(r*(gam(sigma) + 1)))^gam(sigma)/(gam(sigma) + 1))/r - 1, x);

>Phi := (L, sigma) -> c(L, sigma)*gam(sigma)/(r*(gam(sigma) + 1));
 

>mu := sigma -> r/(sigma*gam(sigma)) - 1/2*sigma*gam(sigma);

>G := (L, sigma) -> (L*Phi(L, sigma))^gam(sigma);

>nstar := (F, L, sigma) -> ceil((ln(k*F) - ln(c(L, sigma)*B))/ln(Phi(L, sigma)));

>i := (F, L, sigma) -> r*(1 - (G(L, sigma)*Phi(L, sigma))^nstar(F, L, sigma)*B/F)/(1 - G(L, sigma)^nstar(F, L, sigma));
 
>i := proc (F, L, sigma)

local k, eps,

nstar, i;

k := 0.01; 

eps := 1;

while 0.001 < eps do

nstar := 8;

i := 10;

eps := i-k;

k = i

end do;

k

end proc

 

@acer thanks for the quick response! it solved the issue of error, while the solution I am searching for seems to take far to long to calculate by maple as I have estimated similar values in Excel in only seconds, while the process in maple have been running for more than half an hour without an answer yet. Any idea how this could be solved quicker f.eks. by using the fsolve function?

Page 1 of 1