2
$\begingroup$

I have an equation,

ele[E2_] = -(1/(2 K3))
    L (E2^2 ea eo Sin[2 g[z]] - (K1 - K3) Sin[2 g[z]] Derivative[1][
      g][z]^2 + (K1 + K3 + (K1 - K3) Cos[2 g[z]]) (
      g^\[Prime]\[Prime])[z])

(* and parameters;*)

K1 = 12 ;
K3 = 19.5;
eo = 8.85;
ea = 14.5;
L = 1;

(for E2= 2 the starting value is 6)

nd = Map[First[
     NDSolve[{ele[2] == 0, g[0] == 0, g[L] == 0}, g[z], {z, 0, L}, 
      Method -> 
       "BoundaryValues" -> {"Shooting", 
         "StartingInitialConditions" -> { g[0] == 0, g'[0] == #}}]] &,
   {6}];
sl = Plot[Evaluate[{g[z]*(180/\[Pi]) /. nd}], {z, 0, L}, 
  PlotRange -> All]

(for E2= 3 the starting value is 9.6)

nd = Map[First[
     NDSolve[{ele[3] == 0, g[0] == 0, g[L] == 0}, g[z], {z, 0, L}, 
      Method -> 
       "BoundaryValues" -> {"Shooting", 
         "StartingInitialConditions" -> { g[0] == 0, g'[0] == #}}]] &,
   {9.6}];
sl = Plot[Evaluate[{g[z]*(180/\[Pi]) /. nd}], {z, 0, L}, 
  PlotRange -> All]

For (E2=1, the starting value is 1)

I cannot execute findroot to obtain starting values, so I can get the same output for E2 going from 1 to 30. By changing E2 from 1 to 30, the g will increase for instance E2=1,2,3,4 and stabilizes at 90 for E2=5,6,7.....

The output looks like the following for E2=3 and starting value 9.6.

enter image description here

When I copy the code back from stack to mathematical, it is giving some errors, so that's why the image with the infull code is attached.

$\endgroup$

1 Answer 1

6
$\begingroup$
Clear["Global`*"]

K1 = 12;
K3 = 195/10;
eo = 885/100;
ea = 145/10;
L = 1;

ele[E2_] = -(1/(2 K3)) L (E2^2 ea eo Sin[2 g[z]] - (K1 - K3) Sin[
       2 g[z]] g'[z]^2 + (K1 + K3 + (K1 - K3) Cos[2 g[z]]) g''[z]) // 
  Simplify

(* 1/520 (-1711 E2^2 Sin[2 g[z]] - 100 Sin[2 g[z]] g'[z]^2 + 
   20 (-21 + 5 Cos[2 g[z]]) g''[z]) *)

Use ParametricNDSolve with parameters E2 and gp0

pnd = ParametricNDSolve[{ele[E2] == 0, g[0] == 0, g[L] == 0}, 
  g, {z, 0, L}, {E2, gp0}, 
  Method -> 
   "BoundaryValues" -> {"Shooting", 
     "StartingInitialConditions" -> {g[0] == 0, g'[0] == gp0}}]

enter image description here

Plotting the three cases

Plot[Evaluate[{(g @@ #)[z]*(180/π) /. pnd}], {z, 0, L}, 
   PlotRange -> All,
   PlotLabel -> 
    StringForm["E2 = ``, g'(0) = ``", #[[1]], #[[2]]]] & /@ 
     {{1, 1}, {2, 6}, {3, 9.6}}

enter image description here

To estimate the starting values

FindFormula[{{1, 1}, {2, 6}, {3, 9.6}}, E2]

(* -5.4 + 7.1 E2 - 0.7 E2^2. *)

Plotting g against z and E2

Plot3D[Evaluate[
  {g[E2, -5.4 + 7.1 E2 - 0.7 E2^2][z]*(180/π) /. pnd}],
 {z, 0, L}, {E2, 1, 3},
 AxesLabel -> (Style[#, 14] & /@ {z, E2, g}),
 PlotRange -> All]

enter image description here

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.