17 typedef complex<double>
Cd_t;
18 typedef valarray<double>
Vd_t;
26 D2.coef << 1.0, 0.0, 0.0;
30 valarray<double> anal_sol;
31 Eigen::VectorXd analSol(
N+1);
32 anal_sol = exp(-(atan(
y) + atan(1.0)));
33 cout <<
"Anal sol: \n";
34 for (
int i = 0; i <
N + 1; i++) {
35 cout << anal_sol[i] <<
"\n";
36 analSol[i] = anal_sol[i];
41 Lmat << D1 +
Vd_t(1.0 / (
pow(
y, 2.0) + 1.0)) * D0;
49 forc <<
Cd_t(0.0,0.0);
56 std::cout <<
"lbc: \n" << forc(-1.0) <<
'\n';
57 std::cout <<
"rbc: \n" << forc(1.0) <<
'\n';
58 std::cout <<
"error from analytical solution ";
59 double err = abs(
real(forc(0,0).v) - anal_sol).sum();
63 Eigen::MatrixXd outMat(
N+1,3);
64 outMat <<
yEigen,forc(0,0).evr(), analSol;
66 outfile.open(
"data/Ex_03.txt");
BcMat will hold general Boundary conditions as LinopMats at evealuation points, as given by operator ...
ChebfunMat< std::complex< T > > linSolve(const LinopMat< std::complex< T > > &Lmat_, const BcMat< std::complex< T > > &bcmat_, const ChebfunMat< std::complex< T > > &forc_)
Linear equation solver.
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > eval
Linop This class creates a Linear operator to solve TPBVPs.
Eigen::Matrix< SIS_TYPE, Eigen::Dynamic, Eigen::Dynamic > yEigen
This class represents a block matrix operator. It is a matrix of operators.
Eigen::Matrix< T, Eigen::Dynamic, 1 > coef
Stores the coefficients in the differential equation.
valarray< complex< T > > pow(valarray< complex< T > > base, T power)
int N
Specifies number of Chebyshev polynomials, default N = 31.
valarray< T > real(const valarray< complex< T > > &in)
real part of a complex valarray
std::valarray< SIS_TYPE > y(N+1)
This class holds a matrix of Chebfuns.
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > vals