MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Solving differential equations with parameters

  • To: mathgroup at
  • Subject: [mg79847] Re: Solving differential equations with parameters
  • From: chuck009 <dmilioto at>
  • Date: Tue, 7 Aug 2007 01:22:28 -0400 (EDT)

I've found the best way to handle a bunch of solutions from NDSolve is to identify the solutions with subscripts.  The example below is your equation being solved for 10 values of p with y[0]=0.  Note the Table command, I switch all the Interpolated polynomials to v_i[x] to identify each.  Note I can't use y_i since y is already being used in NDSolve.  Note I also have to use Evaluate to "evaluate" the interpolated polynomial.  I can then plot v_i, use v_i[x] to find a value and take derivatives and plot them also as long as I remember to use Evaluate:

sol = (NDSolve[{Derivative[1][y][x] == -Sin[#1*x + y[x]], 
      y[0] == 0}, y, {x, 0, 1}] & ) /@ 
   {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Table[Subscript[v, i][x_] := 
   Evaluate[y[x] /. Take[Flatten[sol], {i, i}]], {i, 1, 10}]
Plot[Subscript[v, 5][x], {x, 0, 1}]
Subscript[v, 5][0.5]
Plot[Evaluate[D[Subscript[v, 5][x], x]], {x, 0, 1}]

> Hi, I am trying to solve the differential equations
> like
> y'[x]= - Sin[ p*x + y[x] ]
> where p is a parameter. Now I want to solve the
> equation with respect
> to x for a range of values of p, instead for just a
> single p.
> What is the best way to do it?

  • Prev by Date: Re: ndsolve ndsv problem
  • Next by Date: How show Locator point and its image under a function?
  • Previous by thread: Re: Solving differential equations with parameters
  • Next by thread: Changing "point" styles in 3D plots