Project

Breaking ice with air cushion vehicle newton-raphson method

Aim:

To write a python script to solve for the minimum value of pressure using the newton raphson method and to solve these criteria,

1. Use the newton raphson method to find out the value of pressure for h = 0.6 ft.

2. Find the optimal relaxation factor for this problem with the help of a suitable plot.

3. Tabulate the results of p for h = [0.6,1.2,1.8,2.4,3,3.6,4.2] assuming a suitable relaxation factor.

Description:

Newton-raphson:

Newton-Raphson method is used to find the roots of an equation through iterative approximations starting from a given point.

Formula:

Consider a function f(x) with an initial point as x0. Then, by employing this method we find the next closest approximation by using the formula -

The process is then repeated iteratively such that -

Procedure:

  • First try to solve the below equation into parts and try to write like a python syntax
  • Then open Python start coding by importing the required modules for the program
  • Initialize the values that have been provided in your assignment
  • For the first case enter the alpha value as 1 and for second use the linspace command to change the float to an array
  • Define the braked formula and write as a function code
  • For second-order equation write as fprime
  • Then use for loop for storing values in the array by using the append command
  • Print the values like a table format for both the cases
  • plot the values

Case1: To find the minimum pressure to break the ice

Program:

#Program to find the minimum pressure to break the ice 
#programmed by Hariprasad

import math
import matplotlib.pyplot as plt
import numpy as np

#inputs

 #width of ice-wedge(no units)

beta=0.5

 #size of air cushion(feet)

r=40 

#tensile strength of ice(psi)

segma=150  

#converting psi into psf

segma=150*144   

#thickness of ice(feet)

t=[0.6,1.2,1.8,2.4,3.0,3.6,4.2]   

 #relaxation factor

alpha=1 

#tolerance

tol=1e-6 

#simplify the equation

a=1-pow(beta,2)
b=0.4*pow(beta,2)
c=segma/pow(r,2)
d=pow(segma,2)/(3*pow(r,4))
e=pow(segma,3)/(9*pow(r,6))

#defining the function

def f(p,h):
	return (a*pow(p,3))+((b*h-c*pow(h,2))*pow(p,2))+(d*pow(h,4)*p)-(e*pow(h,6))

def fprime(p,h):
	return (a*3*pow(p,2))+((b*h-c*pow(h,2))*2*p)+(d*pow(h,4))


#finding minimum pressure to break the ice

pr=[]
itr=[]


for h in t:
	ct=1
	pg=500
	while(abs(f(pg,h))>tol):
		pg=pg-alpha*(f(pg,h)/fprime(pg,h))
		ct=ct+1
	pr.append(pg)
	itr.append(ct)


#printing result
print('Thickness','::','min pressure','::','no.of iterations')
for i in range(0,7):
	print(t[i],'::',pr[i],'::',itr[i])


plt.plot(t,pr)
plt.xlabel('Thickness of ice ')
plt.ylabel('Pressure')
plt.show()

Output:

Thickness :: min pressure :: no.of iterations
0.6 :: 4.977379951303611 :: 18
1.2 :: 20.09726904344556 :: 15
1.8 :: 45.359640872118376 :: 13
2.4 :: 80.7644942796812 :: 11
3.0 :: 126.31182904214381 :: 10
3.6 :: 182.00164508587773 :: 9
4.2 :: 247.83394237957145 :: 8

Plot:

Case 2: To find out the values of pressure for height 0.6ft

Program:

#Program to find the value of pressure to break the ice at h=0.6ft
#programmed by Hariprasad

import math
import matplotlib.pyplot as plt
import numpy as np

#inputs

 #width of ice-wedge(no units)

beta=0.5

 #size of air cushion(feet)

r=40 

#tensile strength of ice(psi)

segma=150  

#converting psi into psf

segma=150*144   

#thickness of ice(feet)

t=0.6

#relaxation factor

alpha=np.linspace(0.1,1.5,100)

#tolerance

tol=1e-6 

#simplify the equation

a=1-pow(beta,2)
b=0.4*pow(beta,2)
c=segma/pow(r,2)
d=pow(segma,2)/(3*pow(r,4))
e=pow(segma,3)/(9*pow(r,6))

#defining the function 

def f(p):
	h=0.6
	return (a*pow(p,3))+((b*h-c*pow(h,2))*pow(p,2))+(d*pow(h,4)*p)-(e*pow(h,6))

def fprime(p):
	h=0.6
	return (a*3*pow(p,2))+((b*h-c*pow(h,2))*2*p)+(d*pow(h,4))


#finding minimum pressure to break the ice

pr=[]
itr=[]


for i in alpha:
	ct=1
	pg=500
	while(abs(f(pg))>tol):
		pg=pg-i*(f(pg)/fprime(pg))
		ct=ct+1
	pr.append(pg)
	itr.append(ct)


#printing result
print('relaxation factor','::','min pressure','::','no.of iterations')
for j in range(0,100):
	print(alpha[j],'::',pr[j],'::',itr[j])


plt.plot(alpha,pr)
plt.xlabel('factor of relaxation')
plt.ylabel('iterations')
plt.show()

Output:

