Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8604
| From | Andrés <jarosham@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Changing the argument |
| Date | 2012-02-18 11:33 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jho2b7$5uq$1@smc.vnet.net> (permalink) |
| References | <jhldc2$oq5$1@smc.vnet.net> |
Hi Niles.
z must be a function of t from the beginning so that t can also be
one. I would rewrite:
primaryFunc[i_,t_] := {
secondaryFunc[t_] := 1/z[t];
func = 0;
For[j = 1, j < i + 1, j++,
func = func + secondaryFunc[t];
];
func};
test[t_] := primaryFunc[20,t]
NDSolve[{z''[t] == test[t], z[0] == 0, z'[0] == 20}, z, {t, 0, 5}];
Hope it helps,
Andr=E9s
On Feb 17, 6:23 am, Niles <niels.martin...@gmail.com> wrote:
> 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.
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Changing the argument Niles <niels.martinsen@gmail.com> - 2012-02-17 11:23 +0000 Re: Changing the argument Andrés <jarosham@gmail.com> - 2012-02-18 11:33 +0000
csiph-web