Solving a complex equation

I try to solve a complicated equation. To do that, I write (excuse me, I could not copy paste in an appropriate way from the notebook) ;

m[n_,θ_]:=-(((θ+ρ)+h z-(θ (1-n) (1-ω))/((1-α) λ)+λ n)^((α/(1-α)))/((λ^2 n ((h z)/Exp[β λ n]+(θ+ρ)-(θ (1-n) (1-ω))/((1-α) λ)+λ n)^(α/(1-α)) ((((θ+ρ)+h z-(θ (1-n) (1-ω))/((1-α) λ)+λ n)/((h z)/Exp[β λ n]+(θ+ρ)-(θ (1-n) (1-ω))/((1-α) λ)+λ n))^(α/(1-α))/Exp^[λ n (β/(1-α)+γ)+λ n]+1))/(1-n)^α))+(θ+ρ)-(θ (1-n) (1-ω))/((1-α) λ)+λ n

I try to solve this equation for variable "n" and I give values for $\theta$ between $0$ and $1$.

I use the calibration in the following way ;

paramFinal = {ρ -> 0.01, γ -> 0.5, ω -> 0.05, ψ -> 15.55, α -> 0.4, β -> 0.3, λ -> 0.5, h -> 0.05, z -> 0.08};

Firstly, I proceed in a following way ;

sol[i_] := NSolve[m[n, i] == 0 /. paramFinal, n];
Table[sol[i], {i, 0.5, 1}];
solution = sol[i];

This one did not work. I also try ?NumericQ way to solve it.

sol3[i_?NumericQ] := {n, i} /.
NSolve[m[n, i] == 0 /. paramFinal, n, Reals]
tab = Table[sol3[i], {i, 0, 1}]

It did not work neither, it remains always in "Running..." mode. Unfortunately, I can not simplify the expression mathematically.

How can I proceed to solve this equation ? Thanks in advance for all suggestions.

• Do you mean E or e? – Michael E2 Nov 1 '16 at 18:05
• Your syntax defining m is incorrect. – Michael E2 Nov 1 '16 at 18:05
• Something like this?: FindRoot[m[n, 0.5] == 0 /. paramFinal, {n, 0.9}], FindRoot[m[n, 0.5] == 0 /. paramFinal, {n, -0.9}] – Michael E2 Nov 1 '16 at 18:10
• @MichaelE2 I edited the syntax concerning exponential and brackets for "m". Sorry for that. Yes, I try to find values for "n" for different $\theta$ values. – optimal control Nov 1 '16 at 18:12
• Now you have another syntax error: Syntax::sntxf: "Exp^" cannot be followed by "[λ n(β/(1-α)+γ)+λ n]" -- Drop the ^. There are other instances of e^(...), too. – Michael E2 Nov 1 '16 at 18:15

Update

In your equation is still a syntax error Exp^. I have corrected this error. The solutions I've found are correct.

paramFinal = {ρ -> 0.01, γ -> 0.5, ω -> 0.05, ψ -> 15.55, α -> 0.4, β ->
0.3, λ -> 0.5, h -> 0.05, z -> 0.08};

m[θ_]=-(((θ+ρ)+h z-(θ (1-n) (1-ω))/((1-α) λ)+λ n)^((α/(1-α)))/((λ^2 n ((h z)/Exp[β λ n]+(θ+ρ)-(θ (1-n) (1-ω))/((1-α) λ)+λ n)^(α/(1-α)) ((((θ+ρ)+h z-(θ (1-n) (1-ω))/((1-α) λ)+λ n)/((h z)/Exp[β λ n]+(θ+ρ)-(θ (1-n) (1-ω))/((1-α) λ)+λ n))^(α/(1-α))/Exp[λ n (β/(1-α)+γ)+λ n]+1))/(1-n)^α))+(θ+ρ)-(θ (1-n) (1-ω))/((1-α) λ)+λ n/.paramFinal

sol=Table[First@FindInstance[m[i] == 0, n], {i, 0, 5}] // Chop
{{n -> 0.987955}, {n -> 0.911649}, {n -> 0.854773},
{n -> 0.819723}, {n -> 0.796528}, {n -> 0.780113}}

Table[m[i] /. sol[[i + 1]], {i, 0, 5}] // Chop
{0, 0, 0, 0, 0, 0}

With θ between 0 and 1, the roots are in the range [-2, 1], as shown by the plots. Now we have "seeds" to feed FindRoot (start point).

Multicolumn[Plot[m[#], {n, -5, 2}] & /@ Range[0, 1, 0.1] // Quiet, 3] FindRoot[m[#] == 0, {n, 1}] & /@ Range[0, 1, 0.1] // Chop FindRoot[m[#] == 0, {n, -1}] & /@ Range[0, 1, 0.1] // Chop • Thanks a lot ! There is a point that I did not understand on the code. How you give the value for $\theta$ ? because as you define the function m, just in terms of "n", I don't see how $\theta$ plays a role. – optimal control Nov 1 '16 at 19:27
• Also, when I run exact the same code, I get error messages. – optimal control Nov 1 '16 at 19:35
• @ optimal control I have made an update. m[n_] is a copy and paste error, sorry. – user36273 Nov 1 '16 at 23:00
• Thanks a lot ! This helped really a lot ! – optimal control Nov 2 '16 at 11:28