@@ -204,54 +204,6 @@ Console.WriteLine($" [{hessian[1,0]:F4}, {hessian[1,1]:F4}]");
204204```
205205
206206---
207-
208- ## Partial Derivatives
209-
210- ### Single Partial Derivative
211-
212- ``` cs
213- Func < double [], double > f = x => x [0 ]* x [0 ]* x [1 ] + Math .Sin (x [1 ]);
214- double [] point = { 2 . 0 , Math .PI / 4 };
215-
216- // ∂f/∂x₀
217- double partial0 = NumericalDerivative .PartialDerivative (f , point , variableIndex : 0 );
218-
219- // ∂f/∂x₁
220- double partial1 = NumericalDerivative .PartialDerivative (f , point , variableIndex : 1 );
221-
222- Console .WriteLine ($" ∂f/∂x₀ = {partial0 : F6 }" ); // 2x₀x₁
223- Console .WriteLine ($" ∂f/∂x₁ = {partial1 : F6 }" ); // x₀² + cos(x₁)
224- ```
225-
226- ### Mixed Partial Derivatives
227-
228- ``` cs
229- // ∂²f/∂x₀∂x₁
230- double mixed = NumericalDerivative .MixedPartialDerivative (f , point , 0 , 1 );
231- Console .WriteLine ($" ∂²f/∂x₀∂x₁ = {mixed : F6 }" ); // 2x₀
232- ```
233-
234- ---
235-
236- ## Directional Derivative
237-
238- The derivative of $f$ in direction $\mathbf{v}$:
239-
240- ``` math
241- D_\mathbf{v}f = \nabla f \cdot \frac{\mathbf{v}}{|\mathbf{v}|}
242- ```
243-
244- ``` cs
245- Func < double [], double > f = x => x [0 ]* x [0 ] + x [1 ]* x [1 ];
246- double [] point = { 1 . 0 , 1 . 0 };
247- double [] direction = { 1 . 0 , 1 . 0 };
248-
249- double directional = NumericalDerivative .DirectionalDerivative (f , point , direction );
250- Console .WriteLine ($" Directional derivative: {directional : F6 }" );
251- ```
252-
253- ---
254-
255207## Error Analysis
256208
257209### Truncation Error
@@ -298,32 +250,6 @@ Typical output shows error decreasing until ~1e-8, then increasing due to roundo
298250
299251---
300252
301- ## Higher-Order Formulas
302-
303- ### Five-Point Stencil (First Derivative)
304-
305- Fourth-order accurate:
306-
307- ``` math
308- f'(x) \approx \frac{-f(x+2h) + 8f(x+h) - 8f(x-h) + f(x-2h)}{12h}
309- ```
310-
311- ``` cs
312- double fivePoint = NumericalDerivative .FivePointStencil (f , x , h );
313- ```
314-
315- ### Five-Point Stencil (Second Derivative)
316-
317- ``` math
318- f''(x) \approx \frac{-f(x+2h) + 16f(x+h) - 30f(x) + 16f(x-h) - f(x-2h)}{12h^2}
319- ```
320-
321- ``` cs
322- double secondFivePoint = NumericalDerivative .FivePointSecondDerivative (f , x , h );
323- ```
324-
325- ---
326-
327253## Applications
328254
329255### Sensitivity Analysis
0 commit comments