Replacing Mass in Equations of Motion: Quick Mathematica Question

  • Mathematica
  • Thread starter kq6up
  • Start date
  • Tags
    Mathematica
In summary, the conversation discusses the process of replacing one or both of the masses with a negative mass in Mathematica. The speaker suggests using the replacement rule {m1 -> -m1} to achieve this, as it is a simple and effective technique.
  • #1
kq6up
368
13
I have equation of motion that our instructor wants to replace one or both of the masses with a negative mass in Mathematica. I tried m1=-m1, but I get an infinite recursion. What is the best way to do this? The equations of motion is a monster, so I don't really want to do this by hand.

Thanks,
Chris
 
Physics news on Phys.org
  • #2
Just a thought: Replace m1 by mm1 or some such, then replace mm1 by - m1. This may allow you to fool the computer.
 
  • #3
Yes, I ended up doing something just like that ##m_1=-m_{11}##.

Thanks,
Chris
 
  • #4
kq6up said:
I have equation of motion that our instructor wants to replace one or both of the masses with a negative mass in Mathematica. I tried m1=-m1, but I get an infinite recursion. What is the best way to do this? The equations of motion is a monster, so I don't really want to do this by hand.
The easiest way is:
eq /.{m1 -> -m1}

This goes through the expression eq and replaces every occurrence of m1 with -m1. It is very worthwhile learning this technique of using replacement rules.
 
  • #5
Awesome, thank you.

Chris
 

Related to Replacing Mass in Equations of Motion: Quick Mathematica Question

1. What is Mathematica?

Mathematica is a powerful computational software program used for mathematical, scientific, and engineering calculations, data analysis, and visualization.

2. How do I use Mathematica?

To use Mathematica, you can either type commands directly into the notebook interface or use the interactive tools and menus to perform calculations and manipulate data.

3. What is the difference between Mathematica and Wolfram Alpha?

Mathematica is a software program that allows you to perform complex calculations and data analysis, while Wolfram Alpha is an online computational knowledge engine that can provide answers to specific queries and perform basic calculations.

4. Can Mathematica be used for data visualization?

Yes, Mathematica has powerful built-in visualization tools that allow you to create 2D and 3D plots, graphs, and animations to help analyze and communicate your data.

5. Are there any resources available to help me learn Mathematica?

Yes, there are many resources available, including online tutorials, user forums, and official documentation from Wolfram Research. You can also take advantage of Wolfram's online training courses or attend workshops and conferences to improve your skills.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
Back
Top