MathGroup Archive 2000

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

Search the Archive

Compiled functions in NDSolve.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25642] Compiled functions in NDSolve.
  • From: "Daniel Lisak" <xdl1 at poczta.onet.pl>
  • Date: Wed, 18 Oct 2000 02:52:19 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

    Does anybody know how can I use compiled functions in NDSolve ?
    I have some compiled functions (they all depend on 3 real
    variables: t, ro, v):

potencjalX = Compile[{t, ro, v}, -176.276/(ro^2 + v^2 t^2)^3];
potencjalA = Compile[{t, ro, v}, -248.279/(ro^2 + v^2 t^2)^3];
potencjalB = Compile[{t, ro, v}, -319.691/(ro^2 + v^2 t^2)^3];
funfi = Compile[{t, ro, v}, ArcSin[ro/Sqrt[ro^2 + v^2t^2]]];
funF = Compile[{t, ro, v}, (potencjalB[t, ro, v] - potencjalA[t, ro, v])/2];
funv1 = Compile[{t, ro, v}, (potencjalA[t, ro, v] + potencjalB[t, ro,
v])/2];

    and I want to solve ordinary differential equations:

rozw[apocz_, ro_, v_, tend_, nieskoncz_] := NDSolve[{
      a1'[t] == a1[t] potencjalX[t, ro, v]/I,
      a2'[t] == a2[t] potencjalB[t, ro, v]/I,
      a3'[t] == a3[t] funv1[t, ro, v]/I +
          a4[t] funF[t, ro, v] Exp[2I funfi[t, ro, v]]/I,
      a4'[t] == a3[t] funF[t, ro, v] Exp[-2I funfi[t, ro, v]]/I +
          a4[t] funv1[t, ro, v]/I,
      a1[-nieskoncz] == apocz[[1]],
      a2[-nieskoncz] == apocz[[2]],
      a3[-nieskoncz] == apocz[[3]],
      a4[-nieskoncz] == apocz[[4]]},
    {a1, a2, a3, a4}, {t, -tend, tend}, MaxSteps -> 100000]

    when I evaluate this function:

rozw[{0, 0, 1, 0}, 3, 0.0003, 75000., 75000.]

    I see the following error:

CompiledFunction::cfsa: Argument t at position 1 should be a machine-size
real number.

    Does anybody know how can I use these compiled functions in NDSolve ?

Daniel


 



  • Prev by Date: Re: Simple equation checking..
  • Next by Date: A question of matrix multiply, who can solve it?
  • Previous by thread: Re: how to "dynamically" define such a function
  • Next by thread: Re: Compiled functions in NDSolve.