# Tag Info

4

Ok, here comes the answer promised in the comment section. Let's start the other way round, going from a general grid to Gaussian grids and further constructions such as spectral elements. In grid methods, one basically selects a number of $N+1$ gridpoints $\{x_k\}_{k=0}^{N}$. As basis functions, one can use Lagrange polynomials constructed over these nodes, ...

4

from scipy.integrate import cumtrapz import numpy as np import matplotlib.pyplot as plt def f(x): return x*np.sin(1/x) if abs(x) > 1e-10 else x f = np.vectorize(f) X = np.arange(-0.5, .5, 0.001) fv = f(X) plt.plot(fv) F = cumtrapz(fv, x=X, initial=0) plt.plot(F);

2

If you insist on using quad, a more efficient implementation would calculate the integrals over the segments of the subdivision with quad for best accuracy and then a cumulative sum for the anti-derivative value at each sample point. def f(x): return x*np.sin(1/x) X = np.arange(-0.5,0.5,0.001) DF = [ integrate.quad(f,a,b)[0] for a,b in zip(X[:-1],X[1:])...

2

Since the $f_i(\theta,\phi)$ are linear combinations of spherical harmonics, we can write $$\mathbf{f} = F \mathbf{Y}$$ where $\mathbf{Y}$ is a vector of the orthonormalized spherical harmonics - i.e.: $$\int d\Omega Y_l^m Y_{l'}^{m'*} = \delta_{ll'} \delta_{mm'}$$ So the integral becomes,  \int d\Omega \mathbf{f}^{\dagger} (B^{\dagger} + B) \mathbf{f} ...

2

Welcome to SE! For growing x, your function converges to 1-norm.cdf(0), which is $1-0.5=0.5$. Consequently, the integral is indeed divergent, just like Python told you;)

1

Assuming $B$ is not angle-dependent, you know the coefficients of each $f_i$ a priori, and $\mathbf{f}$ can only be evaluated by summing up the spherical harmonics expansion, simplify your problem by making use of the orthogonality of spherical harmonics instead of numerically integrating. Let $f_i(\theta,\phi)=\sum_{lm}f_{i,lm}Y_l^m(\theta,\phi)$. Then your ...

1

You need to compute the projection $\Pi(f-cU_h)$ as a first step. This is a finite element field, so you can create a global field (in deal.II lingo: Create the corresponding finite element and a DoFHandler object) and compute it by global projection by inverting a mass matrix. Alternatively, because the field is discontinuous, you can also forgo the global ...

1

The compiler is telling you that he's not able to capture I. This is just a C++ issue. You can just have a look at what a lambda expression is. Basically, it's just a shorthand for a functor. As an example, consider the following: double phi = 2.0; auto capture_by_value = [] (double x) {return x + phi;}; std::cout << capture_by_value(2.0)<<"\...

1

Why you are saying this integral even with linear interpolation is going to be zero? Are you familiar with VTK library? Basically, it's the procedure to calculate your integral on your surface: Calculate $u_{xx}$ on each point or vertex by using vtkGradientFilter. Do the integration over the surface by using vtkIntegrateAttributes. It should work. You can ...

Only top voted, non community-wiki answers of a minimum length are eligible