#include "headcpp.h" #include "math.h" #include "tbl.h" #include "matrice.h" #include "cheby.h" double f_left (double) { return 1. ; } double f_right (double) { return 0. ; } double f_source (double x) { if (x<0) return 1. ; else if (x>0) return 0. ; else return 0.5 ; } double f_solution (double x) { double ee = exp(1.) ; static double bmoins = -1./8./(1+ee*ee) - ee*ee/8./(1+ee*ee*ee*ee) ; static double bplus = ee*ee*ee*ee/8.*(ee*ee/(1+ee*ee*ee*ee)-1./(1+ee*ee)) ; if (x<0) return 0.25 -(ee*ee/4.+bmoins*ee*ee*ee*ee)*exp(2*x) + bmoins*exp(-2*x) ; else return bplus*(exp(-2*x)-exp(2*x)/ee/ee/ee/ee) ; } //******************* // First derivative //******************* Tbl ope_der (const Tbl& so) { // Verification of size : assert (so.get_ndim() == 1) ; int size = so.get_dim(0) ; // The result is set to zero Tbl res (size) ; res.annule_hard() ; // the computation for (int n=0 ; n> nr ; cout << "The operator matrix is " << endl ; Matrice operator_mat (multi_ope(nr)) ; cout << operator_mat << endl ; // Resolution with a tau method : Matrice systeme(nr*2, nr*2) ; systeme.annule_hard() ; // Boundary conditions are inforced by additional equations: // Left boundary condition : for (int i=0 ; i error_max) error_max = error ; x += step ; } cout << "Error max : " << endl ; cout << error_max << endl ; return 0 ; }