Path: blob/master/homework/homework_2018_1_06_1216730080.ipynb
934 views
Kernel: Python 3
Minimization
Find the minimum of a function.
One good and generic implementation is with
In [4]:
Out[4]:
Populating the interactive namespace from numpy and matplotlib
In [26]:
preparar un conjunto de puntos x
y y
tal qui al fitearlos con un polinomio (de grado o en la representación de Lagrange) muestre dos mínimos, uno global y el otro local
El polinimo es una función de la variable x
. Aplicar dos veces optimize.fmin_powell
para encontrar los dos mínimos
Tarea 6
Puntos a intrepolar
In [9]:
Interpolación de Lagrange
In [23]:
In [29]:
Out[29]:
[<matplotlib.lines.Line2D at 0x7f09ebbf19b0>]
Encontrando en primer mínimo cerca de (que resulta ser el mínimo global en ) y cerca de (un mínimo local)
In [31]:
Out[31]:
Optimization terminated successfully.
Current function value: -1.374113
Iterations: 2
Function evaluations: 28
Optimization terminated successfully.
Current function value: 0.699898
Iterations: 2
Function evaluations: 30
In [36]:
Out[36]:
El mínimo global es f(x)=-1.3741131581291484 para x=2.9278495523433894; el mínimo local es f(x)=0.6998981514389016 para x=5.004929253556888
In [58]:
In [49]:
In [50]:
In [51]:
Out[51]:
(89.095454429504983, 0.13095)
In [66]:
Out[66]:
<matplotlib.text.Text at 0x7f92a72cdb38>
In [67]:
Out[67]:
[<matplotlib.lines.Line2D at 0x7f92a7253dd8>]
In [68]:
Out[68]:
Optimization terminated successfully.
Current function value: -120297525.773196
Iterations: 2
Function evaluations: 44
array(174.0956017878611)
In [43]:
Out[43]:
360086969.08211577
Least action
See Least action
In [78]:
In [71]:
Function to find the least Action by using scipy.optimize.fmin_powell
. It start from and find the least action
In [79]:
In [141]:
Out[141]:
Optimization terminated successfully.
Current function value: -21.392910
Iterations: 15
Function evaluations: 2154
In [142]:
Out[142]:
(array([ 0. , 3.96900002, 7.05599999, 9.26099998,
10.58400002, 11.02500004, 10.58400005, 9.26100006,
7.05600004, 3.96900001, 0. ]),
11.025000043847939,
-21.392910000000008,
0.3)
In [143]:
In [144]:
Out[144]:
2
-4.9 x + 14.7 x - 1.402e-08
In [145]:
Out[145]:
<matplotlib.text.Text at 0x7f92a6db8278>
In [69]:
Out[69]:
[0, 1]
In [ ]: