|
|
// Dokumentation // kdoc -p -d bsp_20 bsp_20_fkt.hpp // kdoc -p -d tex_bsp_20 -f latex bsp_20_fkt.hpp #ifndef BSP_20_FKT #define BSP_20_FKT /** The functions for examples 20, 21, 22 @short The functions for examples 20, 21, 22 @author Gundolf Haase @version SS07 */ // Funktionen aus Aufgabe 20 // Riemann-Integration /** Calculates the integral value.of a 1D-function by the Riemann formula @param func function func(x) to integrate @param a interval [a,b] @param b interval [a,b] @param n number of subintervals of [a,b] @return integral f(x) from a to b */ double riemann( double (* const func)(double), const double &a, const double &b, const int n); // Differenzieren /** Calculates the first derivative f'(x) of a 1D-function by the finite difference. @param func function func(x) to differentiate @param x point for evaluation @param h distance from x in the finite difference formula @return f'(x) */ double derivative( double (* const func)(double), const double &x, const double &h); // Funktionen aus Aufgabe 21 // Riemann-Integration (hier klappt Overloading da 4. Parameter anders) /** Calculates the integral value.of a 1D-function for a given accuracy by the Riemann formula @param func function func(x) to integrate @param a interval [a,b] @param b interval [a,b] @param eps absolute numerical accuracy @return integral f(x) from a to b */ double riemann( double (* const func)(double), const double &a, const double &b, const double eps=1e-4); // Differenzieren (andere Funktionsname, da alle Parameter gleich sind // und die Parameterliste nicht umgestellt wurde) /** Calculates the first derivative f'(x) of a 1D-function with a given accuracy by the finite difference. @param func function func(x) to differentiate @param x point for evaluation @param eps absolute numerical accuracy @return f'(x) */ double derivative2( double (* const func)(double), const double &x, const double eps=1e-4); // Newton solver fuer func(x) mit x aus [a,b] /** Solves the equation f(x)=0 in the interval [a,b] with the Newton iteration using the finite difference to approximate the needed first derivative. Calculates the first derivative f'(x) of a 1D-function with a given accuracy by the finite difference. @param func 1D-function func(x) @param a interval [a,b] @param b interval [a,b] @param eps absolute numerical accuracy @return one root of func(x) in the given interval */ double newton_diff_approx ( double (* const func)(double), const double &a, const double &b, const double eps=1e-4); #endif
Generated by: ghaase on mephisto on Thu May 24 08:44:56 2007, using kdoc 2.0a54. |