Project

project on finding minimum cushion pressure by newton Raphson method

\"\"\"
program to find minimum pressure by newton raphson
\"\"\"

import numpy as np
from matplotlib import pyplot as plt

b = .5; r=40; s=150
def f(p,h):
	return pow(p,3)*(1-pow(b,2))  + (.4*h*pow(b,2)-(s*pow(h,2))/pow(r,2))*pow(p,2) + ((pow(s,2)*pow(h,4))/3*pow(r,2))*p - pow(((s*pow(h,2))/3*pow(r,2)),3)
def f_prime(p,h):
	return 3*pow(p,2)*(1-pow(b,2))  + (.4*h*pow(b,2)-(s*pow(h,2))/pow(r,2))*pow(p,1)*2 + ((pow(s,2)*pow(h,4))/3*pow(r,2))
h = np.linspace(.6,4.2,7)
#print(h)
p_min = []
itr = 1
for x in h:

	def f_1(p):
		return f(p,x)
	def f_prime_1(p):
		return f_prime(p,x)
	p_guess = 160
	while(abs(f_1(p_guess))>.002):
		p_new  = p_guess - .5*(f_1(p_guess)/f_prime_1(p_guess))
		if abs(p_new - p_guess) == 0:
			break
		p_guess = p_new
		#print(p_guess)
	p_min.append(p_guess)
	
#print(p_min)
[H,P] = [h,p_min]
print(H,P)
plt.plot(H,P)
plt.title(\"newton raphson method\")
plt.xlabel(\'Thickness of ice\')
plt.ylabel(\'Pressure\')
plt.show()



					

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.