How can I simulate Newtonian motion using C code and graphics packages?

Click For Summary

Discussion Overview

The discussion revolves around simulating Newtonian motion using C code and various graphics packages. Participants explore methods for implementing the simulation, including the use of different programming languages and libraries, while addressing specific challenges related to the simulation of a cart and pendulum system over a time interval of 60 seconds.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant has solved the motion equations using Euler's Method and Runge Kutta and is seeking advice on software for simulating the motion of a cart.
  • Another participant suggests that C is a suitable language for the simulation, emphasizing that it is not overly complicated.
  • A participant expresses difficulty in finding helpful web resources for the simulation and inquires about graphic libraries compatible with the Mingw compiler.
  • One reply suggests using Java or MATLAB for drawing the simulation, indicating a preference for these languages over C for graphical representation.
  • A later reply questions the method of compiling velocity and displacement data, pointing out a potential issue with the integration method used if it does not account for the cart's acceleration due to gravity.
  • Participants mention the availability of graphics packages for Linux users and suggest alternatives like Borland C, VB.net, or C# for graphics capabilities, noting that speed may not be a critical factor in the simulation.

Areas of Agreement / Disagreement

Participants express differing opinions on the best programming language and graphics library to use for the simulation. There is no consensus on the most effective approach, and multiple competing views remain regarding the tools and methods for simulating the motion.

Contextual Notes

There are unresolved questions regarding the integration method used for calculating motion parameters and the specific requirements for graphical representation in the simulation.

Who May Find This Useful

Readers interested in programming simulations of physical systems, particularly those using C or exploring graphical libraries for motion representation.

Harmony
Messages
201
Reaction score
0

Homework Statement



http://img399.imageshack.us/img399/4277/cartyf8.jpg
http://g.imageshack.us/img399/cartyf8.jpg/1/

Homework Equations


Euler's Method, Runge Kutta 4th Order Method

The Attempt at a Solution



I have solved the motion equation for the above question using Euler's Method and Runge Kutta method. Using C language, I have compiled the variation of angle, angular velocity, angular acceleration, displacement, velocity and the acceleration of the cart and the pendulum with respect to time in the time interval of 60 seconds.

I wish to simulate the motion of the cart. Which software should I use to simulate the motion? Would C code for such simulation difficult to make?

Thanks in advanced.
 
Last edited by a moderator:
Physics news on Phys.org
Use whatever language you're comfortable with. C is fine for this since it isn't very complicated.
 
I have tried to look for web resources for the simulation. But most of the resources are not too helpful. Is there any graphic library of Mingw compiler? Thanks in advanced.
 
Oh you need to DRAW the simulation? I suggest using either Java or MATLAB then.
 
Did you compile the velocity and displacement at 60 seconds intervals, or did you integrate using Runge-Kutta at 60 second intervals?
If it is the latter, there is a little problem, because the cart is running down at 0.5g and it goes far after 60 seconds.

There are graphics packages similar to the Borland C graphics available to Linux users for the MingW compiler. I have looked for it but have not tried it yet. If you are familiar with Java, it provides very good tools for graphics simulations. Alternatively, if you have access to Borland C, it provides a simple but practical package. Not forgetting VB.net or C#, they all provide graphics capabilities when speed is not critical.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
Replies
1
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
7K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
7K