# Check calculation on pendulum.

• tnutty
The code also calculates the velocity and position of the ball based on the acceleration and change in angle. The change in angle is calculated using the ball's position and the desired angle. A rope is also set to the ball's position as the endpoint. In summary, the code correctly calculates the acceleration, velocity, and position of a pendulum using the weight, angle, and time.
tnutty
Can someone check my calculation for pendulum. Its written in C++, but I think it should be understandable.

//F = mg*sin(theta) = ma;
//a = F/ m
//a = mgsin(theta) / m
//a = g*sin(theta)
ball.accelVec = Vector3D( g * sin( changeInAngle ) ,g * cos(changeInAngle) , 0.0f );

//V = v_0 + a*t
ball.velVec += ball.accelVec * deltaTime;

// X = v*dt + 1/2 a*dt^2
ball.posVec += ball.velVec * deltaTime + 1.0f/2.0f * ball.accelVec * deltaTime * deltaTime;

changeInAngle = atan2( ball.posVec.getY(), ball.posVec.getX() ) - restAngle;

rope.setEndPoint( ball.posVec );
------------
Basically, ball.accelVec is the critical one, since everything else depends upon it.
The Vector3D is Vector3D( x ,y z ). So is the acceleration vector correct for the pendulum.

I think the Force for the pendulum should be < w*sin(theta), w*cos(theta) >, where w is
weight and theta is in radians ?

Sorry for the programming language.

Yes, the acceleration vector for the pendulum is correct. The force vector should be <w*sin(theta), w*cos(theta)>, where w is the weight and theta is in radians.

No need to apologize for the programming language, it is a valid way to express mathematical equations. As for your calculations, they seem to be correct for a simple pendulum system. The acceleration vector should indeed be <g*sin(theta), g*cos(theta), 0>, where g is the gravitational acceleration and theta is the angle of the pendulum. This is derived from the equation F=ma, where F is the force of gravity pulling on the pendulum (mg) and a is the acceleration vector. The rest of your calculations also seem to be correct, taking into account the initial velocity and position of the ball. Overall, your calculation for the pendulum appears to be sound.

## 1. What is a pendulum?

A pendulum is a weight suspended from a fixed point that is free to swing back and forth due to the force of gravity. It is commonly used as a timing device in clocks and other scientific instruments.

## 2. How do you calculate the period of a pendulum?

The period of a pendulum is calculated using the formula T = 2π√(L/g), where T is the period in seconds, L is the length of the pendulum in meters, and g is the acceleration due to gravity (9.8 m/s² on Earth).

## 3. What factors affect the period of a pendulum?

The period of a pendulum is affected by the length of the pendulum, the mass of the weight, and the strength of gravity. It is also affected by air resistance and the angle at which the pendulum is released.

## 4. How do you check the calculation on a pendulum?

To check the calculation on a pendulum, you can compare the calculated period with the actual period measured using a stopwatch. You can also compare your results with the expected value based on the length of the pendulum and the acceleration due to gravity.

## 5. How accurate are pendulum calculations?

Pendulum calculations can be very accurate if all factors are taken into account and the measurements are precise. However, factors such as air resistance and the precision of the pendulum's suspension point can affect the accuracy of the calculations.

• Introductory Physics Homework Help
Replies
20
Views
1K
• Introductory Physics Homework Help
Replies
9
Views
782
• Introductory Physics Homework Help
Replies
2
Views
679
• Introductory Physics Homework Help
Replies
21
Views
1K
• Introductory Physics Homework Help
Replies
3
Views
1K
• Introductory Physics Homework Help
Replies
55
Views
2K
• Introductory Physics Homework Help
Replies
7
Views
259
• Introductory Physics Homework Help
Replies
5
Views
5K
• Introductory Physics Homework Help
Replies
10
Views
336
• Introductory Physics Homework Help
Replies
9
Views
1K