Jan-13-2020, 08:54 AM
(This post was last modified: Jan-13-2020, 11:22 AM by Larz60+. Edited 3 times in total.)

I have many input parameters and a function in the end of the following code. The unknown parameter is the "Fi". I tried to find a zero of the last function, but I could make only an iteration for this problem. Can you please help me to find a better function for determining "Fi"? Thank you :-)

Please post all code, output and errors (in it's entirety) between their respective tags. I did it for you this time, Here are instructions on how to do it yourself next time.

n=7 di=[4,2,1,0.5,0.25,0.125,0.0625] beta_i=np.array([0.606,0.606,0.575,0.568,0.563,0.541,0.506],np.float32) fi_i=np.array([0.535,0.546,0.525,0.469,0.513,0.500,0.485],np.float32) yi=np.array([0.022,0.201,0.096,0.063,0.315,0.249,0.054],np.float32) K=4.10 aij=0.712 bij=0.651 p01=0 p02=(1-beta_i[1]+bij*beta_i[1]*(1-1/beta_i[0]))*yi[0] p03=(1-beta_i[2]+bij*beta_i[2]*(1-1/beta_i[1]))*yi[1] p04=(1-beta_i[3]+bij*beta_i[3]*(1-1/beta_i[2]))*yi[2] p05=(1-beta_i[4]+bij*beta_i[4]*(1-1/beta_i[3]))*yi[3] p06=(1-beta_i[5]+bij*beta_i[5]*(1-1/beta_i[4]))*yi[4] p07=(1-beta_i[6]+bij*beta_i[6]*(1-1/beta_i[5]))*yi[5] q01=(1-(aij*(beta_i[0]/beta_i[1])))*yi[1] q02=(1-(aij*(beta_i[1]/beta_i[2])))*yi[2] q03=(1-(aij*(beta_i[2]/beta_i[3])))*yi[3] q04=(1-(aij*(beta_i[3]/beta_i[4])))*yi[4] q05=(1-(aij*(beta_i[4]/beta_i[5])))*yi[5] q06=(1-(aij*(beta_i[5]/beta_i[6])))*yi[6] q07=0 P=[p01,p02,p03,p04,p05,p06,p07] Q=[q01,q02,q03,q04,q05,q06,q07] sump1=0 sump2=0 sump3=np.sum(P[0:1]) sump4=np.sum(P[0:2]) sump5=np.sum(P[0:3]) sump6=np.sum(P[0:4]) sump7=np.sum(P[0:5]) sumq1=np.sum(Q[1:6]) sumq2=np.sum(Q[2:6]) sumq3=np.sum(Q[3:6]) sumq4=np.sum(Q[4:6]) sumq5=np.sum(Q[5:6]) sumq6=0 sumq7=0 gamma_1=beta_i[0]/(1-sumq1) gamma_2=beta_i[1]/(1-sumq2) gamma_3=beta_i[2]/(1-sump3-sumq3) gamma_4=beta_i[3]/(1-sump4-sumq4) gamma_5=beta_i[4]/(1-sump5-sumq5) gamma_6=beta_i[5]/(1-sump6-sumq6) gamma_7=beta_i[6]/(1-sump7-sumq7) gamma_i=np.array([gamma_1,gamma_2,gamma_3,gamma_4,gamma_5,gamma_6,gamma_7],np.float32) def error(Fi): return (K-((yi/beta_i)/(1/Fi-1/gamma_i)).sum()) print(error(0.482))

**Larz60+**wrote Jan-13-2020, 11:22 AM:Please post all code, output and errors (in it's entirety) between their respective tags. I did it for you this time, Here are instructions on how to do it yourself next time.