Mathematica Really Introductory Mathematica Question

AI Thread Summary
The discussion centers on a user's difficulty in assigning variables and plotting in Mathematica. The user initially attempts to define a function with r[_t] but ends up with an empty 3D plot. A response suggests using r[t_] with a delayed assignment (:=) to properly define the function, which resolves the issue. The user expresses gratitude for the solution and seeks clarification on the terms "RHS" and "LHS," which refer to the right and left sides of an equation. The conversation highlights the importance of understanding variable assignment and function definitions in Mathematica for effective plotting.
dpeagler
Messages
32
Reaction score
0
Hello everyone, I apologize for posting such an introductory mathematica question, but I can't find an answer anywhere.

I seem to be having trouble assigning variables and then plotting with the variable name. Perhaps I'm thinking too much in terms of ordinary computer programming or something. Here is a list of my code.

In: r[_t] = {E^(-t/10) Cos[t], E^(-t/10) Sin[t], E^(-t/10)}
Out: {E^(-t/10) Cos[t], E^(-t/10) Sin[t], E^(-t/10)}
In: ParametricPlot3D[{r[_t]}, {t, 0, 40}]

I'm not going to post the out for the last part, because all it did was graph an empty 3D form. I can get it to graph properly if I just type the functions into the ParametricPlot command, but there has to be a better way. I even tried breaking it up into x, y, and z separate variables. Any help is greatly appreciated.
 
Physics news on Phys.org
Hi there,

Try:
Code:
r[t_]:={E^(-t/10) Cos[t],E^(-t/10) Sin[t],E^(-t/10)}
Code:
ParametricPlot3D[r[t], {t,0,40}]

The expression t_ means a pattern named t that matches anything. So when you later use r[t] it will fetch the RHS of the definition. I used := instead of = since that is a DelayedSet as opposed to Set - thus it doesn't evaluate the RHS until it is called - which is more often what you want.
 
Thanks that worked a lot better.

Just curious about some of the terms you used. Particularly RHS?

Thanks again.
 
Sorry about that, I thought that RHS and LHS were pretty standard abbreviations in maths for Right and Left Hand Side respectively
 

Similar threads

Replies
4
Views
3K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
3
Views
2K
Replies
9
Views
3K
Replies
5
Views
2K
Replies
4
Views
5K
Replies
2
Views
1K
Back
Top