This commit is contained in:
2025-10-13 00:24:11 +08:00
parent 32e3248b8c
commit b8c48b9521
37 changed files with 2334 additions and 1427 deletions
@@ -153,6 +153,158 @@ Class BinarySolverUtil
</h2>
<a id="Hi_Geom_Solvers_BinarySolverUtil_CenterSplitionSolve_" data-uid="Hi.Geom.Solvers.BinarySolverUtil.CenterSplitionSolve*"></a>
<h3 id="Hi_Geom_Solvers_BinarySolverUtil_CenterSplitionSolve_System_Func_System_Double_System_Double__Hi_Common_Range_System_Double__Hi_Geom_Vec2d_System_Double_System_Double_System_Func_System_Double_System_Boolean__System_Int32_" data-uid="Hi.Geom.Solvers.BinarySolverUtil.CenterSplitionSolve(System.Func{System.Double,System.Double},Hi.Common.Range{System.Double},Hi.Geom.Vec2d,System.Double,System.Double,System.Func{System.Double,System.Boolean},System.Int32)">
CenterSplitionSolve(Func&lt;double, double&gt;, Range&lt;double&gt;, Vec2d, double, double, Func&lt;double, bool&gt;, int)
</h3>
<div class="markdown level1 summary"><p>Efficient center splitting solve that uses an initial point (x0, y0) within the boundary to save one function evaluation.
The algorithm intelligently chooses the optimal boundary points based on the initial point position.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static IEnumerable&lt;BinarySolvingStatus&gt; CenterSplitionSolve(Func&lt;double, double&gt; func, Range&lt;double&gt; xBoundary, Vec2d x0y0, double yTarget, double convergenceLimit, Func&lt;double, bool&gt; isYAcceptableFunc, int maxIteration = 12)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>func</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>The function to solve</p>
</dd>
<dt><code>xBoundary</code> <a class="xref" href="Hi.Common.Range-1.html">Range</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>boundary of the search interval. The order of Min and Max is not mattered, i.e. they can be reversed.</p>
</dd>
<dt><code>x0y0</code> <a class="xref" href="Hi.Geom.Vec2d.html">Vec2d</a></dt>
<dd><p>Initial x,y value (x0,func(x0))</p>
</dd>
<dt><code>yTarget</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>Target y value to solve for</p>
</dd>
<dt><code>convergenceLimit</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>Convergence limit (acceptable error)</p>
</dd>
<dt><code>isYAcceptableFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;</dt>
<dd><p>Function to determine if a y value is acceptable</p>
</dd>
<dt><code>maxIteration</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>Maximum number of iterations</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;<a class="xref" href="Hi.Geom.Solvers.BinarySolvingStatus.html">BinarySolvingStatus</a>&gt;</dt>
<dd><p>A sequence of solving status objects showing the progress of the solution</p>
</dd>
</dl>
<a id="Hi_Geom_Solvers_BinarySolverUtil_CenterSplitionSolve_" data-uid="Hi.Geom.Solvers.BinarySolverUtil.CenterSplitionSolve*"></a>
<h3 id="Hi_Geom_Solvers_BinarySolverUtil_CenterSplitionSolve_System_Func_System_Double_System_Double__Hi_Common_Range_System_Double__System_Double_System_Double_System_Double_System_Func_System_Double_System_Boolean__System_Int32_" data-uid="Hi.Geom.Solvers.BinarySolverUtil.CenterSplitionSolve(System.Func{System.Double,System.Double},Hi.Common.Range{System.Double},System.Double,System.Double,System.Double,System.Func{System.Double,System.Boolean},System.Int32)">
CenterSplitionSolve(Func&lt;double, double&gt;, Range&lt;double&gt;, double, double, double, Func&lt;double, bool&gt;, int)
</h3>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static IEnumerable&lt;BinarySolvingStatus&gt; CenterSplitionSolve(Func&lt;double, double&gt; func, Range&lt;double&gt; xBoundary, double x0, double yTarget, double convergenceLimit, Func&lt;double, bool&gt; isYAcceptableFunc, int maxIteration = 12)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>func</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd></dd>
<dt><code>xBoundary</code> <a class="xref" href="Hi.Common.Range-1.html">Range</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd></dd>
<dt><code>x0</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd></dd>
<dt><code>yTarget</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd></dd>
<dt><code>convergenceLimit</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd></dd>
<dt><code>isYAcceptableFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;</dt>
<dd></dd>
<dt><code>maxIteration</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd></dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;<a class="xref" href="Hi.Geom.Solvers.BinarySolvingStatus.html">BinarySolvingStatus</a>&gt;</dt>
<dd></dd>
</dl>
<a id="Hi_Geom_Solvers_BinarySolverUtil_CenterSplitionSolve_" data-uid="Hi.Geom.Solvers.BinarySolverUtil.CenterSplitionSolve*"></a>
<h3 id="Hi_Geom_Solvers_BinarySolverUtil_CenterSplitionSolve_System_Func_System_Double_System_Double__Hi_Common_Range_System_Double__System_Double_System_Double_System_Func_System_Double_System_Boolean__System_Int32_" data-uid="Hi.Geom.Solvers.BinarySolverUtil.CenterSplitionSolve(System.Func{System.Double,System.Double},Hi.Common.Range{System.Double},System.Double,System.Double,System.Func{System.Double,System.Boolean},System.Int32)">
CenterSplitionSolve(Func&lt;double, double&gt;, Range&lt;double&gt;, double, double, Func&lt;double, bool&gt;, int)
</h3>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static IEnumerable&lt;BinarySolvingStatus&gt; CenterSplitionSolve(Func&lt;double, double&gt; func, Range&lt;double&gt; xBoundary, double yTarget, double convergenceLimit, Func&lt;double, bool&gt; isYAcceptableFunc, int maxIteration = 12)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>func</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd></dd>
<dt><code>xBoundary</code> <a class="xref" href="Hi.Common.Range-1.html">Range</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd></dd>
<dt><code>yTarget</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd></dd>
<dt><code>convergenceLimit</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd></dd>
<dt><code>isYAcceptableFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;</dt>
<dd></dd>
<dt><code>maxIteration</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd></dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;<a class="xref" href="Hi.Geom.Solvers.BinarySolvingStatus.html">BinarySolvingStatus</a>&gt;</dt>
<dd></dd>
</dl>
<a id="Hi_Geom_Solvers_BinarySolverUtil_CenterSplitionSolve_" data-uid="Hi.Geom.Solvers.BinarySolverUtil.CenterSplitionSolve*"></a>
<h3 id="Hi_Geom_Solvers_BinarySolverUtil_CenterSplitionSolve_System_Func_System_Double_System_Double__System_Double_System_Double_System_Double_System_Double_System_Double_System_Func_System_Double_System_Boolean__System_Int32_" data-uid="Hi.Geom.Solvers.BinarySolverUtil.CenterSplitionSolve(System.Func{System.Double,System.Double},System.Double,System.Double,System.Double,System.Double,System.Double,System.Func{System.Double,System.Boolean},System.Int32)">
@@ -165,7 +317,7 @@ Class BinarySolverUtil
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static IEnumerable&lt;BinarySolvingStatus&gt; CenterSplitionSolve(Func&lt;double, double&gt; func, double x0, double y0, double x1, double yTarget, double convergenceLimit, Func&lt;double, bool&gt; isYAcceptableFunc, int maxIteration = 12)</code></pre>
<pre><code class="lang-csharp hljs">public static IEnumerable&lt;BinarySolvingStatus&gt; CenterSplitionSolve(Func&lt;double, double&gt; func, double x0, double y0, double xBoundary, double yTarget, double convergenceLimit, Func&lt;double, bool&gt; isYAcceptableFunc, int maxIteration = 12)</code></pre>
</div>
<h4 class="section">Parameters</h4>
@@ -179,8 +331,8 @@ Class BinarySolverUtil
<dt><code>y0</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>Initial y value (func(x0))</p>
</dd>
<dt><code>x1</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>Second x value</p>
<dt><code>xBoundary</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>extended side boundary</p>
</dd>
<dt><code>yTarget</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>Target y value to solve for</p>