Need Help with C Assignment to Compute a Pendulum's Motion?

  • Thread starter Thread starter Shukie
  • Start date Start date
  • Tags Tags
    Assignment
Click For Summary
SUMMARY

The discussion focuses on a C programming assignment to compute the motion of a pendulum, utilizing specific parameters such as NSTEPS, DT, and PRINTEVERY. The user seeks assistance in creating a loop that iterates NSTEPS times, highlighting their limited knowledge of C. Recommendations include acquiring a beginner's C programming book and installing a C compiler, with options like Dev-C++, Borland, or Visual Studio Express provided for free download.

PREREQUISITES
  • Basic understanding of C programming syntax
  • Familiarity with loops and iteration in programming
  • Knowledge of pendulum motion equations
  • Experience with C compilers such as Dev-C++, Borland, or Visual Studio Express
NEXT STEPS
  • Learn how to implement loops in C programming
  • Study the physics of pendulum motion and its mathematical representation
  • Explore debugging techniques in C to troubleshoot code
  • Research additional C programming resources for beginners
USEFUL FOR

Students learning C programming, educators teaching physics simulations, and anyone interested in computational modeling of physical systems.

Shukie
Messages
91
Reaction score
0

Homework Statement


The assignment is to compute the motion of a pendulum in C. The relevant information is listed in this document: http://home.orange.nl/~kuip3148/pendulum.c
It says which values to use for the variables, the relevant equations and has the value of NSTEPS, DT and PRINTEVERY. I have a step by step guide to solving this problem as well in Mathematica:

http://home.orange.nl/~kuip3148/Pendulum-assignment.nb

The Attempt at a Solution



The first thing I need to do is make a loop that runs NSTEPS times. Given my total lack of C knowledge, I run into a problem straight away. How can I make such a loop?
 
Last edited by a moderator:
Physics news on Phys.org
I suggest you get a beginner's book to learning C to get the step by step basics. At the same time, you may want to install a c-compiler on your computer, such as Dev-C++, Borland, or Visual Studio express, they are all free and available from Bloodshed, Borland or Microsoft respectively.
Here is the help you asked for, and hope that helps.

int i;
... (define NSTEPS and other variables)

for(i=0;i<NSTEPS;i++)
{
... your code here
}
 

Similar threads

Replies
3
Views
2K
Replies
7
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 10 ·
Replies
10
Views
9K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 27 ·
Replies
27
Views
2K