Solving a projectile problem with mathematica

In summary, Mathematica is a powerful tool for solving projectile problems. It allows users to input variables such as initial velocity, angle of launch, and air resistance to calculate the trajectory of a projectile. The software also provides visualizations of the projectile's path and allows for the manipulation of variables to explore different scenarios. With its precise calculations and customizable features, Mathematica is an efficient and effective tool for solving projectile problems.
  • #1
Lewis
I am trying the solve the following diff. eq. with NDSolve in mathematica:

[itex] \ddot{x}(t) = - \frac{GMx(t)}{(x(t)^2+y(t)^2)^{\frac{3}{2}}}[/itex]
and
[itex] \ddot{y}(t) = - \frac{GMy(t)}{(x(t)^2+y(t)^2)^{\frac{3}{2}}} [/itex]

where [itex]GM=3.6018*10^{14}[/itex], the initial conditions are:
[itex] x(0)=0, y(0)=6000000 [/itex]
and [itex] vx0, vy0 [/itex] can be whatever.

The trouble is, I keep an error of some sort. I do not have a huge amount of experience with NDSolve so I am most likely doing something simple wrong. The latest thing I have tried is included as an attachment, and resulted in the error:
NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0.`.

If someone can point out what I'm doing wrong I would be very gratefull. I also have access to Maple if you know how to solve the problem using that, instead of Mathematica.
Thanks
 

Attachments

  • Mathematica.jpg
    Mathematica.jpg
    8.5 KB · Views: 410
Physics news on Phys.org
  • #2


Hello,

It seems like you are on the right track with using NDSolve to solve this system of differential equations. The error you are encountering is most likely due to the initial conditions you have specified. NDSolve requires all initial conditions to be numerical values, but in your case, you have only specified the initial positions x(0) and y(0). To solve this problem, you need to also specify the initial velocities vx(0) and vy(0).

To do this, you can define a list of initial conditions as follows:

initialConditions = {x[0] == 0, y[0] == 6000000, vx[0] == vx0, vy[0] == vy0}

where vx0 and vy0 can be any numerical values you choose.

Then, you can use this list of initial conditions in your NDSolve command as follows:

NDSolve[{x''[t] == -((GM*x[t])/((x[t]^2 + y[t]^2)^(3/2))),
y''[t] == -((GM*y[t])/((x[t]^2 + y[t]^2)^(3/2))),
initialConditions}, {x[t], y[t]}, {t, 0, 10}]

This should solve the system of differential equations and give you the numerical solutions for x(t) and y(t).

If you are still encountering errors, it might be helpful to check the syntax of your code and make sure all variables and functions are defined correctly. You can also refer to the Mathematica documentation for more information on using NDSolve.

As for using Maple to solve this problem, the syntax will be slightly different but the general approach will be the same. You can define the system of differential equations using the DifferentialEquation command and specify the initial conditions using the initialconditions option. Then, you can use the dsolve command to solve the system and obtain the numerical solutions.

I hope this helps and good luck with your problem-solving!
 
  • #3


Hi there,

Thank you for sharing your problem with us. It seems like you are on the right track with using NDSolve in Mathematica to solve your projectile problem. However, based on the error message you received, it appears that there may be an issue with your initial conditions or the way you have set up your equations.

One thing to check is if you have defined all the necessary variables and constants (such as GM) before running the NDSolve function. It is also important to make sure that your initial conditions are in the correct format and that your equations are properly written.

If you are still having trouble, I recommend checking out the Mathematica documentation or reaching out to the Mathematica community for assistance. You may also want to try using a different solver or approach to solving the problem, such as using the built-in functions for solving differential equations in Maple.

I hope this helps and that you are able to successfully solve your projectile problem. Best of luck to you!
 

1. How do I set up a projectile problem in Mathematica?

To set up a projectile problem in Mathematica, you will need to define the initial conditions of the projectile, such as its initial position, velocity, and acceleration. Then, you can use the built-in functions in Mathematica, such as NDSolve, to solve the equations of motion and obtain the trajectory of the projectile.

2. Can I change the parameters of the projectile in Mathematica?

Yes, you can easily change the parameters of the projectile in Mathematica. You can either redefine the initial conditions or use the Manipulate function to dynamically adjust the parameters and see the effects on the trajectory of the projectile.

3. How can I visualize the trajectory of the projectile in Mathematica?

You can use the built-in Plot or ParametricPlot functions in Mathematica to visualize the trajectory of the projectile. You can also add other graphics or animations to enhance the visualization of the projectile problem.

4. Can I solve a projectile problem with air resistance in Mathematica?

Yes, you can solve a projectile problem with air resistance in Mathematica by incorporating the air resistance force into the equations of motion. You can also use the built-in functions in Mathematica, such as ParametricNDSolve, to solve the problem numerically.

5. Is it possible to find the maximum height and range of a projectile in Mathematica?

Yes, it is possible to find the maximum height and range of a projectile in Mathematica. You can use the built-in functions, such as Solve or FindRoot, to find the roots of the equations of motion and determine the maximum height and range analytically. Alternatively, you can use numerical methods to approximate the maximum height and range.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
131
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
257
  • 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
4
Views
7K
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
Back
Top