1

Code is

    m[t_] := {mx[t], my[t], mz[t]}

    γ = 28;
    h = 6.62*10^-34;
    e = 1.6*10^-19;

    Subscript[μ, 0] = 1.25*10^-6;
    Subscript[μM, 0] = 800*10^-3;
    Subscript[M, 0] = 0.64*10^6;
    Subscript[r, 0] = 100*10^-9;
    Subscript[l, 0] = 3*10^-9;
    Subscript[I, dc] = 1*10^-3;
    Subscript[B, dc] = 200*10^-3;
    Subscript[α, G] = 0.01;

    p = {0, 0, 1};
    σ =(γ*h/2*e)*1/(Subscript[M, 0]*Pi*(Subscript[r, 0])^2)*Subscript[l, 0];
    Subscript[B, eff] = {Subscript[B, dc], 0, 0}-Subscript[μM, 0]*(m[t]*p);

    system1 ={D[m[t], t] ==γ*(Cross[Subscript[B, eff], m[t]]) + Subscript[α, 
    G]*(Cross[m[t], D[m[t], t]]) +σ*Subscript[I, dc]*(Cross[m[t], Cross[m[t], 
    p]]),(m[t] /. t -> 0) == {0, 1, 0}};

    s1 = NDSolve[system1, m[t], {t, 0, 50}]

    Plot[Evaluate[{mx[t], my[t], mz[t]} /. s1], {t, 0, 50},AxesLabel -> {t, m}]
    Plot[Evaluate[mx[t] /. s1], {t, 0, 5}, AxesLabel -> {t, mx}]

Below I find extreme points in the time interval $t\in (0,5)$.

z = Reap[s1 = NDSolve[{system1, WhenEvent[mx'[t] == 0, Sow[t]]}, m[t], {t, 0, 5}]][[2, 1]]

but I found values which lie on the axis of abscissa (t) without values of ordinate (mx). How can I find values of abcissa (t) with values of ordinate (mx)?

corey979
  • 23,947
  • 7
  • 58
  • 101
John
  • 573
  • 2
  • 9

1 Answers1

1

While Sowing ts you can also extract the value of mx at these ts with Sow[{t, mx[t]}]:

z = Reap[s1 = 
    NDSolve[{system1, WhenEvent[mx'[t] == 0, Sow[{t, mx[t]}]]}, 
     m[t], {t, 0, 5}]][[2, 1]]

{{0.156112, 0.788576}, {0.306931, 0.0632791}, {0.460744, 0.803356}, {0.609097, 0.123682}, {0.760459, 0.817252}, {0.906602, 0.181177}, {1.05577, 0.830297}, {1.19992, 0.23577}, {1.34711, 0.842525}, {1.48947, 0.287486}, {1.63488, 0.853971}, {1.77563, 0.336372}, {1.91943, 0.864671}, {2.0587, 0.382488}, {2.20105, 0.874662}, {2.339, 0.425909}, {2.48003, 0.88398}, {2.61677, 0.466719}, {2.7566, 0.892661}, {2.89224, 0.505012}, {3.03098, 0.900741}, {3.16562, 0.540888}, {3.30337, 0.908254}, {3.4371, 0.574451}, {3.57395, 0.915234}, {3.70685, 0.605809}, {3.84288, 0.921714}, {3.97502, 0.635069}, {4.11029, 0.927725}, {4.24174, 0.662342}, {4.37633, 0.933297}, {4.50715, 0.687734}, {4.64111, 0.938458}, {4.77135, 0.711352}, {4.90474, 0.943237}}

corey979
  • 23,947
  • 7
  • 58
  • 101