Issue
I have imported all the packages
def f(x,y,z):
return (1364*(z + x)**2 - (2728*(z + x)**3)/3 - 1600*y**2 + (3200*y**3)/3 \
- (5114092463576843*z**2)/4398046511104 + \
(5114092463576843*z**3)/6597069766656 + 1364*x**2 \
- (2728*x**3)/3 + 1364*(y - x)**2 + (2728*(y - x)**3)/3 \
+ 1364*(z - y + x)**2 - (2728*(z - y + x**3)/3 \
- 20799363518172179/105553116266496)**(1/2)
x0 = [0.3, 0.2, 0.2]
H = np.array(hessian(f, (x, y, z)))
res = minimize(f, [0,0,0], method='nelder-mead', options={'xtol': 1e-8, 'disp': True})
I have invalid syntax error in X0, H and res
Solution
I broke down your equation into additive terms just for visualization.
def f(x,y,z):
a = 1364 * (z + x) ** 2
b = (2728 * (z + x) ** 3) / 3
c = 1600 * y ** 2
d = (3200 * y ** 3) / 3
e = (5114092463576843 * z ** 2) / 4398046511104
g = (5114092463576843 * z ** 3) / 6597069766656
h = 1364 * x ** 2
i = (2728 * x ** 3) / 3
j = 1364 * (y - x) ** 2
k = (2728 * (y - x) ** 3) / 3
l = 1364 * (z - y + x) ** 2
m = (2728 * (z - y + x ** 3) / 3 - 20799363518172179 / 105553116266496) ** (1 / 2)
return (a - b - c + d - e + g + h - i + j + k + l - m)
The leading "(" before "a" didn't have ")" after "m" assuming that's where you wanted it. please make sure that all the terms above is correct.
Answered By - kkawabat
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.