# Mathematica programming

• Mathematica

## Main Question or Discussion Point

Hi
I have a function that relies on n and t. I am presently drawing it with "ParametricPlot3D." I am drawing it for all t in [0,1]. Now I can either draw this for all values of n in a defined interval, say [a,b], just as I define it to draw all t. Or I can draw one value of n by using the "Manipulate[ ParametricPlot3D[" and changing the value of n in [a,b].

My problem is I want to draw the function for a large number of values of n in [a,b] in the same diagram. t always runs through [0,1].

I can't find a command for this, is there one? I'm sure that this can be done some how... Any thoughts?

Thanks

## Answers and Replies

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org
CompuChip
Science Advisor
Homework Helper
What kind of a function is it? If it is a function
$$f: \mathbb{R}^2 \to \mathbb{R}, (n, t) \mapsto f(n, t)$$
then something like
Plot3D[f[n, t], {t, 0, 1}, {n, a, b}]
will do the trick, won't it?

Yeah that is the general function I am trying to plot.

But Plot3D[f[n, t], {t, 0, 1}, {n, a, b}] plots all the values of n from a through to b. I want only draw the function at, for example, a, a+1, a+2, a+3, ... b. but nothing in the interval (a+i,a+i+1).

So a command that says draw m points of the function for intervals of size (b-a)/m points in [a,b].

So if the function was f(n,t) = t.sin(n), t is [0,1] and n in [0,Pi] I want mathematica to plot, 0 , Pi/4, Pi/2, 3.Pi/4.

something like Plot3D[f[n, t], {t, 0, 1}, {n, ???????? }]

CompuChip
Science Advisor
Homework Helper
How about you plot them separatel:

Code:
Plot[Table[f[n, t], {n, a, b, (b - a)/m}], {t, 0, 1}]
Show[Table[Plot[f[n, t], {t, 0, 1}], {n, a, b, (b - a)/m}]]]
(I think the first one should work, the second one definitely does) or, in older versions of Mathematica,
Code:
Plot[Table[f[n, t], {n, a, b, (b - a)/m}] // Evaluate, {t, 0, 1}]
Show[Table[Plot[f[n, t], {t, 0, 1}], {n, a, b, (b - a)/m}], DisplayFunction -> None], DisplayFunction -> \$DisplayFunction]

Dale
Mentor
As long as your function is listable you should be able to simply do:

Plot[Evaluate[f[Table[n,{n,-5,5}],t]],{t,0,1}]