relaxation factor :: min pressure :: no.of iterations
0.1 :: 4.977380011822539 :: 312
0.11414141414141414 :: 4.977380012426929 :: 272
0.12828282828282828 :: 4.977380011487564 :: 241
0.14242424242424243 :: 4.977380011940512 :: 216
0.15656565656565657 :: 4.977380007529074 :: 196
0.1707070707070707 :: 4.977380006478485 :: 179
0.18484848484848485 :: 4.977380012455974 :: 164
0.198989898989899 :: 4.977380007257722 :: 152
0.21313131313131312 :: 4.977380010171898 :: 141
0.22727272727272727 :: 4.977380003936536 :: 132
0.24141414141414141 :: 4.977380014093915 :: 123
0.25555555555555554 :: 4.977380007126663 :: 116
0.26969696969696966 :: 4.977380013615654 :: 109
0.28383838383838383 :: 4.977380014241521 :: 103
0.297979797979798 :: 4.977380005844926 :: 98
0.31212121212121213 :: 4.977380007084585 :: 93
0.32626262626262625 :: 4.977379996882652 :: 89
0.3404040404040404 :: 4.977379993848091 :: 85
0.3545454545454545 :: 4.977379996848428 :: 81
0.36868686868686873 :: 4.977380007455978 :: 77
0.38282828282828285 :: 4.977380000729673 :: 74
0.396969696969697 :: 4.9773799995760175 :: 71
0.4111111111111111 :: 4.977380003789042 :: 68
0.4252525252525252 :: 4.97737998794577 :: 66
0.43939393939393934 :: 4.977379999987204 :: 63
0.45353535353535357 :: 4.977379991073436 :: 61
0.4676767676767677 :: 4.977379986136821 :: 59
0.4818181818181818 :: 4.9773799840935675 :: 57
0.49595959595959593 :: 4.977379984562267 :: 55
0.51010101010101 :: 4.977379987751424 :: 53
0.5242424242424242 :: 4.97737999458618 :: 51
0.5383838383838384 :: 4.977380007175833 :: 49
0.5525252525252525 :: 4.977379986504883 :: 48
0.5666666666666667 :: 4.977380003846189 :: 46
0.5808080808080808 :: 4.977379987397654 :: 45
0.5949494949494949 :: 4.977380014318578 :: 43
0.609090909090909 :: 4.9773799988802025 :: 42
0.6232323232323231 :: 4.977379988401802 :: 41
0.6373737373737374 :: 4.97737998121506 :: 40
0.6515151515151515 :: 4.977379976272768 :: 39
0.6656565656565656 :: 4.977379972913604 :: 38
0.6797979797979797 :: 4.977380011952865 :: 36
0.6939393939393939 :: 4.977380010607833 :: 35
0.708080808080808 :: 4.977380011852919 :: 34
0.7222222222222222 :: 4.9773799692733 :: 34
0.7363636363636363 :: 4.977379970418101 :: 33
0.7505050505050505 :: 4.977379972628697 :: 32
0.7646464646464646 :: 4.977379976324836 :: 31
0.7787878787878787 :: 4.977379982274299 :: 30
0.7929292929292928 :: 4.9773799918855355 :: 29
0.807070707070707 :: 4.97738000782217 :: 28
0.8212121212121212 :: 4.977379966330553 :: 28
0.8353535353535353 :: 4.977379973398064 :: 27
0.8494949494949494 :: 4.977379986147889 :: 26
0.8636363636363635 :: 4.977380010621272 :: 25
0.8777777777777777 :: 4.977379964728725 :: 25
0.8919191919191919 :: 4.977379975446292 :: 24
0.906060606060606 :: 4.977379998745241 :: 23
0.9202020202020201 :: 4.977379959518979 :: 23
0.9343434343434343 :: 4.977379967721459 :: 22
0.9484848484848484 :: 4.9773799869473665 :: 21
0.9626262626262625 :: 4.977379954429463 :: 21
0.9767676767676767 :: 4.977379956059601 :: 20
0.9909090909090909 :: 4.9773799550531415 :: 19
1.005050505050505 :: 4.977379967347717 :: 18
1.0191919191919192 :: 4.977379952867931 :: 19
1.0333333333333332 :: 4.97737995716735 :: 19
1.0474747474747474 :: 4.977379946808481 :: 19
1.0616161616161617 :: 4.977379922894716 :: 19
1.0757575757575757 :: 4.977379916631891 :: 19
1.08989898989899 :: 4.977379893219114 :: 18
1.1040404040404042 :: 4.977379942842035 :: 20
1.1181818181818182 :: 4.9773799347538485 :: 20
1.1323232323232324 :: 4.9773799362197595 :: 20
1.1464646464646464 :: 4.977379919476404 :: 19
1.1606060606060606 :: 4.977379993681497 :: 20
1.1747474747474749 :: 4.977379936817901 :: 21
1.1888888888888889 :: 4.977379932933438 :: 21
1.2030303030303031 :: 4.977380004019897 :: 20
1.2171717171717171 :: 4.97737996658965 :: 21
1.2313131313131314 :: 4.977380011453377 :: 21
1.2454545454545454 :: 4.9773799236433245 :: 22
1.2595959595959596 :: 4.977379913180724 :: 22
1.2737373737373738 :: 4.977379917291765 :: 22
1.2878787878787878 :: 4.977380000655811 :: 19
1.302020202020202 :: 4.977379929431343 :: 23
1.316161616161616 :: 4.977379891646246 :: 23
1.3303030303030303 :: 4.9773799872106865 :: 24
1.3444444444444446 :: 4.977380004073867 :: 24
1.3585858585858586 :: 4.977380009404242 :: 24
1.3727272727272728 :: 4.977379984439893 :: 24
1.3868686868686868 :: 4.977379904461668 :: 24
1.401010101010101 :: 4.977379917977095 :: 26
1.415151515151515 :: 4.97737998447069 :: 27
1.4292929292929293 :: 4.977379924012474 :: 28
1.4434343434343435 :: 4.977379906387147 :: 28
1.4575757575757575 :: 4.97737989037881 :: 28
1.4717171717171718 :: 4.977379890186813 :: 28
1.4858585858585858 :: 4.9773799898139615 :: 27
1.5 :: 4.977379896945533 :: 29

Plot:

Result:

Hence the values are obtained and graph is plotted.

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.