3
$\begingroup$

I failed to color my parametric plot of multiple iterations of a differential equation system by elapsed time (t).

The equation is:

a = 3
sx = 0.34
sy = 0.33

sol11 = Table[NDSolve[{x'[t] == 
 y[t]*((x[t]^a) sx) + (1 - x[t] - y[t])*((x[t]^a)*sx) - 
  x[t]*((y[t]^a)*sy) - x[t]*((1 - x[t] - y[t])^a)*(1 - sx - sy),
y'[t] == 
 x[t]*((y[t]^a) sy) + (1 - x[t] - y[t])*((y[t]^a)*sy) - 
  y[t]*((x[t]^a)*sx) - y[t]*((1 - x[t] - y[t])^a)*(1 - sx - sy), 
x[0] == i, y[0] == j}, {x[t], y[t]}, {t, 400}], {i, {0.315, 0.345,
 0.355, 0.360, 0.362, 0.265, 0.268, 0.275, 0.285, 0.295, 0.365, 
0.39, 0.39, 0.393, 0.4}}, {j, {0.395, 0.385, 0.375, 0.365, 0.355, 
0.335, 0.325, 0.315, 0.305, 0.3, 0.360, 0.40, 0.27, 0.27, 0.225}}]

Here there are two differential equations as a system and I use the Table function to conveniently produce many solutions with varying initial parameters.

    param11 = ParametricPlot[{Evaluate[{x[t], y [t]} /. Flatten[sol11, 2]]}, {t, 0, 400}, 
  ColorFunction -> Function[{x, y, t}, Hue[t]], 
  ColorFunctionScaling -> False, WorkingPrecision -> 10, 
  FrameLabel -> {"x", "y"}, RotateLabel -> False, AspectRatio -> 1, 
  LabelStyle -> Black, Frame -> True, Axes -> True, 
  FrameStyle -> Directive[FontFamily -> "Times", 14], 
  PlotStyle -> {Dashing[{0.005, 0.006, 0.006, 0.006}]}, 
  GridLines -> Automatic, ImageSize -> Large, PlotRange -> All]

This however produces my graph with hue varying from one edge to the other. I wish the color to represent each iterations time variable, since the axis of the plot represent agents of both equations.

The idea being, color would allow me to show even more information on one image.

Thanks in advance.

$\endgroup$

1 Answer 1

7
$\begingroup$

The problem has nothing to do with differential equation. It's simply because you haven't scaled the color function properly. The color function should be With[{tbegin = 0, tend = 400}, Function[{x, y, t}, Hue[t/(tend - tbegin)]]] in this case. After the modification:

Mathematica graphics

$\endgroup$
4
  • $\begingroup$ Thank you! Also gave me insight into how to properly use these functions! $\endgroup$ Commented Oct 21, 2016 at 12:38
  • $\begingroup$ Could you also give me tips on what should i take into account to make it work for RGBcolor... say, change from black to green as time advances? $\endgroup$ Commented Oct 21, 2016 at 12:51
  • $\begingroup$ @Castle Check the document of Blend $\endgroup$ Commented Oct 21, 2016 at 12:58
  • 1
    $\begingroup$ +1 but note that the problem is created by ColorFunctionScaling -> False in the first place. Without that, or with ColorFunctionScaling -> True, you don't need to do the scaling manually. $\endgroup$ Commented Oct 21, 2016 at 13:09

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.