Add files via upload
This commit is contained in:
parent
cfc4d77e7c
commit
28edde1a36
1 changed files with 28 additions and 17 deletions
|
|
@ -36,7 +36,6 @@ def polyfit(maxdeg, filename):
|
||||||
|
|
||||||
if n_variables>1:
|
if n_variables>1:
|
||||||
C_1_2 = fractional_matrix_power(np.cov(variables.T),-1/2)
|
C_1_2 = fractional_matrix_power(np.cov(variables.T),-1/2)
|
||||||
|
|
||||||
x = []
|
x = []
|
||||||
z = []
|
z = []
|
||||||
for ii in range(len(variables[0])):
|
for ii in range(len(variables[0])):
|
||||||
|
|
@ -44,6 +43,7 @@ def polyfit(maxdeg, filename):
|
||||||
x = x + ["x"+str(ii)]
|
x = x + ["x"+str(ii)]
|
||||||
z = z + ["z"+str(ii)]
|
z = z + ["z"+str(ii)]
|
||||||
|
|
||||||
|
if np.isnan(C_1_2).any()==False:
|
||||||
variables = np.matmul(C_1_2,variables.T).T
|
variables = np.matmul(C_1_2,variables.T).T
|
||||||
res = getBest(variables,f_dependent,maxdeg)
|
res = getBest(variables,f_dependent,maxdeg)
|
||||||
parameters = res[0]
|
parameters = res[0]
|
||||||
|
|
@ -63,6 +63,15 @@ def polyfit(maxdeg, filename):
|
||||||
|
|
||||||
eq = simplify(eq)
|
eq = simplify(eq)
|
||||||
|
|
||||||
|
else:
|
||||||
|
res = getBest(variables,f_dependent,maxdeg)
|
||||||
|
parameters = res[0]
|
||||||
|
params_error = res[1]
|
||||||
|
deg = res[2]
|
||||||
|
|
||||||
|
eq = mk_sympy_function(parameters,n_variables,deg)
|
||||||
|
eq = simplify(eq)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
res = getBest(variables,f_dependent,maxdeg)
|
res = getBest(variables,f_dependent,maxdeg)
|
||||||
parameters = res[0]
|
parameters = res[0]
|
||||||
|
|
@ -76,3 +85,5 @@ def polyfit(maxdeg, filename):
|
||||||
|
|
||||||
return (eq, params_error)
|
return (eq, params_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue