8
$\begingroup$

I'm quite new to Mathematica, I have version 9. I need to use it to simulate some physical problems. I know the equations (like Maxwell's equations and Newton's laws and so on), but I have no real idea on how to get some nice visual simulating output.

Maybe let's start with some example:

If I have two stars rotating around each other, what is the best way in Mathematica to simulate and display the gravitational vector field of this problem (dynmically depending on the location of the stars)?

Or if I have some charges (not just points, but spheres, for example, ideally with some properties like polarity and permitivity) in an external electric field, how can I calculate and visualise the resulting field and the infleunce of movements and positions of the charges?

Where do I have to start here? Just by hacking the genereral equations that I have on paper into Mathematica I won't get some dynamic output.

I know the basics about Manipulate and on how to enter equations and on how to do some basic calculations (like DSolve). But I have no idea on how to get these things dynamical and visual so that I can just "move around" my stars and charges and see the resulting fields visually and in numbers.

$\endgroup$
7
  • $\begingroup$ Have a look here for some nice posts. $\endgroup$ Commented Jan 23, 2013 at 13:59
  • 1
    $\begingroup$ I suggest starting by just coding a static visual on whatever you want to do, and then start from there. For instance, you could use VectorPlot to make a static plot of the gravitational field of the two starts you mention. Then upload your code along with a specific question of how to do one thing with it (for instance how to make the stars rotate or similar). $\endgroup$
    – jVincent
    Commented Jan 23, 2013 at 14:13
  • 3
    $\begingroup$ I implemented a few ideas along these lines in my post at mathematica.stackexchange.com/questions/1900 (the confetti simulation). Although that doesn't fully answer this question, it might give you some ideas about directions to go in. $\endgroup$
    – whuber
    Commented Jan 23, 2013 at 15:33
  • 3
    $\begingroup$ This is a very general question. Trying to answer, I realized that there are many answers here that should have the physics tag but don't. But I can't give a meaningful answer until you get more specific and show some code you've tried. $\endgroup$
    – Jens
    Commented Jan 23, 2013 at 17:16
  • 1
    $\begingroup$ What about this code from the "Neat examples" section from the Manipulate doc page? Manipulate[ ContourPlot[ q1/Norm[{x, y} - p[[1]]] + q2/Norm[{x, y} - p[[2]]], {x, -2, 2}, {y, -2, 2}, Contours -> 10], {{q1, -1}, -3, 3}, {{q2, 1}, -3, 3}, {{p, {{-1, 0}, {1, 0}}}, {-1, -1}, {1, 1}, Locator}, Deployed -> True] $\endgroup$ Commented Jan 23, 2013 at 20:14

1 Answer 1

5
$\begingroup$

Too long for comment:

Look at the simulation demonstrations and pick one which makes you think "That's the stuff I'd like to do!"

For instance predator-pray ecosystem there is a link to Download Author Code on each demonstration page, do that and open it in Mathematica and if it asks you to enable dynamics, do it.

Now you have something like this: demo

Double click to expand the Initialization and Manipulate cell (you click the middle-line to expand the Manipulate cell).

Now you can see all the code and you can scratch your head until you understand how it works :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.