Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, Here is the full question in the link below. I will only rate full answers t

ID: 2240932 • Letter: H

Question

Hi,


Here is the full question in the link below. I will only rate full answers that are specific to the question and use the same method as told to in the question.


As an answer i am looking for a complete code with an explanation of the method, maybe the method could be explained using comments in the Python code. Also please can you make the code as compatible as possible, e.g please do not use the latest python.


http://postimg.org/image/kff8emil3/


Here is the newtonraphson code you will need to use, along with gaussPivot module


http://www.filedropper.com/newtonraphson2

http://www.filedropper.com/gausspivot


If there are any problems with the question, please contact me, by commenting.


Thank you for the help!!!

Hi, Here is the full question in the link below. I will only rate full answers that are specific to the question and use the same method as told to in the question. As an answer i am looking for a complete code with an explanation of the method, maybe the method could be explained using comments in the Python code. Also please can you make the code as compatible as possible, e.g please do not use the latest python. http://postimg.org/image/kff8emil3/ Here is the newtonraphson code you will need to use, along with gaussPivot module http://www.filedropper.com/newtonraphson2 http://www.filedropper.com/gausspivot If there are any problems with the question, please contact me, by commenting. Thank you for the help!!!

Explanation / Answer

ans = 6553 km, at theta=1.23 radians = 70.47 degrees


The newtonraphson2 needed to be changed a little. h=1e-5, and the loop in newtonraphson to 300 instead of 30.


The code with indentation is at http://pastebin.com/DA2XrCQY


import numpy as np
import scipy.optimize as opt
import newtonRaphson2 as nr

# function which returns R for a theta and parameters a,e, and alpha
def getR(theta, aealpha):
a,e,alpha = aealpha
Rhat = a*(1-e)**2 / (1 + e*np.sin(theta+alpha))
return Rhat


# let us define the function which will give the errors
# in the predictions of R given a, e, and alpha
def f(aealpha):

# these are the observations
thet = [-np.pi/6,0,np.pi/6]
R = [6870,6728,6615]

#let us store the prediction errors in ans
ans = []
for i in range(len(thet)):
Rhat = getR(thet[i], aealpha)
ans += [(R[i]-Rhat)]
return np.array(ans)

def getEstFsolve():
return opt.fsolve(f,[7000,.5,np.pi/3])

def getEstNR():
return nr.newtonRaphson2(f,np.array([7000,.5,0]))

if __name__=='__main__':

# Use fsolve
# First, estimate the parameters based on the data
aealpha = getEstFsolve()
a,e,alpha = aealpha

# the minimum is attained
# when the denominator is max at theta+alpha=pi/2
theta_min = np.pi/2 - alpha
R_min = getR(theta_min, aealpha)

# print the answer
print "Using scipy's fsolve, the estimaed parameters were:"
print "a = %f km, e = %f, alpha = %f degrees." %(a,e,alpha*180/np.pi)
print "min R is %f, at %f " %(R_min, theta_min)


# Use NR
# First, estimate the parameters based on the data
aealpha = getEstNR()
a,e,alpha = aealpha

# the minimum is attained
# when the denominator is max at theta+alpha=pi/2
theta_min = np.pi/2 - alpha
R_min = getR(theta_min, aealpha)

# print the answer
print "Using newtonraphson2, the estimaed parameters were:"
print "a = %f km, e = %f, alpha = %f degrees." %(a,e,alpha*180/np.pi)
print "min R is %f, at %f " %(R_min, theta_min)


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote