Hi, I'm learning python and I'm just trying to minimize a function of many variables, but I have some problems with my code.(adsbygoogle = window.adsbygoogle || []).push({});

Code (Python):

import numpy as np

import scipy.optimize as op

from scipy.optimize import minimize

table1_np = np.genfromtxt('Data/tabla1.txt', usecols=0)

#--------------------------

def function(r0, rs):

r0, rs = parameters

return (r0*rs**3/table1_np[I])

def function2(parameters):

return sum(table2_np[I] - function[I])

x0=np.array[0.7, 1.1]

res=minimize(function2, x0, method = 'nelder-mead', options={'xtol':1e-8, 'disp':True})

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Minimization of many-variable function

Loading...

**Physics Forums | Science Articles, Homework Help, Discussion**