当前位置:网站首页>[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)
边栏推荐
- Restrictions on MySQL function creation
- Photoshop:ps how to enlarge a picture without blurring
- Common rendering pipeline grooming
- Web3 principle and decentralization
- 2202 - production de CV
- Zhengzhou University of light industry -- development and sharing of harmonyos pet health system
- Model over fitting - solution (II): dropout
- Introduction to Quaternion
- Mgr and greatsql resource summary
- Deep learning neural network: implementation method of convolution [direct method (no loss of precision), GEMM (matrix multiplication, no loss of precision), FFT (Fourier transform, loss of precision)
猜你喜欢

Coordinate transformation in pipelines
![[North Asia data recovery] data recovery cases in which the partitions disappear and the partitions are inaccessible after the server reinstalls the system](/img/a9/7726139037860a5f880667cec4b6c2.jpg)
[North Asia data recovery] data recovery cases in which the partitions disappear and the partitions are inaccessible after the server reinstalls the system

Hostvars in ansible

Unprecedented analysis of Milvus source code architecture

Redis实现短信验证码登录

Leetcode1601: the maximum number of building change requests that can be reached (difficult)
![[Part VI] source code analysis and application details of countdownlatch [key]](/img/6e/085e257c938a8c7b88c12c36df83e1.jpg)
[Part VI] source code analysis and application details of countdownlatch [key]

Alien Skin Exposure X7调色滤镜插件,RAW后期处理工具

Alien skin exposure X7 color filter plug-in, raw post-processing tool

Record 5 - the serial port of stm32f411ceu6 realizes the sending and receiving of fixed length data and variable length data
随机推荐
China's new generation information technology industry "14th five year plan" special planning and innovation strategic direction report 2022 ~ 2028
Comprehensive analysis of C array
Colab教程(超级详细版)及Colab Pro/Colab Pro+使用评测
Colab tutorial (super detailed version) and colab pro/colab pro+ usage evaluation
Sequence maximum return
Huawei officially entered the "front loading" stage, and the millimeter wave radar track entered the "localization +4d" cycle
Alien skin exposure X7 color filter plug-in, raw post-processing tool
Introduction to Quaternion
PyTorch常用参数初始化方法:【均匀分布、正态(高斯)分布、Xavier、kaiming、正交矩阵、稀疏矩阵、常数、单位矩阵、零填充】
Introduction to message oriented middleware (message queue)
设计消息队列存储消息数据的 MySQL 表格
PHP deletes data of the same item in a two-dimensional array
QT actual combat case (38) -- using qpprocess class to realize the function of starting process
DETR(Detection with Transformers) 学习笔记
Deep feature synthesis and genetic feature generation, comparison of two automatic feature generation strategies
Gradient accumulation in pytorch [during the experiment, due to the limitation of GPU video memory, the batch\u size can no longer be increased. To solve this problem, the gradient accumulation method
移动安全必备之CS呢【NETHUNTER】
Analysis report on the 14th five year development plan and operation mode of China's hazardous waste treatment industry from 2022 to 2028
Analysis report on production and marketing demand and investment forecast of China's Melamine Industry from 2022 to 2028
Zhengzhou University of light industry -- development and sharing of harmonyos pet health system