Really Introductory Mathematica Question

In summary, the person is having trouble assigning variables and plotting with variable names in Mathematica. They have tried using ParametricPlot3D but it only outputs an empty 3D form. Another user suggests using the expression t_ to match any pattern and using the DelayedSet operator, :=, instead of =. The first person thanks the second person and asks about some of the terms used, such as RHS and LHS.
  • #1
dpeagler
34
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
  • #2
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.
 
  • #3
Thanks that worked a lot better.

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

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


Hello, thank you for reaching out and asking for help with your introductory Mathematica question. It's completely understandable to have trouble with assigning variables and plotting in Mathematica, especially if you are coming from a background in ordinary computer programming.

To address your specific issue, it looks like you are trying to plot a parametric curve in 3D using the variable t. In this case, you need to use the ParametricPlot3D function with the syntax ParametricPlot3D[{x[t], y[t], z[t]}, {t, t_min, t_max}].

In your example, you have defined r[t] as a list of functions, which is why you are getting an empty 3D form when trying to plot it. Instead, you should define r[t] as a parametric curve by using the syntax r[t_] := {E^(-t/10) Cos[t], E^(-t/10) Sin[t], E^(-t/10)}. This will allow you to plot the curve using ParametricPlot3D as follows:

ParametricPlot3D[r[t], {t, 0, 40}]

I hope this helps and feel free to ask for further clarification if needed. Happy coding!
 

Related to Really Introductory Mathematica Question

What is Mathematica?

Mathematica is a software program developed by Wolfram Research for mathematical and scientific computing. It provides a comprehensive set of tools for data analysis, visualization, and mathematical calculations. It is widely used in fields such as physics, engineering, and economics.

How do I download and install Mathematica?

You can download Mathematica from the Wolfram Research website and follow the installation instructions. It is available for different operating systems, including Windows, Mac, and Linux.

What are the basic features of Mathematica?

Mathematica offers a wide range of features, including symbolic and numerical computation, data analysis and visualization, programming, and interactive manipulation of objects. It also has built-in libraries for various mathematical and scientific functions, as well as the ability to create interactive documents and presentations.

Can I use Mathematica for educational purposes?

Yes, Mathematica is commonly used in educational institutions for teaching and learning purposes. It can be used to demonstrate mathematical concepts, visualize data, and solve complex problems.

Is Mathematica user-friendly for beginners?

While Mathematica has a steep learning curve, it does offer a user-friendly interface and extensive documentation to help beginners get started. There are also many online resources and tutorials available to help with learning the basics of Mathematica.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
292
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • Advanced Physics Homework Help
Replies
6
Views
652
  • Programming and Computer Science
Replies
1
Views
1K
Back
Top