Assignment 4 Problem No. 1
Assignment 4 Problem No. 1
Problem No. 1
Let the displacement of a projectile in the vertical and
horizontaldirection be respectively given by
y= 1600*1−e−^(t5))−160*t
and
x= 800*(1−e−^(t5))
b. Use the Newton Raphson method to find the elapsed time until
impactcorrect up to three decimal digits.•
ANSWER
Given,
The displacement of a projectile in the vertical and
horizontal direction are respectively:
y=16001−𝑒−𝑡5−160𝑡
and
𝑥=800(1−𝑒−𝑡5)
The Trajectory of the aboveprojectile is found out via
eliminating the time factor and plotting the curve obtained
between y and x respectively (in 2 Dimensions).Here the
time elapsed until impact will be obtained via Newton
Raphson Method.The Equation to find the numerical root
via Newton Raphson Method is given as:Xn+1=
Xn–f(Xn)/f’(Xn)Here, the time elapsed until impact refers to
the time at which the projectile hits the ground
(Mathematically this corresponds to the time at which Y-
axis Ordinate becomes Zero). Hence, The Required
Equation becomes:tn+1= tn–y(tn)/y’(tn)Calculating
y’(t):Via Manual Differentiation, we obtain:y’(t)=160(2te-t/
5–1)The Given Transcendental Equation y(t)=0 or 1600(1 –
e-t/5)-160t=0can be solved using Newton-Raphson Method
with the help of y(t) itself at the indicated values and its
derivative respectively.
108| P a g eAfter obtaining the time elapsed until the
impact is found upto the desired accuracy, we then use this
in order to calculate the range of the projectile.
PROGRAM
program projectile
real:: t,x,y,ti,h,f,fd
integer :: i,ct
ti=0.0
open(1,file='proj1.dat',status='unknown')
do i =1,1000
x = 800.0*(1-exp(-ti/5.0))
y = 1600.0*(1-exp(-ti/5.0))-160.0*ti
write(1,*) x,y
ti=ti+0.1
enddo
if(ct>100) then
write(*,*)"Root cannot be determined.Enter another value for
initial time"
goto 1
endif
if (fd(t)==0) then
write(*,*)"Enter another value for Initial time as solution becomes
indefinte"
goto 1
endif
step= -f(t)/fd(t)
t=t+step
enddo
r=800*(1-exp(-t/5.0))
write(*,*)"the object hits ground at(in s)"
print*,t
write(*,*)"the range of the projectile is(in m)",r
write(*,*)"the no of iterations the solution has ungergone has",ct
end program projectile
OUTPUT
c. The Plot of the Trajectory
In order to obtain the Trajectory of the Projectile, the following
commands have to be used
van der Waals’ equation for real gas with a specific range
ofpressure (p) and temperature (T) is given by
(p+aV2)(V−b) =RT
where,a and b are empirical constants, depend on the properties
of a particular gas.
Assuming atmosphere and c.c as the units of pressure and volume
respectively at0oC, van der Waals found a=.00874 atmos and
b=.0023 c.c for CO2.
•Take an initial guess value which is much larger than the result
you haveobtained. Repeat the above process. How sensitive is the
method to the initial guess value?
ANSWER
THEORY
a
( )
a.Given, P+ V ( V −b )=RT where the corresponding variables have the
2
usual sense.
Rewriting the Van der Waal’s equation for real gas in the form of
f ( V )=0 we obtain;
( P+ Va ) ( V −b )−RT=0
2
a ab
PV −Pb+ − −RT =0
V V2
3 2 2
P V −Pb V + aV −ab−RT V =0
V ( PV + a )−V ( Pb+c )−ab=0 ; Here C=RT
2 2
PROGRAM
program vanderwalls
real*8::f,fd,v,va,error
integer::ct
va=0.5
open(1,file='Vanderwaals.dat',status='unknown')
do while(va<=1.5)
write(1,*)va,f(va)
va=va+0.001
end do
if(ct>1000)then
write(*,*)"Enter a New Initial Guess Value"
goto 1
end if
if(fd(v)==0.0)then
write(*,*)"Enter a new Initial Guess Vslue as the solution
becomes indefinite"
goto 1
end if
error=-f(v)/fd(v)
v=v+error
end do
a. GRAPH OF f(v) VS v
b. Taking the initial value from the graph = 1.1
The corresponding value of volume V obtained using Newton-
Raphson method is = 1.00000012
PROBLEM NO.3:
The amount of instantaneous charge in discharging a fully charged
capacitor in series LCR Circuit (see Figure Below) is given by:
R2
−Rt
1
√ t
q=q 0 e 2 L cos
ANSWER:
We have,
The amount of instantaneous charge in discharging a fully charged
capacitor in series LCR Circuit
R2
−Rt
1
√ t
q=q 0 e 2 L cos
¿> f ( R )=0
cos
√ − 2 t=0
LC 4 L
R2
−Rt
1
Where R = 0.1−e 2 L cos
√ − 2t
LC 4 L
PROGRAM
program problem3
real::f,fd,r,l,c,t,w,a,error
integer::count
l=5
c=0.0001
t=0.05
error=1.0
1 write(*,*)"Enter Initial Guess Value:"
read(*,*)r
count=0
do while(abs(error)>0.00001)
a=r/(2*l)
w=sqrt(1/(l*c)-a**2)
count=count+1
if(count>1000)then
write(*,*)"Root cannot be reached via this Initial
Guess Value.Enter new Value"
goto 1
end if
if(fd(r,a,w)==0.0)then
write(*,*)"Enter New Initial Value because solution
is indefinite"
goto 1
end if
error=-f(r,a,w)/fd(r,a,w)
r=r+error
end do
write(*,*)"The Solution is (in Ohm):",r
write(*,*)"The No. of Iterations Undergone is-->",count
end program problem3
fd=((-0.05/(2*5))*cos(w*.05)+sin(w*.05)*x*.05/(100*w))*(e
xp(-a*0.05))
end function fd
OUTPUT
DISCUSSIONS
When the resistance of the circuit is around 437 omhs then
the capacitor will loose 1% of its fully charged value at
0.05secs.
IMPORTANT NOTE: We see that after the initial guess of
448, solution given by the complier is NaN, which shows
the sensitivity of the program on initial guess.But wwe
have to understand that this sensitivity is not due to the
method of root finding that we have used(Newton-Raphson)
but due to the problem itself. We the equation we have
used
−Rt 2
1 R
R= 0.1−e 2L
cos
√ − 2t
LC 4 L