Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions