WOLFRAM

ParametricNDSolveValue[eqns,expr,{x,xmin,xmax},pars]

gives the value of expr with functions determined by a numerical solution to the ordinary differential equations eqns with the independent variable x in the range xmin to xmax with parameters pars.

ParametricNDSolveValue[eqns,expr,{x,xmin,xmax},{y,ymin,ymax},pars]

solves the partial differential equations eqns over a rectangular region.

ParametricNDSolveValue[eqns,expr,{x,y}Ω,pars]

solves the partial differential equations eqns over the region Ω.

ParametricNDSolveValue[eqns,expr,{t,tmin,tmax},{x,y}Ω,pars]

solves the time-dependent partial differential equations eqns over the region Ω.

Details and Options

  • ParametricNDSolveValue gives results in terms of ParametricFunction objects.
  • A specification for the parameters pars of {pspec1,pspec2,} can be used to specify ranges.
  • Possible forms for pspeci are:
  • pp has range Reals or Complexes
    Element[p,Reals]p has range Reals
    Element[p,Complexes]p has range Complexes
    Element[p,{v1,}]p has discrete range {v1,}
    {p,pmin,pmax}p has range
  • Typically expr will depend on the parameters indirectly, through the solution of the differential equations, but may depend explicitly on the parameters.
  • Derivatives of the resulting ParametricFunction object with respect to the parameters are computed using a combination of symbolic and numerical sensitivity methods when possible.
  • ParametricNDSolveValue takes the same options and settings as NDSolve.
  • NDSolve and ParametricNDSolveValue typically solve differential equations by going through several different stages, depending on the type of equations. With Method->{s1->m1,s2->m2,}, stage si is handled by method mi. The actual stages used and their order are determined by NDSolve, based on the problem to be solved.
  • Possible solution stages are the same as for NDSolve, with the addition of:
  • "ParametricCaching"caching of computed solutions
    "ParametricSensitivity"computation of derivatives with respect to parameters
  • List of all options

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Get a parametric function of the parameter a for the value of y:

Out[1]=1

Evaluating with a numerical value of a gives an approximate function solution for y:

Out[2]=2

Get the value at :

Out[3]=3

Plot the solutions for several different values of the parameter:

Out[4]=4

Get a function of the parameter a that gives the value of the function f at :

Out[1]=1

This plots the value as a function of the parameter a:

Out[2]=2

Use the function with FindRoot to find a root:

Out[3]=3

Show the sensitivity of the solution of a differential equation to parameters:

The sensitivity with respect to a increases with t:

Out[2]=2

The sensitivity with respect to b does not increase with t:

Out[3]=3

Scope  (6)Survey of the scope of standard use cases

Parameter Dependence  (4)

ParametricNDSolveValue returns a ParametricFunction object:

Out[1]=1

Get the solution for :

Out[2]=2

Plot the solution for :

Out[3]=3

Plot solutions for values of ranging from to :

Out[4]=4

Initial conditions can be specified as parameters:

Out[1]=1

Plot solutions with with for values of ranging from to :

Out[2]=2

Plot solutions with with for values of ranging from to :

Out[3]=3

Return a function of the solution :

:

Out[3]=3

:

Out[5]=5

:

Out[7]=7

:

Out[9]=9

:

Out[11]=11

Differential equation coefficients and boundary conditions can be specified as parameters:

Out[1]=1

Plot solutions with for values of ranging from to and with and :

Out[2]=2

Parameter Sensitivity  (2)

Solve the classical harmonic oscillator with parametric amplitude a:

Plot the solution for and several nearby values of :

Out[2]=2

The sensitivity of with respect to is by definition . Plot the sensitivity at :

Out[3]=3

Plot the sensitivity as a band around the solution for :

Out[4]=4

Sensitivity analysis of a differential equation with multiple parameters:

Out[2]=2

Plot the sensitivity with respect to the initial condition at , :

Out[4]=4

Plot the sensitivity with respect to the initial condition at , :

Out[6]=6

Generalizations & Extensions  (2)Generalized and extended use cases

Solve , for various values of WorkingPrecision and plot the error:

Out[2]=2

Consider finding a solution to a highly nonlinear problem that NDSolveValue cannot solve directly. Set up a boundary condition, a region and the equation that depends on a parameter :

NDSolveValue cannot find a solution:

Out[2]=2

Set up an initial seeding function:

Create a ParametricNDSolveValue function based on the parameter :

Out[4]=4

Solve the equation for :

Out[5]=5

Reset the seeding to use the solution from :

With the reset seeding, find the solution for :

Out[7]=7

Visualize the solution:

Out[8]=8

Options  (2)Common values & functionality for each option

Method  (2)

ParametricCaching  (1)

Prevent caching of solutions to save memory:

With no caching, the only extra memory required is for the processed equations:

The default is to cache the most recently computed solution:

With caching, the memory requirement is much greater:

ParametricSensitivity  (1)

Specify that no sensitivity should be computed:

The function evaluates quickly:

Out[2]=2

The derivative is not computed:

Out[4]=4

Applications  (14)Sample problems that can be solved with this function

Parameter Sweeps  (7)

Simulate bouncing balls being dropped from various heights:

Out[2]=2

Find an initial value for which the solution of a differential equation will have :

Find a solution with :

Out[2]=2

Check the resulting solution:

Out[4]=4

Compare to nearby values of the parameter s:

Out[6]=6

Find several solutions to the boundary value problem , , . First consider several possible values for :

Out[2]=2

Run a parameter sweep to determine nontrivial solution values of :

