MathGroup Archive 2012

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

Search the Archive

Changing the argument


Hi!

I have the following piece of code (I am using this as an example):

primaryFunc[i_] := {
   secondaryFunc[z_] := 1/z;
   func = 0;
   For[j = 1, j < i + 1, j++,
    func = func + secondaryFunc[z];
    ];
   func};

test = primaryFunc[20];


Say that I need to use the function "test" in NDSolve, e.g.:
NDSolve[{z''[t] == test, z[0] == 0, z'[0] == 20}, z, {t, 0, 5}];

The problem is that the variable "z" in "test" needs to become "z[t]".
How can this be done most efficiently? Thanks for the help in advance.

Best,
Niles.



  • Prev by Date: Documentation for GridBoxSpacings
  • Next by Date: Re: Using .NET/Link on 64-bit Windows Server 2008
  • Previous by thread: Re: Documentation for GridBoxSpacings
  • Next by thread: Re: Changing the argument