Skip to main content
deleted 1 character in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Two changes in your code: (1) made sol a two-parameter function and evaluate it outside Manipulate, (2) used {sol[a,b][[1]],sol[a,b][[2]]} as the first argument in Plot:

sol = ParametricNDSolveValue[{s'[t] == -a*c*d[t], d'[t] == +c*s[t]c*s[t], 
    s[0] == 100, d[0] == 0}, {s[7], d[7]}, {t, 0, 20}, {a, c}];

Manipulate[Plot[{sol[a, b][[1]], sol[a, b][[2]]}, {a, 1/10, 10}, 
  PerformanceGoal -> "Speed", ImageSize -> 400, 
  PlotStyle -> {Black, Blue}], 
 {{b, 1, "b"}, .1, 10, Appearance -> "Open"}]

enter image description here

Note: If we use sol[a,b] or Evaluate@sol[a,b] instead of {sol[a, b][[1]], sol[a, b][[2]]} we get two curves with the same color.

Two changes in your code: (1) made sol a two-parameter function and evaluate it outside Manipulate, (2) used {sol[a,b][[1]],sol[a,b][[2]]} as the first argument in Plot:

sol = ParametricNDSolveValue[{s'[t] == -a*c*d[t], d'[t] == +c*s[t], 
    s[0] == 100, d[0] == 0}, {s[7], d[7]}, {t, 0, 20}, {a, c}];

Manipulate[Plot[{sol[a, b][[1]], sol[a, b][[2]]}, {a, 1/10, 10}, 
  PerformanceGoal -> "Speed", ImageSize -> 400, 
  PlotStyle -> {Black, Blue}], 
 {{b, 1, "b"}, .1, 10, Appearance -> "Open"}]

enter image description here

Note: If we use sol[a,b] or Evaluate@sol[a,b] instead of {sol[a, b][[1]], sol[a, b][[2]]} we get two curves with the same color.

Two changes in your code: (1) made sol a two-parameter function and evaluate it outside Manipulate, (2) used {sol[a,b][[1]],sol[a,b][[2]]} as the first argument in Plot:

sol = ParametricNDSolveValue[{s'[t] == -a*c*d[t], d'[t] == c*s[t], 
    s[0] == 100, d[0] == 0}, {s[7], d[7]}, {t, 0, 20}, {a, c}];

Manipulate[Plot[{sol[a, b][[1]], sol[a, b][[2]]}, {a, 1/10, 10}, 
  PerformanceGoal -> "Speed", ImageSize -> 400, 
  PlotStyle -> {Black, Blue}], 
 {{b, 1, "b"}, .1, 10, Appearance -> "Open"}]

enter image description here

Note: If we use sol[a,b] or Evaluate@sol[a,b] instead of {sol[a, b][[1]], sol[a, b][[2]]} we get two curves with the same color.

deleted 2 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Two changes in your code: (1) made sol a two-parameter function and evaluate it outside Manipulate, (2) used {sol[a,b][[1]],sol[a,b][[2]]} as the first argument in Plot:

sol = ParametricNDSolveValue[{s'[t] == -a*c*d[t], d'[t] == +c*s[t], 
    s[0] == 100, d[0] == 0}, {s[7], d[7]}, {t, 0, 20}, {a, c}];

Manipulate[Plot[{sol[a, b][[1]], sol[a, b][[2]]}, {a, 1/10, 10}, 
  PerformanceGoal -> "Speed", ImageSize -> 400, 
  PlotStyle -> {Black, Blue}], 
 {{b, 1, "b"}, .1, 10, Appearance -> "Open"}]

enter image description here

Note: If we use sol[a,b] andor Evaluate@sol[a,b] in placeinstead of {sol[a, b][[1]], sol[a, b][[2]]} we get two curves with the same color.

Two changes in your code: (1) made sol a two-parameter function and evaluate it outside Manipulate, (2) used {sol[a,b][[1]],sol[a,b][[2]]} as the first argument in Plot:

sol = ParametricNDSolveValue[{s'[t] == -a*c*d[t], d'[t] == +c*s[t], 
    s[0] == 100, d[0] == 0}, {s[7], d[7]}, {t, 0, 20}, {a, c}];

