Question: There is a problem when I want to install numpy on my macbok. Antouns-MacBook-Pro:~ anton$ pip nstall numpy -bash: pip: command not found. What Can

There is a problem when I want to install numpy on my macbok.

Antouns-MacBook-Pro:~ anton$ pip nstall numpy

-bash: pip: command not found.

What Can i do? It's for this problem of the code.

import numpy as np

import matplotlib.pyplot as plt

def f(r,t):
theta = r[0]
v = r[1]
w = r[2]
return np.array([v,-(g/l)*np.sin(theta),w,(g/l)*np.cos(theta)])

a = 0.0
b = 5.0
N = 1000
h = (b-a)/N

r = np.array([np.pi/4,0.0,0.0])

tpoints = np.arange(a,b,h)
thetapoints = []
rpoints = []

for t in tpoints:
thetapoints.append(r[0])
rpoints.append(r[1])
k1 = h*f(r,t)
k2 = h*f(r+0.5*k1,t+0.5*h)
k3 = h*f(r+0.5*k2,t+0.5*h)
k4 = h*f(r+k3,t+h)
r += (k1+2*k2+2*k3+k4)/6

plt.plot(tpoints,thetapoints,label='theta(t)')
plt.plot(tpoints,rpoints,label='r(t)')
plt.legend()
plt.xlabel("t")
plt.show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!