newton method
Posted: Wed Jan 30, 2013 6:30 am
Anyone know how to solve problem regarding newton method as follows:
k =0.5 sigma1=1.2, sigma2 changes such that =1.1, 1.2, 1.3,…,10.0
f(p)=(1-sigma1)*p^-sigma1+(1-sigma2)*p^-sigma2+sigma1*k*p^-sigma1-1+sigma2*k*p^-sigma2-1
the problem is how to find the value of p which results f(p)=0 for each sigma2.
Note: in terms of sigma2 is a constant, i have found the value of p by using this code (e.g. sigma2=1.6):
Thanks in advance
k =0.5 sigma1=1.2, sigma2 changes such that =1.1, 1.2, 1.3,…,10.0
f(p)=(1-sigma1)*p^-sigma1+(1-sigma2)*p^-sigma2+sigma1*k*p^-sigma1-1+sigma2*k*p^-sigma2-1
the problem is how to find the value of p which results f(p)=0 for each sigma2.
Note: in terms of sigma2 is a constant, i have found the value of p by using this code (e.g. sigma2=1.6):
Code: Select all
scalar k=0.5
scalar sig1=1.2
scalar sig2=1.6
series fp=NA
series p=NA
p(1)=0.1
for !j=2 to 1000
p(!j) = p(!j-1) - ((1-sig1)*p(!j-1)^(-sig1)+(1-sig2)*p(!j-1)^(-sig2) + sig1*k*p(!j-1)^(-sig1-1)+sig2*k*p(!j-1)^(-sig2-1))/(-sig1*(1-sig1)*p(!j-1)^(-sig1-1)+(-sig2)*(1-sig2)*p(!j-1)^(-sig2-1) + sig1*k*(-sig1-1)*p(!j-1)^(-sig1-2)+sig2*k*(-sig2-1)*p(!j-1)^(-sig2-2))
fp(!j) = ((1-sig1)*p(!j)^(-sig1) +(1-sig2)*p(!j)^(-sig2) + sig1*k*p(!j)^(-sig1-1)+sig2*k*p(!j)^(-sig2-1))
if p(!j) - p(!j-1) < 1e-9 and fp(!j) < 1e-9 then
scalar num_iterations = !j
!j=1000
endif
next