Question

Use Python to solve each problem. 2. A particle moves according to a law of motion...

Use Python to solve each problem.

2. A particle moves according to a law of motion s = t 3 − 12t 2 + 24t, t ≥ 0.

a) Find the velocity at time t.

b) What is the velocity after 1 second?

c) When is the particle at rest?

d) Sketch the position function on t ∈ [0, 6] to determine when the particle is moving in the positive direction on that interval.

e) Find the total distance traveled in the first 6 seconds (exact and approximate).

f) Find the acceleration after 1 second and at the times found in part c).

g) Graph the position, velocity, and acceleration functions on the same set of axes for t ∈ [0, 8].

Please use Python commands.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

from sympy import *

from numpy import arange

import numpy as np

import matplotlib.pyplot as plt

t = Symbol('t')

#t 3 − 12t 2 + 24t

s = t**3 -(12*t**2) + (24*t)

sprime = s.diff(t)

print(sprime)


f = lambdify(t, sprime, 'numpy')

a = np.array([1])

print(f(a))

#solve for sprime =0 using solve function part c

roots = solve(sprime, t)

print(roots)



# d

#position at t = 6

f = lambdify(t, s, 'numpy')

a = np.array([6])

print(f(a))

#acceleration is derivative of velocity

sprimedouble = sprime.diff(t)

#display acceleration

print(sprimedouble)

#find value at 1

f = lambdify(t,sprimedouble , 'numpy')

a = np.array([1])

print(f(a))

a = np.array(roots)

print(f(a))

#plot position part d

t = np.arange(0.0, 6.0, 0.01)

s = (t**3 -(12*t**2) + (24*t))

plt.plot(t, s)

plt.xlabel('time')

plt.ylabel('Position')

plt.grid(True)

plt.savefig("positio.png")

plt.show()

#part g all 3 together

t = np.arange(0.0, 8.0, 0.01)

s = (t**3 -(12*t**2) + (24*t))

sprime = (3*t**2 -(24*t) + (24))

plt.plot(t, s)

sprimedouble = (6*t) - 24

plt.xlabel('time')

plt.ylabel('Position, velocity, acceleration')

plt.grid(True)

plt.savefig("positio.png")

plt.show()

#if you save as same fig it will overlap them on the same axis

plt.plot(t, sprime)

sprimedouble = (6*t) - 24

plt.savefig("positio.png")

plt.show()

plt.plot(t, sprimedouble)

plt.savefig("positio.png")

plt.show()

plot

last plot for all values

Add a comment
Know the answer?
Add Answer to:
Use Python to solve each problem. 2. A particle moves according to a law of motion...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT