Project

Finding minimum pressure with the help of Newton Raphson method

Given below is the python code for solving cushion pressure for a particular thickness of ice with the help of Newton Raphson method

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))>.001):
		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.xlabel('Thickness of ice')
plt.ylabel('Pressure')
plt.show()

Results:

given below is the relationship between thickness of ice and cushion pressure

Thickness cushion pressure
.6 31676.68448708497
1.2 126706.79124494307
1.8 285090.3202735967
2.4 506827.271573046
3.0 791917.6451432907
3.6 1140361.4409843315
4.2 1552158.6590961672
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.