Код: Выделить всё
import tkFileDialog, tkMessageBox, sys, os, time
import ROOT, numpy
from Tkinter import*
from ScrolledText import ScrolledText
import matplotlib.pyplot as plt
import numpy as np
import math
import sys, os, time, shutil
import ROOT
from tkinter import filedialog, StringVar, IntVar, Menu, Label, Checkbutton, Button, mainloop, Tk, messagebox, W, Toplevel, scrolledtext, Spinbox, CENTER, Frame, END, filedialog, Entry
from tkinter.ttk import Combobox
from scipy import optimize
def f(params):
phi, teta = params
count = 0.
for u in range(len(X)):
count += ((R0[u] - X[u]*math.sin(teta)*math.cos(phi) - Y[u]*math.sin(teta)*math.sin(phi) - Z[u]*math.cos(teta))/(len(X) + 2))**2
return count
for q in range(len(fi)):
for w in range(len(theta)):
p = []
p = [fi[q], theta[w]]
p = optimize.minimize(f, p, method='Nelder-Mead', options=dict(maxiter=SIMPLEX_CALCU_LIMIT, maxfev=5*SIMPLEX_CALCU_LIMIT,
xatol=SIMPLEX_SIZE_LIMIT, fatol=SIMPLEX_SIZE_LIMIT, return_all=True, disp=False),
bounds=[(0, 2*math.pi), (0, 0.5*math.pi)])
print(p.x)
Подробнее здесь: https://stackoverflow.com/questions/785 ... python-3-1