Manipulate[Plot[{sol[a, b][[1]], sol[a, b][[2]]}, {a, 1/10, 10}, 
  PerformanceGoal -> "Speed", ImageSize -> 400, 
  PlotStyle -> {Black, Blue}], 
 {{b, 1, "b"}, .1, 10, Appearance -> "Open"}]

enter image description here

Note: If we use sol[a,b] and Evaluate@sol[a,b] in place of {sol[a, b][[1]], sol[a, b][[2]]} we get two curves with the same color.

Two changes in your code: (1) made sol a two-parameter function and evaluate it outside Manipulate, (2) used {sol[a,b][[1]],sol[a,b][[2]]} as the first argument in Plot:

sol = ParametricNDSolveValue[{s'[t] == -a*c*d[t], d'[t] == +c*s[t], 
    s[0] == 100, d[0] == 0}, {s[7], d[7]}, {t, 0, 20}, {a, c}];

Manipulate[Plot[{sol[a, b][[1]], sol[a, b][[2]]}, {a, 1/10, 10}, 
  PerformanceGoal -> "Speed", ImageSize -> 400, 
  PlotStyle -> {Black, Blue}], 
 {{b, 1, "b"}, .1, 10, Appearance -> "Open"}]

enter image description here

Note: If we use sol[a,b] or Evaluate@sol[a,b] instead of {sol[a, b][[1]], sol[a, b][[2]]} we get two curves with the same color.

added 144 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Two changes in your code: (1) made sol a two-parameter function and evaluate it outside Manipulate, (2) used {sol[a,b][[1]],sol[a,b][[2]]} as the first argument in Plot:

sol = ParametricNDSolveValue[{s'[t] == -a*c*d[t], d'[t] == +c*s[t], 
    s[0] == 100, d[0] == 0}, {s[7], d[7]}, {t, 0, 20}, {a, c}];

Manipulate[Plot[{sol[a, b][[1]], sol[a, b][[2]]}, {a, 1/10, 10}, 
  PerformanceGoal -> "Speed", ImageSize -> 400, 
  PlotStyle -> {Black, Blue}], 
 {{b, 1, "b"}, .1, 10, Appearance -> "Open"}]

enter image description here

Note: If we use sol[a,b] and Evaluate@sol[a,b] in place of {sol[a, b][[1]], sol[a, b][[2]]} we get two curves with the same color.

Two changes in your code: (1) made sol a two-parameter function and evaluate it outside Manipulate, (2) used {sol[a,b][[1]],sol[a,b][[2]]} as the first argument in Plot:

sol = ParametricNDSolveValue[{s'[t] == -a*c*d[t], d'[t] == +c*s[t], 
    s[0] == 100, d[0] == 0}, {s[7], d[7]}, {t, 0, 20}, {a, c}];

Manipulate[Plot[{sol[a, b][[1]], sol[a, b][[2]]}, {a, 1/10, 10}, 
  PerformanceGoal -> "Speed", ImageSize -> 400, 
  PlotStyle -> {Black, Blue}], 
 {{b, 1, "b"}, .1, 10, Appearance -> "Open"}]

enter image description here

Two changes in your code: (1) made sol a two-parameter function and evaluate it outside Manipulate, (2) used {sol[a,b][[1]],sol[a,b][[2]]} as the first argument in Plot:

sol = ParametricNDSolveValue[{s'[t] == -a*c*d[t], d'[t] == +c*s[t], 
    s[0] == 100, d[0] == 0}, {s[7], d[7]}, {t, 0, 20}, {a, c}];

Manipulate[Plot[{sol[a, b][[1]], sol[a, b][[2]]}, {a, 1/10, 10}, 
  PerformanceGoal -> "Speed", ImageSize -> 400, 
  PlotStyle -> {Black, Blue}], 
 {{b, 1, "b"}, .1, 10, Appearance -> "Open"}]

enter image description here

Note: If we use sol[a,b] and Evaluate@sol[a,b] in place of {sol[a, b][[1]], sol[a, b][[2]]} we get two curves with the same color.

deleted 408 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading