Re: use a function within a new function

• To: mathgroup at smc.vnet.net
• Subject: [mg70951] Re: use a function within a new function
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Thu, 2 Nov 2006 06:48:38 -0500 (EST)
• Organization: The Open University, Milton Keynes, UK
• References: <ei9nuo\$1ps\$1@smc.vnet.net>

```aitor69gonzalez at gmail.com wrote:
> Hello,
>
> I have a function like:
> phi(a,t) = sin(2*pi*(t-a)/T' + a/T)
> where "T" is itself a function of "a" like here:
> ####
> Plot3D[Sin[2*\[Pi]*((t - a)/3 + a/(a + 1))], {t, 0, 9}, {a, 0, 9},
-----------------------------------------------^^^^^^^^^^^^^^^^^^^^
Note that here were are going from o to 9,

>     AxesLabel -> {"t", "a", "ex"}, Lighting -> False,
>     ViewPoint -> {0, 0, 100}, PlotPoints -> 40, Mesh -> False];
> ####
> Therefore, I would like to define T separately. Something like here:
> ####
> T[a_] = a + 1;
> phi[a_, t_] = Sin[2*\[Pi]*((t - a)/3 + a/T[a])];
> Plot3D[phi[a, t], {t, 0, 720}, {a, 0, 720}, AxesLabel -> {"t", "a",
--------------------^^^^^^^^^^^^^^^^^^^^^^^^
whereas here we are going from 0 to 2*Pi.

> "ex"},
>   Lighting -> False, ViewPoint -> {0, 0, 100}, PlotPoints -> 40,
>   Mesh -> False]
> ####
> But as you can see, both plots do not look like the same. How can I
> define a "T" as a function of a separately?
>
> Aitor
>
The issue is that you uses different ranges for t and a in both
expressions. The following expression will give you a graph identical to
the first one:

T[a_] = a + 1;
phi[a_, t_] = Sin[2*Pi*((t - a)/3 + a/T[a])];
Plot3D[phi[a, t], {t, 0, 9}, {a, 0, 9},
AxesLabel -> {"t", "a", "ex"}, Lighting -> False,
ViewPoint -> {0, 0, 100}, PlotPoints -> 40,
Mesh -> False];

Regards,
Jean-Marc

```

• Prev by Date: Re: message question
• Next by Date: Re: Publicon
• Previous by thread: Re: use a function within a new function