Really Introductory Mathematica Question

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
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