擅长:python、mysql、java
<p><strong>1)酷的方法</strong></p>
<p>目前,我实现了一种“自适应优化”方法<a href="https://en.wikipedia.org/wiki/Adaptive_mesh_refinement" rel="nofollow noreferrer">inspired by hydrodynamics techniques</a>。我有一个要采样的函数,<code>f</code>,我选择一些采样点的初始数组<code>x_i</code>。我构造了一个“sampling”函数<code>g</code>,它决定在哪里插入新的采样点。在</p>
<p>在本例中,我选择<code>g</code>作为<code>log(f)</code>的斜率,因为我想解决日志空间中的快速变化。然后我将<code>g</code>的范围划分为<code>L=3</code>细化级别。如果<code>g(x_i)</code>超过了一个细化级别,则该范围被细分为<code>N=2</code>个片段,这些细分将被添加到示例中,并根据下一个级别进行检查。结果如下:</p>
<p><strong>纯灰</strong>线是我要采样的函数,<strong>黑色十字</strong>是我的初始采样点。<br/>
<strong>灰色虚线</strong>是我函数对数的导数。<br/>
<strong>彩色虚线</strong>是我的“优化级别”<br/>
<strong>彩色十字</strong>是我改进的采样点。在</p>
<p>这些都显示在日志空间中。在</p>
<p><img src="https://i.stack.imgur.com/eNowR.png" alt="enter image description here"/></p>
<p><strong>2)简单方法</strong></p>
<p>在我完成(1)之后,我意识到我可能只需要在<code>y</code>中选择一个最大间距,然后选择<code>x</code>-间距来实现这一点。类似地,只需在<code>y</code>中平均划分函数,并找到相应的<code>x</code>点。。。。结果如下:</p>
<p><img src="https://i.stack.imgur.com/bn5oI.png" alt="enter image description here"/></p>