When i try to solve the following equation, i get error message that

“Solve::dinv: ….”due to the presence of Log[s0] term. How to solve this? the code is given below:

sig = 2.;

ks = (Pi/6) (4 sig/Log[s0])^3;

i0 = (2/(9 Pi))^(1/3) sig^0.5 s0^(2 – 0.5 ks);

n0 = i0 tc

m0 = (i0 ks^(1/3) + ((s0 – 1) n0/3)) tc

a0 = (i0 ks^(2/3) + (2 (s0 – 1) m0/3)) tc

rr = 100.;

tc = 1000.;

Solve[{rr – (s0/tc) – i0 ks – (s0 – 1) tc (

i0 ks^(2/3) +

(

2 (s0 – 1) tc/3 (i0 ks^(1/3) + (s0 – 1) tc i0/3)

)

) == 0}, s0

]

Thanks and Regards,

=================

This is a numerical problem, use FindRoot

– george2079

Mar 15 at 19:14

Thank you george2079, it worked….

– Anand

Mar 15 at 19:18

=================

2 Answers

2

=================

Amplifying on answer by yode. Use exact expressions to avoid need to Rationalize when using Solve

sig = 2;

ks = (Pi/6) (4 sig/Log[s0])^3;

i0 = (2/(9 Pi))^(1/3) Sqrt[sig] s0^(2 – ks/2);

n0 = i0 tc;

m0 = (i0 ks^(1/3) + ((s0 – 1) n0/3)) tc;

a0 = (i0 ks^(2/3) + (2 (s0 – 1) m0/3)) tc;

rr = 100;

tc = 1000;

f[s0_] = rr – (s0/tc) –

i0 ks – (s0 –

1) tc (i0 ks^(2/3) + (2 (s0 – 1) tc/

3 (i0 ks^(1/3) + (s0 – 1) tc i0/3)));

Use a constraint with Solve or NSolve

Solve[{f[s0] == 0, 9 < s0 < 11}, s0][[1]] // N (* {s0 -> 10.0023} *)

NSolve[{f[s0] == 0, 9 < s0 < 11}, s0][[1]] (* {s0 -> 10.0023} *)

FindRoot[f[s0], {s0, 10}]

(* {s0 -> 10.0023} *)

Thank you for detail explanation…Bob Hanlon

– Anand

Mar 15 at 19:40

This equation isn’t be solved by Solve usually.First we should use Plot to estimate its initial value.Then we use FindRoot to solve it.The process like following:

sig = 2.;

ks = (Pi/6) (4 sig/Log[s0])^3;

i0 = (2/(9 Pi))^(1/3) sig^0.5 s0^(2 – 0.5 ks);

n0 = i0 tc;

m0 = (i0 ks^(1/3) + ((s0 – 1) n0/3)) tc;

a0 = (i0 ks^(2/3) + (2 (s0 – 1) m0/3)) tc;

rr = 100.;

tc = 1000.;

Plot[rr – (s0/tc) –

i0 ks – (s0 –

1) tc (i0 ks^(2/3) + (2 (s0 – 1) tc/

3 (i0 ks^(1/3) + (s0 – 1) tc i0/3))), {s0, -8, 8}]

Then you get it.

FindRoot[rr – (s0/tc) –

i0 ks – (s0 –

1) tc (i0 ks^(2/3) + (2 (s0 – 1) tc/

3 (i0 ks^(1/3) + (s0 – 1) tc i0/3))), {s0, 7.}]

{s0 -> 10.0023}

thank you yode, it (FindRoot) worked…

– Anand

Mar 15 at 19:20