Menu

[r3949]: / trunk / course / examples / scipy / example5.9  Maximize  Restore  History

Download this file

17 lines (13 with data), 312 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
>>> def func(x):
return x + 2*cos(x)
>>> def func2(x):
out = [x[0]*cos(x[1]) - 4]
out.append(x[1]*x[0] - x[1] - 5)
return out
>>> from optimize import fsolve
>>> x0 = fsolve(func, 0.3)
>>> print x0
-1.02986652932
>>> x02 = fsolve(func2, [1, 1])
>>> print x02
[ 6.5041 0.9084]
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.