Mathematica programming

  • Mathematica
  • Thread starter andlook
  • Start date
  • #1
33
0

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

  • #2
CompuChip
Science Advisor
Homework Helper
4,302
47
What kind of a function is it? If it is a function
[tex]f: \mathbb{R}^2 \to \mathbb{R}, (n, t) \mapsto f(n, t)[/tex]
then something like
Plot3D[f[n, t], {t, 0, 1}, {n, a, b}]
will do the trick, won't it?
 
  • #3
33
0
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, ???????? }]
 
  • #4
CompuChip
Science Advisor
Homework Helper
4,302
47
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]
 
  • #5
29,727
6,065
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}]
 

Related Threads on Mathematica programming

Replies
8
Views
3K
Replies
1
Views
3K
Replies
22
Views
637
Replies
17
Views
3K
Replies
4
Views
3K
Replies
10
Views
11K
Replies
4
Views
2K
Replies
9
Views
2K
Top