# FindRoot, Loops and multivariate nonlinear system

I posted a question yesterday asking how I could get all the solutions to my system of 4 nonlinear equations with 4 unknowns. I gave up on this since it seems NSolve cannot manage equations with the fractional powers that I have. So I am using FindRoot with some initial value guesses. What I want to do is loop and calculate FindRoot for different parameter values. For instance, I create a list of assigned parameter values. I can find a solution to my system by assigning this list of parameters values. I want to do this but many times by changing the values of the parameter a from 0 to 2 with steps of 1/10. How could I do this?

I have seen a few questions in this forum that answer this but the examples are univariate.

This is my parameter list.

dat = {alpha -> 1./3., beta -> 1./3., sigma -> 1./3., gam -> 0.5,
psy -> 0.5, delta -> 0.5, vu -> 0.5, A -> 1./3., B -> 1./3.,
C -> 1./3., Ls -> 10, T -> 10, mc -> 1.5};


This is my system of equations:

e1 = p2 - w^psy pw^gam ((psy/gam)^gam + (gam/psy)^psy) == 0;
e2 = Ls - (beta/w)^(alpha + sigma) (pw/(alpha (1 + a C r T)))^
alpha (r/sigma)^sigma (w Ls delta + r T A) - (pw psy/w gam)^
gam ((w Ls vu + r T B)/p2) == 0;
e3 = T - (sigma/r)^(alpha + beta) (w/beta)^
beta (pw/(alpha (1 + a C r T)))^alpha (w Ls delta + r T A) == 0;
e4 = pw - (((((1 + a C r T) alpha)/pw)^(beta + sigma) (w/beta)^
beta (r/sigma)^
sigma (w Ls delta + r T A) +  ((w gam)/(psy pw))^
psy ((w Ls vu + r T B)/p2)) mc (1 +
a C r T))/((((1 + a C r T) alpha)/pw)^(beta + sigma) (w/
beta)^beta (r/sigma)^
sigma (w Ls delta + r T A)  + ((w gam)/(psy pw))^
psy ((w Ls vu + r T B)/p2) (1 + a C r T)) == 0;


And this is the calculation I do using the parameter list:

FindRoot[{e1, e2, e3, e4} /. dat, {{w, 0.5}, {r, 2}, {p2, 0.8}, {pw, 1.8}}]


How can I do this multiple times by using different values of a?

• C symbol is reserved in Mathematica. Mar 26, 2015 at 23:17
• Sorry, I am a newbie, what does that mean, that C is used for special operations? Mar 26, 2015 at 23:24
• @Goose: In general, don't use uppercase initials on your symbols - you might clash with a built-in. In this case C is the default symbol for representation of constants. Try C=1 and see what happens...
– ciao
Mar 26, 2015 at 23:48

t = List[0, 0.5, 1, 1.5, 2]

And it does calculate FindRoot over the different values of a.