# Plot a system of differential parametric equations with ParametricNDSolve?

**URL:** <https://community.wolfram.com/t/plot-a-system-of-differential-parametric-equations-with-parametricndsolve/14056>\
**Category:** Questions\
**Tags:** calculus, graphics-and-visualization, numerical-computation\
**Created:** [May 7, 2019, 6:33pm UTC](https://community.wolfram.com/t/plot-a-system-of-differential-parametric-equations-with-parametricndsolve/14056 "2019-05-07T18:33:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelsolomon](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@michaelsolomon](https://community.wolfram.com/u/michaelsolomon)\
**Post date:** [May 7, 2019, 6:33pm UTC](https://community.wolfram.com/t/plot-a-system-of-differential-parametric-equations-with-parametricndsolve/14056/1 "2019-05-07T18:33:47Z")

</div>

Hey all,

I’m pretty new to Mathematica so go easy on me. I have been trying to plot a system of differential parametric equations without any success. It appears as though Mathematica is solving them, but it won’t plot them. I have put my code that I am using below and was hoping someone could take a look at what I did wrong:

```
a = .1
ParametricPlot3D[{Sin[t], Cos[t], t/4}, {t, 0, 2 Pi}]
 
 sol = ParametricNDSolve[{x'[t] == t, y'[t] == t^2, z'[t] == 3*t, 
   x[0] == 1, y[0] == 0, z[0] == 0}, {x, y, z}, {t, 0, 100} , {}]
ParametricPlot3D[sol, {t, 0, 100 }, PlotRange -> All]
 sol2 = ParametricNDSolve[{x'[
     t] == ( -Sin[t]*(1 + a^2 + t^2) - 
       2*t*Cos (t))/(1 + a^2 + t^2)^2,  
   y'[t] == ( 
      Cos[t]*(1 + a^2 + t^2) - 2*t*Sin (t))/(1 + a^2 + t^2)^2, 
   z'[t] == a*(1 + a^2 - t^2)/(1 + a^2 + t^2)^2, x[0] == 1, 
   y[0] == 0, z[0] == 0}, {x, y, z}, {t, 0, 100} , {}]
ParametricPlot3D[sol2, {t, 0, 100 }, PlotRange -> All]

```

---

<div class="post-metadata">

**Author:** ![mariuszi28cg](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mariuszi28cg/32/308_2.png) [@mariuszi28cg](https://community.wolfram.com/u/mariuszi28cg)\
**Post date:** [May 7, 2019, 7:16pm UTC](https://community.wolfram.com/t/plot-a-system-of-differential-parametric-equations-with-parametricndsolve/14056/2 "2019-05-07T19:16:59Z")

</div>

Try,using **NDSolve** :

```
 ClearAll["Global`*"]; Remove["Global`*"];

 sol = NDSolve[{x'[t] == t, y'[t] == t^2, z'[t] == 3*t, x[0] == 1, 
     y[0] == 0, z[0] == 0}, {x, y, z}, {t, 0, 10}];
 ParametricPlot3D[{x[t], y[t], z[t]} /. sol, {t, 0, 10}, 
  PlotRange -> All, AspectRatio -> 1/2, 
  AxesLabel -> {"x[t]", "y[t]", "z[t]"}]

 a = 1/10; 
  sol2 = NDSolve[{x'[
      t] == (-Sin[t]*(1 + a^2 + t^2) - 2*t*Cos[t])/(1 + a^2 + t^2)^2, 
    y'[t] == (Cos[t]*(1 + a^2 + t^2) - 2*t*Sin[t])/(1 + a^2 + t^2)^2, 
    z'[t] == a*(1 + a^2 - t^2)/(1 + a^2 + t^2)^2, x[0] == 1, y[0] == 0,
     z[0] == 0}, {x, y, z}, {t, 0, 10}];
ParametricPlot3D[{x[t], y[t], z[t]} /. sol2, {t, 0, 10}, 
 PlotRange -> All, AspectRatio -> 1, 
 AxesLabel -> {"x[t]", "y[t]", "z[t]"}]

```

Or using **ParametricNDSolve** :

```
  ClearAll["Global`*"]; Remove["Global`*"];

  sol3 = ParametricNDSolve[{x'[
        t] == (-Sin[t]*(1 + a^2 + t^2) - 2*t*Cos[t])/(1 + a^2 + t^2)^2, 
      y'[t] == (Cos[t]*(1 + a^2 + t^2) - 2*t*Sin[t])/(1 + a^2 + t^2)^2, 
      z'[t] == a*(1 + a^2 - t^2)/(1 + a^2 + t^2)^2, x[0] == 1, 
      y[0] == 0, z[0] == 0}, {x, y, z}, {t, 0, 10}, {a}];
ParametricPlot3D[{x[a][t], y[a][t], z[a][t]} /. sol3 /. a -> 1/10, {t,0, 10}, PlotRange -> All, AspectRatio -> 1, AxesLabel -> {"x[t]", "y[t]", "z[t]"}]

```

---

<div class="post-metadata">

**Author:** ![mfroeling](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mfroeling/32/23010_2.png) [@mfroeling](https://community.wolfram.com/u/mfroeling)\
**Post date:** [May 7, 2019, 8:22pm UTC](https://community.wolfram.com/t/plot-a-system-of-differential-parametric-equations-with-parametricndsolve/14056/3 "2019-05-07T20:22:34Z")

</div>

not sure how the solution looks like but this plots something

```
ParametricPlot3D[
 Evaluate[{x[][t], y[][t], z[][t]} /. sol2], {t, 0, 100}, 
 PlotRange -> All, BoxRatios -> {1, 1, 1}]

```

Never used `ParametricNDSolve` solve but what i can see it that it generates a list of replacement rules with `ParametericFunction` objects.

 ![Capture.PNG](https://global.discourse-cdn.com/wolfram/original/2X/8/8529e39c10ba2c2d3cf22601c8aacb354c8eaba7.png)

so `x /. sol` replaces x with the function. Such a function takes a parameter value, in this case this is empty so `x[]` generates a interpalotion function that takes the parameter `t`

```
{x[][t], y[][t], z[][t]} /. sol2

```

generates

 ![1850Capture.PNG](https://global.discourse-cdn.com/wolfram/original/2X/c/c80547fc37a00db040f850a61805b901e080d513.png)

Since Plot functions have the HoldAll attribute you have to put this into the `Evaluate[]` for it to actually plot.

you also had some typos in your equation `Sin[t]` and `Cos[t]`.

```
sol2 = ParametricNDSolve[{x'[
     t] == (-Sin[t]*(1 + a^2 + t^2) - 2*t*Cos[t])/(1 + a^2 + t^2)^2, 
   y'[t] == (Cos[t]*(1 + a^2 + t^2) - 2*t*Sin[t])/(1 + a^2 + t^2)^2, 
   z'[t] == a*(1 + a^2 - t^2)/(1 + a^2 + t^2)^2, x[0] == 1, y[0] == 0,
    z[0] == 0}, {x, y, z}, {t, 0, 100}, {a}]
ParametricPlot3D[
 Evaluate[{x[.1][t], y[.1][t], z[.1][t]} /. sol2], {t, 1, 100}, 
 PlotRange -> All, BoxRatios -> {1, 1, 1}]

```

 ![10250Capture.PNG](https://global.discourse-cdn.com/wolfram/original/2X/5/5be93afaded3c98ecf366458eb992d5b3a7e4adf.png)
