Posts Tagged ‘Random’

Automating Calculations in Physics 4AL

No Comments »

This isn’t really related directly to anything of importance in terms of CS, but it does relate a fundamental difference in those who program versus those who do not. My suitemate and I are both taking Physics 4AL this quarter, a lab which requires a large amount of calculation. However, it is the same calculation with different masses over and over. Last night, I was fed up with putting it in my calculator over and over again, so I wrote a little program. Presented below is this little program, which calculates the error σ = √( ((mg/(M+m)²)²*&sigma²) + ((M/(M+m)²)²*σ²) ).

:Prompt M
:Prompt W
:0.0001→S
:9.8→G
:((((W*G)/(M+W)
²)²*)+(((((M+W
)*G)-(W*G))/(M+W
)²)²*))→X
:Disp "SIGMA",X