Out[4]=4

Using approximate initial values from the graph above:

Out[5]=5

Plot the solutions that were found:

Out[6]=6

Find all eigenvalues and eigenfunctions for the classical harmonic oscillator with . Start by exploring the possible parameter values:

Out[2]=2

Find the exact values for :

Out[4]=4
Out[5]=5

Plot them:

Out[6]=6

Find the first three eigenfunctions of the quantum harmonic oscillator , , lim_(TemplateBox[{x}, Abs]->infty) y(x)=0. Start by plotting solutions of for :

Out[2]=2

Plot for :

Out[3]=3

The roots are the approximate eigenvalues. Find the first three:

Out[4]=4

Plot the approximate eigenfunctions together with solutions for nearby :

Out[5]=5

These only differ from the exact eigenfunctions, the Hermite functions, by scaling factors:

Out[7]=7

Find the value of for which the solution of , has minimal arc length from to . Begin by plotting the solutions for values of ranging from 0 to 1:

Out[2]=2

Plot versus the arc length of the solution:

Out[3]=3

The minimum arc length solution for seems to occur at :

Out[4]=4

Find the local minimum, which appears near :

Out[5]=5

Plot the corresponding solution of (locally) minimal arc length together with some nearby solutions:

Out[6]=6

Simulate the response of an RLC circuit to a step in the voltage v1 at time :

Show the step response when varying component values:

Out[4]=4

Dependence on resistance r:

Out[5]=5

The inductance l:

Out[6]=6

The capacitance c:

Out[7]=7

Parameter Sensitivities  (5)

Perturb a parameter in a differential equation and view several of the resulting perturbed solutions:

Out[2]=2

A plot of the solution with its sensitivity band is qualitatively similar:

Out[3]=3

Simulate an inverted pendulum stabilized by a base oscillating with frequency ω and amplitude a:

With , the pendulum is stabilized near an inverted position , but the sensitivity increases:

Out[3]=3

Find the sensitivity of the Lorenz equations to a parameter:

Out[2]=2

Parametric dependence of the heat equation , :

Find the sensitivities and :

Plot the corresponding sensitivity bands:

Out[3]=3

Indicate sensitivity to a and c by changing the color of the solution surface:

Out[5]=5

Parametric dependence of the wave equation , :

Find the sensitivities and :

Plot the corresponding sensitivity bands:

Out[3]=3

Indicate sensitivity to a and c by changing the color of the solution surface:

Out[5]=5

Parameter Fitting  (2)

Sample the solution of a differential equation and add noise:

Out[2]=2

Fit a trigonometric model to the noisy data:

Out[4]=4
Out[5]=5

A quadratic model is a better fit:

Out[7]=7
Out[8]=8

Find the parameters that make the solution of a differential equation the best fit to data:

Convert data to kelvins and find initial and final (ambient) temperatures:

Find solutions to Newton's law of cooling depending on parameters k1 and k2:

Fit the parameters in the differential equation to the given data:

Out[6]=6
Out[7]=7

Properties & Relations  (3)Properties of the function, and connections to other functions

Use NDSolveValue to solve differential equations with parameters:

For a given parameter value, each function call takes roughly the same amount of time:

Out[2]=2

ParametricNDSolve caches the solution and subsequently reuses the cached solution values:

Out[4]=4

DSolve can solve some differential equations with parameters in closed form:

Out[1]=1

Use ParametricNDSolveValue to solve the example numerically:

The sensitivity is the same from both paths:

Out[3]=3

Use SystemModelParametricSimulate to simulate larger hierarchical system models:

Out[1]=1

Simulate with two sets of resistor and spring damper parameters:

Compare the resulting angular velocities:

Out[3]=3

Possible Issues  (1)Common pitfalls and unexpected behavior

Solution sampling with WhenEvent, Reap, and Sow only works on the first call for each parameter value:

Out[1]=1
Out[2]=2
Out[3]=3

Values are not sown if the solution has already been cached:

Out[4]=4
Out[5]=5
Wolfram Research (2012), ParametricNDSolveValue, Wolfram Language function, https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html (updated 2014).
Wolfram Research (2012), ParametricNDSolveValue, Wolfram Language function, https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html (updated 2014).

Text

Wolfram Research (2012), ParametricNDSolveValue, Wolfram Language function, https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html (updated 2014).

Wolfram Research (2012), ParametricNDSolveValue, Wolfram Language function, https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html (updated 2014).

CMS

Wolfram Language. 2012. "ParametricNDSolveValue." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html.

Wolfram Language. 2012. "ParametricNDSolveValue." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html.

APA

Wolfram Language. (2012). ParametricNDSolveValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html

Wolfram Language. (2012). ParametricNDSolveValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html

BibTeX

@misc{reference.wolfram_2025_parametricndsolvevalue, author="Wolfram Research", title="{ParametricNDSolveValue}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html}", note=[Accessed: 20-May-2025 ]}

@misc{reference.wolfram_2025_parametricndsolvevalue, author="Wolfram Research", title="{ParametricNDSolveValue}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html}", note=[Accessed: 20-May-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_parametricndsolvevalue, organization={Wolfram Research}, title={ParametricNDSolveValue}, year={2014}, url={https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html}, note=[Accessed: 20-May-2025 ]}

@online{reference.wolfram_2025_parametricndsolvevalue, organization={Wolfram Research}, title={ParametricNDSolveValue}, year={2014}, url={https://reference.wolfram.com/language/ref/ParametricNDSolveValue.html}, note=[Accessed: 20-May-2025 ]}