0
$\begingroup$

I want to change 3 parameters: Subscript[I, dc], Subscript[B, dc], Subscript[μM, 0] and see changing on 2 graphs:

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

and

ParametricPlot3D[Evaluate[m[t] /. s1], {t, 0, 50}, PlotRange -> Full]

My code:

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, 50}, AxesLabel -> {t, mx}]

ParametricPlot3D[Evaluate[m[t] /. s1], {t, 0, 50}, PlotRange -> Full]

I tried to use "Manipulate" but have mistakes and it's not working. Below, how i tried to use "Manipulate"

Manipulate[
  Plot[Evaluate[mx[t] /. s1], {t, 0, 50}, AxesLabel -> {t, mx}], 
  {Subscript[I, dc], 0.001, 100}]

The error message I get is:

Manipulate::vsform: Manipulate argument {Subscript[I, dc],0.001,100} does not have the correct form for a variable specification.

$\endgroup$

marked as duplicate by m_goldberg, MarcoB, happy fish, Kuba Mar 6 '17 at 6:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ general topic 107628 and probably a duplicate: 85023, do you agree? $\endgroup$ – Kuba Mar 5 '17 at 19:06
  • $\begingroup$ do not use Subscript. Subscript should really be removed from future version of Mathematica :) $\endgroup$ – Nasser Mar 5 '17 at 19:18
  • $\begingroup$ I'm voting to close this question as off-topic because it is too localized; i.e, it applies only to the local situation and needs of its poster and answers will not benefit others. $\endgroup$ – m_goldberg Mar 5 '17 at 21:35
3
$\begingroup$

As the message you are seeing is telling you, the form Subscript[...] is not allowed as a control variable name in a Manipulate expression. AFAIK only identifiers that would be accepted as variable names in a list of local variable specifications given to DynamicModule can be used.

However, your code wouldn't work even if you were to rename your subscripted variables to ordinary variables. You would still face the fundamental problem that the parameters, such as Subscript[I, dc], have all been replaced by numerical values by the time NDSolve is evaluated.

Manipulate can only vary parameters in an expression that appear as symbols. You have no symbolic parameters in the plot expression you give to Manipulate. You just have a static plot where nothing can be varied.

You can see this by removing the semi-colon at the end of the expression the compute system1.

system1

$\endgroup$

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