当前位置:网站首页>[SciPy optimization tutorial] v. quick solution of univariate function optimization
[SciPy optimization tutorial] v. quick solution of univariate function optimization
2022-06-12 23:30:00 【A sweet potato with honey and milk flavor】
Refer to the official website :Scipy.
A quick solution to the optimization of univariate functions
Many times we just need a single variable function ( That is, a function with scalar input ) The minimum value of . under these circumstances , Some methods can be optimized faster . All of these can be obtained from
minim_scalar Get in function , It proposes several algorithms . Unconstrained minimization (method=‘brent’)
actually , There are two ways to minimize univariate functions :Brent and golden, but golden Just for academic purposes , Rarely used . These two methods can be achieved by minim_scalar Select the method parameters in .brent Use Brent's algorithm to locate the minimum .
Examples are as follows :
from scipy.optimize import minimize_scalar
f = lambda x: (x - 2) * (x + 1)**2
res = minimize_scalar(f, method='brent')
print(res.x)
The result is 1
Bounded minimization (method=‘bounded’)
For example x = 5 x=5 x=5 Search near J 1 ( x ) J_1(x) J1(x) The minimum value of .minimize_scalar It can be limited to [ 4 , 7 ] [4,7] [4,7] Between , The result is x m i n = 5.3314 x_{min}=5.3314 xmin=5.3314
from scipy.special import j1
from scipy.optimize import minimize_scalar
res = minimize_scalar(j1, bounds=(4, 7), method='bounded')
print(res.x)
边栏推荐
- 移动安全必备之CS呢【NETHUNTER】
- 細數攻防演練中十大關鍵防守點
- DETR(Detection with Transformers) 学习笔记
- 2202-簡曆制作
- 同花顺股票账户开户安全吗
- 启牛帮开通的股票账户是安全可信的吗?
- Matters of parent-child class construction method in inheritance
- Coordinate transformation in pipelines
- csredis-in-asp. Net core theory practice - use examples
- Alcohol detector based on 51 single chip microcomputer
猜你喜欢

Redis实现短信验证码登录

移动安全必备之CS呢【NETHUNTER】
C language: how to give an alias to a global variable?

Colab教程(超级详细版)及Colab Pro/Colab Pro+使用评测

Photoshop:ps how to enlarge a picture without blurring

The development trend of digital collections!

Chapter 8 - shared model JUC

OpenCV源代码编译

80 lines of code to realize simple rxjs

数字藏品的发展趋势!
随机推荐
Report on the "fourteenth five year plan" and strategic strategy recommendations for China's intellectual property protection industry 2022 ~ 2028
PHP删除二维数组中相同项的数据
細數攻防演練中十大關鍵防守點
[Part VI] source code analysis and application details of countdownlatch [key]
For product managers, which of the two certificates, PMP and NPDP, is more authoritative?
设计消息队列存储消息数据的 MySQL 表格
Go时间格式化 赋值
CS for mobile security [nethunter]
Hostvars in ansible
Is it safe to open an account for flush stock account
[Part 7] source code analysis and application details of cyclicbarrier [key]
[kubernetes guide ④] pod quick start
The most widely used dynamic routing protocol: OSPF
How to package a colorpicker component for color selection?
36 krypton's debut | "osogena" won nearly ten million angel rounds of financing. The original DLR scientists of German Aerospace Research and development system modeling and simulation CAE software PA
Face detection: mtcnn
PostgreSQL 中文社区黑龙江分会和辽宁分会成立啦!
Analysis report on the "fourteenth five year plan" and the latest development trend of China's medical information industry from 2022 to 2028
MYSQL 行转列、列转行、多列转一行、一行转多列
Colab tutorial (super detailed version) and colab pro/colab pro+ usage evaluation