Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: NIntegrate and Plot solution of differ. equa. over initial conditions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124437] Re: NIntegrate and Plot solution of differ. equa. over initial conditions
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 19 Jan 2012 05:15:51 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

You didn't define "sol". You defined "sol[p,v]" when p and v are numeric.

Hence, NIntegrate[p*v*(v-y'[2])/.sol,{p,0.1,1}] doesn't work because "sol"  
is undefined.

You didn't give v a numeric value in that expression, either, so there's  
no chance of sol[p, v] being defined.

Give your problem a lot more thought, until it actually makes sense.

Bobby

On Wed, 18 Jan 2012 04:59:51 -0600, Itzhak Shechtman  
<shechtma at netvision.net.il> wrote:

> Hi all,
>
> I would be grateful for any help.
>
> I have the set of 2 ordinary differential equations:
>
>
> Clear[sol, q, k];
> B = 5.5*10^7;
> q[x_, y_] = 1 + 2 x + x^2 + y^2;
> k[x_, y_] = 2 (x/(1 + 2 x + x^2 + y^2))^0.5;
> sol[p_?NumericQ,v_
> ?NumericQ]:=NDSolve[{
>    x''[t]==
>       B*(2 (1 - k[x[t], y[t]]^2)*
>       EllipticK[k[x[t], y[t]]] - (2 - k[x[t], y[t]]^2*
>       (1+x[t]))* EllipticE[k[x[t], y[t]]])/(q[x[t],
>       y[t]]^1.5 k[x[t], y[t]]^2*(1 - k[x[t], y[t]]^2)),
>    y''[t] ==
>      B*2 y[t]*
>       EllipticE[k[x[t], y[t]]]/(q[x[t], y[t]]^1.5*(1 - k[x[t], y[t]]^2)),
>    x[0] == p, x'[0] == 0,
>    y'[0]== v, y[0]==-100000},
> {x, y}, {t, 0,2}];
>
> I wish to:
>
> 1) sol1=NIntegrate[p*v*(v-y'[2])/.sol,{p,0.1,1}]; and
>
> 2) Plot[sol1,{v,10^3,10^5}]
> Mathematica does not accept it, objecting to solving the equations with  
> non numeric initial conditions( p and v ), despite the above definition  
> of sol.
>
> Does anyone have an idea?
> Thanks for the trouble.
>
> Itzhak
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: Is there any efficient easy way to compare two lists with the same length with Mathematica?
  • Next by Date: Re: solving poisson equation with Mathematica
  • Previous by thread: NIntegrate and Plot solution of differ. equa. over initial conditions
  • Next by thread: Problem Integrating a sequence of polynomials