blob: 65009de8560e69882552b6ff24de65db2e24479b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
//Given that
mass = 2.0 //in kg
v1 = 4.0 //in m/s^2
Ff = 15 //in N
k = 10^4 //in N/m
//Sample Problem 8-7
printf("**Sample Problem 8-7**\n")
//Using energy conservation
//Ki = Uf + TEf
Ki = .5* mass* v1^2
//Uf = .5*k*x^2
//TEf = Ff* x
s=poly(0,"s")
p = .5*k*s^2 + Ff* s - Ki
x = roots(p)
printf("The compression in the spring is equal to %fcm", x(1)*100)
|