# Understanding Sensitivity Analysis by ParametricNDSolve\[\]

**URL:** <https://community.wolfram.com/t/understanding-sensitivity-analysis-by-parametricndsolve/5832>\
**Category:** Questions\
**Tags:** mathematica, calculus, modeling\
**Created:** [May 28, 2015, 3:45pm UTC](https://community.wolfram.com/t/understanding-sensitivity-analysis-by-parametricndsolve/5832 "2015-05-28T15:45:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![spede11](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/spede11/32/9441_2.png) [@spede11](https://community.wolfram.com/u/spede11)\
**Post date:** [May 28, 2015, 3:45pm UTC](https://community.wolfram.com/t/understanding-sensitivity-analysis-by-parametricndsolve/5832/1 "2015-05-28T15:45:04Z")

</div>

Dear Community,

I have been going over the documentation for the use of **ParametricNDSolve[]**, and was wondering about the meaning of one of the basic examples provided in the documentation.

In the example, we are trying to show the sensitivity of a solution provided by ParametricNDSolve[], of a differential equation with two-parameter inputs. The equation is:

```
sol = ParametricNDSolve[{y''[t] + a y[t] == 0, y[0] == b, y'[0] == 0},
   y, {t, 0, 20}, {a, b}];

```

If looking at the sensitivity of variable _a_ with respect to time _t_, the code is:

```
Plot[Evaluate[(y[1, 1][t] + {0, .1, -.1} D[y[a, 1], a][t] /. 
     a -> 1) /. sol], {t, 0, 20}, Filling -> {2 -> {3}}]

```

Yielding the following plot:

 ![plot1.jpg](https://global.discourse-cdn.com/wolfram/original/2X/c/cd7b4ba6169fb1179a36d81896e9673b7b17b93c.jpeg)

The same is done for the analysis of _b_ (which I left out, as I suspect the above plot will be enough for a helpful soul to dumb it down to my level of understanding 🙂 ).

My question is, what exactly is shown? Lets for instance say that _y(t)_ is the population of ticks within a defined area. The population is dependent on the temperature (say, variable _a_), and the humidity (variable _b_). Then:

```
y[1,1][t]

```

would correspond to evaluating a base case scenario where _a_=_b_=1. To this expression we then add:

```
{0, .1, -.1} D[y[a, 1], a][t] /. a -> 1

```

When multiplying the differential by 0, we get the base case, but is correctly understood that {.1,-.1} multiplied with the differential, gives the base case value, with the effect of a 10% change in _a_ at time _t_, by finding the rate of change of _y(t)_, with respect to _a_, and then evaluating the rate (or slope) at _a_=1.

But even so, does this tell me that the effect of a 10% change of _a_ would be more significant at later times, rather than at the very beginning? or am I way off?

Sorry for the long post!

Best Regards

---

<div class="post-metadata">

**Author:** ![danl](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/danl/32/41267_2.png) [@danl](https://community.wolfram.com/u/danl)\
**Post date:** [May 29, 2015, 4:06pm UTC](https://community.wolfram.com/t/understanding-sensitivity-analysis-by-parametricndsolve/5832/2 "2015-05-29T16:06:16Z")

</div>

It is telling you what you suspected, to wit, that lthe effect in a sense widens over time (very literally I suppose, since it is changing the frequency). You can see the same, in this simple example, from the analytic solution.

```
DSolve[{y''[t] + a y[t] == 0, y[0] == b, y'[0] == 0}, y[t], t]

(* Out[272]= {{y[t] -> b Cos[Sqrt[a] t]}} *)

```

One thing though is that using the first order change in your plot means it also strays over time. The variant below might be a better way to go.

```
Plot[Evaluate[{y[1.1, 1][t], y[1.0, 1][t], y[0.9, 1][t]} /. sol], {t, 
  0, 20}, Filling -> {2 -> {3}}]

```

 ![pndsolve.png](https://global.discourse-cdn.com/wolfram/original/2X/5/5ad3feb8297c41dcfd541a81f14e98c218c8996a.png)

Among other things, the peak magnitudes do not (incorrectly) change with variation in the `a` parameter.
