MathGroup Archive 2012

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

Search the Archive

Changing the argument

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124996] Changing the argument
  • From: Niles <niels.martinsen at gmail.com>
  • Date: Fri, 17 Feb 2012 06:22:51 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

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