instruction
stringlengths
43
28.1k
I wrote a finite element code in fortran 90. This code is really fast, except the meshing process. I used triangle and tetgen for meshing in 2D and 3D, respectively, so this process is fast, of course. For example, for the unit square [0,1]x[0,1] in 2D I have a file with the coordinates of its nodes (for example, a mes...
I am new to solving numerically ODES and thus it is difficult for me to judge the reliability/trustworthiness of the results that I have produced for the following problem: I am dealing with a 2nd order ODE (I can add a non-linear term to it, too) on the interval $[0,1]$ with regular singularity at $0$ and $1$. I conv...
I'm writing a VMC simulation for hydrogen and helium atoms, but in both my codes my variational energy for certain wavefunctions is not only statistically different from my expectation value, but it is also lower than my ground state energy. For the hydrogen atom, I know that the ground state energy is $-0.5Ha$. If I u...
I am solving following problem: Filtration of water can be described in bi-dimensional case by $$- \partial_x(K(x,y) \partial_x u ) - \partial_y (K(x,y) \partial_y u ) = 0, $$ where $u$ - water level $K$ - hydraulic conductivity On uniform mesh of $N$, $K$ is defined as \begin{align} K(x,y) & = \begin{cases} (x...
In Flow Science, they provide an example of boundary conditions and how to specify them for CFD simulations. The following is stated: Pressure Boundary Example For example, consider the problem of flow in a section of pipe. On the one hand, if the upstream end of the computational region coincides with the physica...
Let there is triangular mesh for a simple domain (domain is not important). If this mesh is not uniform (the mesh is produced by adaptive technique), what is the mesh size? Is there a mesh size for each triangle? or this is a number relate to the whole mesh on the domain? How do I compute it? Thank you,
I am implementing a MatLab program to solve the equation given in this paper, which involves solving integrals coming from the variational formulation of the problem. One of them is $$\int_{\partial \Omega} f\left(\sum_{i=1}^Nu_i\phi_i\right) \cdot \phi_j d\Omega$$ where $\phi_j$ is a function such that, in the node $(...
Is it possible to solve a quadratic cost function which is subject to both nonlinear (quadratic) & linear constriants by SQP methods? If not, what is the best iterative solution for this kind of problem? Thanks
For a multi-objective optimization task I want to use the DTLZ5, DTLZ6 and DTLZ7-problems definied by Deb et al. in their Paper "Scalable Multi-Objective Optimization Test Problems". There are multiple libraries which implemented these problems like Shark (C++), jMetal (Java), deap (Python) and pagmo (C++ and Python). ...
$X$ is a dense matrix of real doubles, typically of size 20 million rows and 500 columns, and $W$ is a diagonal matrix of real, non-negative doubles stored as a vector. I'm working in C and have looked at the documentation for BLAS but couldn't find a routine that seemed like a perfect fit for this. The machine has o...
I am making a Java function to calculate $\int_{0}^{\pi/2}x/sin(x) dx$ using Simpsons rule. When the function equals $0$ or $0/\sin(0)$ should I just add $1$ (limit) or $10^{-10}$ (limit). My professor said to use $10^{-10}$ why would this be? public static double simpsonsRuleFunction1(double valueN, double valueA, dou...
Consider a Laplace's equation with Dirichlet boundary condition: ${\nabla ^2}\Phi = 0$ in a domain $D$ with given Dirichlet Boundary condition: $\Phi=\Phi_o$ at $\partial D$ (smooth, but not analytic boundary) The problem is, that $\Phi_o$ is a periodic function and it changes depending on the position. For example, ...
I have a numerical discretization of a partial differential equation that seems to be unstable or stable at a boundary point, depending on what finite difference scheme I am using. Are there standard methods for investigating stability at boundaries? I only know of the von Neumann stability analysis, but that seems to ...
I have a system of ODEs which is (at least moderately) stiff. Consider the class of spectral collocation methods https://en.wikipedia.org/wiki/Spectral_method or the related class of weighted residual methods. Basically, take a system of ODEs like $$ y'(t) = f(t, y(t)) $$ where $f(\cdot,\cdot)$ is nonlinear in my case ...
I want to solve 7 coupled differential equations in MATLAB. I used the method of lines (MOL) to convert them to a system of DAEs. I then attempted to solve this system using ode15s. Unfortunately an error occurred that said: the index of equation is greater than 1. I searched and know I should reduce the index of equat...
Can the following 1D transient advection diffusion and corresponding initial and boundary conditions: $$ \frac{\partial c}{\partial t} + v\frac{\partial c}{\partial x} - D\frac{\partial^2 c}{\partial x^2} = f \quad\forall x\in(0,1) \\ c(x=0,t) = 0 \\ c(x=1,t) = 0 \\ c(x,t=0) = 0 $$ be solved such that we first move th...
I am a beginner in Computational science and FEM. I came across some PDEs which implement time dependent boundary conditions. I am not able to visualize exactly a physical scenario of how that would look or what it would mean with reference to a real problem. Say for example, a wave equation - where the waves are refle...
I very recently started to read up about magnetohydrodynamics (MHD). While I have experience in the fluid part (both theory and numerics), my knowledge about the magneto part is very limited. At the moment, I am working through the book by Davidson which is great for learning about physics. I decided that a good first ...
I need to have a better understanding about how to define ODE events. What I know is that if I have my ODE defined as [t,q,te,qe,ie] = ode45(odefun,tspan,q0(:,1),options); options = odeset('Events',@events); function [value,isterminal,direction] = events(t,q) value = ...; isterminal = ...; direction = ......
Are there BDF formulas like the ones given here but one that can be used with implicit-explicit discretization? The right hand side in those formulas is supposed to be implicitly discretized at the current time step. Can I, for instance, replace that slope with multistage Runge-Kutta approximation of the slope and expe...
I am trying to build my own simulator of Langevin Equation for the Brownian motion. According to this material. The way we calculate the particle position in certain time step is : W(u) is a Wiener process. x0, v0, tauB are all constant. My question is: How to write a c++ code for this Wiener process integral equation...
I can write a function to find LCM (lowest common multiple) of an array of integers, but I thought it must have been implemented in numpy or scipy and was expecting something like numpy.lcm() to do that. I'm surprised to find there is no such thing. Perhaps I'm searching in a wrong place. So, if you know any other libr...
I would like to code for a quadtree type meshing but don't know how to do. If anyone can help or can share any starting code?
I have a system of $N$ ODEs of the form, $$ M(z,F(z)) \cdot F'(z) = \Phi(z,F(z)) $$ where the mass matrix is $M(z,F): R\times R^N \to R^{N\times N}$ and $\Phi(z,F):R\times R^N \to R^N$ is (potentially) nonlinear. The initial condition is $F(0) = 0_N$. I need to solve this for an arbitrarily large $z$, but it is stati...
I am looking for a LAPACK routine that allows to find a non-trivial solution to the following equation: A x = 0 provided that A is a n×n square singular non-symmetric band matrix. In reality A matrix may not be exactly singular as it is based on some parameter and I use a root finding algorithm to find this parameter (...
I have to implement 'stress-free' boundary conditions for a stokes flow of a 2D-domain (for the left, bottom and right boundaries). The boundary condition are also described mathematically as $2 \eta \dot{\epsilon} = 0$. $\eta$ and $\dot{\epsilon}$ are the viscosity and strain rate. How do I implement such boundary con...
I am looking for a C/C++ implementation of the Hungarian method for solving the linear assignment problem with real-valued cost matrix. Some implementation I found, such as this one, only work for integer costs :( Any suggestions are very appreciated! Thank you in advance!
This is more of a mathematical question but since we deal with this all the time in computational science, maybe it is relevant in this forum too. I am an engineer and I am learning how to model the wave equation in Fenics. To obtain the fully discretised variational form in space and time, I have to implement a numeri...
I have the following system of equations obtained by implementing Sympletic Euler time scheme to wave equation. I want to model this in Fenics. Here 'u' is the displacement and 'p' is corresponding velocity. $$ \dot{u} = p $$ $$ u(x, 0) = u_i$$ $$ p(x, 0) = 0$$ $$ u(x, t) = 0 \quad \text{on} \quad \partial \Omega$$ I ...
So I have two versions of a hydrodynamic code that has the same underlying physics. Lets call them code A and B. However code B is more optimized and more object oriented. I was trying to compare the numerical results of both codes and see if they seem compatible. The way I'm doing this is running both codes with the s...
Let's say I am solving a simple Poisson problem using a Mixed (DG) finite element method. If we use orthogonal polynomials as basis functions we can write the finite-dimensional linear system as $$ \left\lbrack\begin{array}{cc}I_1& S_{11} \\ -S_{11}^\mathrm{T} \end{array} \right\rbrack \left\lbrack\begin{array}{c} q...
I'm working on an algorithm which should check if two polygons, described by their vertex coordinates, are: one inside the other, are intersecting or are separated image below describe this three cases: i'm thinking about how to do it but i'm not having any idea. Any suggestion? solved: i solved using Shamos-Hoey Algo...
MATLAB. I am trying to vectorize a loop in which each column vector of a 2D matrix (n-by-n) is found by multiplying each single element in a diagonal matrix with a column vector in another n-by-n 2D matrix. It seems like it would be simple to vectorize, but I must be missing something. I tried converting the diagonal...
Am solving a system of pdes in Fenics and need to write the variational form. Everything looks good expect a term like the following $$ \nabla \xi\nabla \cdot U $$ $\mathbf{U} = (U,V) $ is a vector function and $\xi$ is a scalar function in 2d. So I tried the following. Multiply by a vector function $p$ and integrate b...
I am interested to know the significance of the energy conservation laws when modelling fluids (or other materials). Am I correct in saying that if energy is conserved then stability is achieved. In a way, I need to know why it is important to show that energy is conserved when modelling different phenomena (which can...
I have data that I would like to fit with an ellipsoid and I am currently fitting it via the following Matlab commands: xs = pts(:,1); ys = pts(:,2); zs = pts(:,3); A0 = [xs.^2 ys.^2 zs.^2 xs.*ys ys.*zs xs.*zs xs ys zs ones(size(xs))]; B0 = [ones(size(xs))]; A = A0'*A0; B = A0'*B0; X = A\B; but I am going to rewrit...
I would like to calculate efficiency of parallel alghoritm, using the number of computations instead of time computations. In materials from my studies I have a formula like below: $$ \eta(n,p) = \frac{\omega(n)}{\omega(n)+h(n,p)} = \frac{1}{1+h(n,p)/\omega(n)}, $$ where $\eta(n, p)$ - efficiency of parallel program w...
I'm trying to solve the following first order hyperbolic PDE problem using method of lines: Hyperbolic Equation: $u_t = -u_x$ with initial condition: $u(0,x) = 0, 0 < x < 1$ boundary condition: $u(t,0) = 1, t \ge 1$ The solution should be a step function to the right with velocity $1$. I'm using centered finite diffe...
I'm trying to solve the following PDE wave equation using method of lines: Wave Equation: u_tt = u_xx with initial condition: u(0,x) = sin*pi,u_t(0,x)=0, 0 < x < 1 boundary condition: u(t,0) = 0, u(t,1) = 0, t >= 1 Edited: deleted the old code and will be posting a new one soon. :)
I have some data: number of nodes $N$ and error in energy norm corresponing to it. I have seen in some references that the rate of convergence is reported by $$\| u-u_h\| _E=CN^{\alpha} $$ How can I find $C$ and $\alpha$ by MATLAB, I tried by : polyfit $(N,\| u-u_h\| _E,1)$ But the answer was not true. How can I find ...
Consider a $GF(2^n)$ field, a $GF(2^k)$ galois fields, where $n=k \times m$ and $GF(2^k)$ is a ground field of $GF(2^n)$. I’d appreciate pointers to papers or suggestions on: How to find $\log(a)$ and $\exp(a)$ where $a$ is in $GF(2^n)$ given $\log/\exp$ look-up tables of $GF(2^k)$? How to convert the values between $...
tl;dr Should I store a matrix of Nx3 elements row-wise or column-wise, if I'm going to access 3 elements at a time? Does it matter? I'm setting up a numerical simulation with matrices of x,y,z positions in 3 dimensions, and I wonder whether it's better to store them row-wise or column-wise in R, Matlab, and Armadillo (...
I have a large number of systems of the form: $$A_ix=b,$$ where each $A_i,i>0$ is a rank one update of $A_{i-1}$ and the $A_i$ are dense matrices. I was wondering whether it is possible to use the classical LU algorithm to solve these (rank one updated) versions of the initial problem more efficiently? P.S. Right n...
For integration of polynomials, the number of qradrature points can be determined easily according to the $(2N-1)$ rule. While in most cases, it's not necessary to use Gaussian quadrature for simple polynomials since they can be calculated analytically, what we encounter in reality are generally complex integrands, suc...
I have a set of data to which I want to apply a weighting function, so basically a simple multiplication. My sampled data looks like this: (for those interested, it's the relative luminous intensity of an LED) The weighting function is only available in a tabular form as well, and looks like this: (it's the standard ...
I have a problem of allocating x between p entities, each entity has a constant $\rho_i$ such that the allocated part should be proportionnal. Without loss of generality we can divide the ressources by x and normalise the $\rho_i$ by $\Sigma_i\rho_i$ to see the unconstrained problem has a simple solution: $$x_i = n \f...
I have been doing much research on the internet to see if there was a FEM simulator that natively implemented the Jiles-Artherton model whether it be commercial or open source So far, my conclusion is that there is none. Before I make a final verdict though, I would like to check with the community that this statement ...
We consider the problem $\left\{\begin{matrix} k(x)\Delta u(x)=f(x) & \text{ in } \Omega\\ u=0 & \text{ in } \Gamma \end{matrix}\right.$ where $\Omega \subset \mathbb{R}^2$ open and bounded with smooth boundary $\Gamma=\partial{\Omega}$ and $k(x) \geq a, \forall x \in \Omega$. We consider that $\Omega= \Omega_1 \cup ...
Suppose I have the discrete values $f(x_i)$ for every discrete value $x_i$ greater than some $\varepsilon$, and I want to numerically calculate the following integral: \begin{equation} n = \int_\varepsilon^\infty f(x)Z(x)dx \end{equation} with the known function $Z(x)$. We can approximate $f(x)=f(x_i)$ for $x\in[x_{i-...
I have the following question: Suppose I have two matrices $X, Y$ both of size $m\times p$ and a random i.i.d Gaussian matrix $G$ of size $m \times k$, $m\gg p>k$. Is there a fast way to compute $\exp(-XY^T)G$? Perhaps by using the fact that both $X$ and $Y$ are much smaller than $XY^T$? Here, $\exp(\cdot)$ means entry...
I'm trying to write a class that uses Newton's law of Gravitation to work out the field of a planet. I've tested my code by inputting values for Earth, for purely vertical motion, so I should get g = -9.8 and I don't. I have a class I can use that does every imaginable operation on vectors, called PhysicsVector. I've ...
I am looking at Trefethen and Bau Exercise 37.1: I have two normalizations of the Legendre polynomials with corresponding recurrence relations: $$P_n(1)=1$$ which follows $$P_n(x) = \frac{2n-1}{n} x P_{n-1}(x) -\frac{n-1}{n}P_{n-2}(x)$$ and $$\|q_n\|=1$$ which follows $$xq_n(x)=\beta_{n-1}q_{n-1}(x)+\alpha_n q_n(x) + \...
How can I get Gauss-Lobatto points on a quadrilateral or a triangle in $x$-$y$ plane? I am only getting abscissa coordinates and weights by solving Lobatto polynomials using Lobatto quadrature. Please suggest a method to get the $x$-$y$ coordinates
I have an optimization problem with linear objective, and constraints that are all linear except for one constraint of the form $S^2+C^2=1$, which corresponds to elements in a rotation matrix. What are effective ways to solve this? I have never tried sequential linear programming, but is that appropriate here?
I am struggling with convergence criteria when performing a Monte carlo simulation on a uniform distribution. Any help would be much appreciated ! Say I want to sample uniformly a 1D interval (for the sake of simplicity). I use a random number generator (in Fortran) to draw X values between 0 and 1. Then, how do i choo...
Let's say we want to solve for the eigen-values of a symmetric matrix of size $n$ x $n$. In the Phase 1 of the computation, the matrix is reduced to a tridigonal form using Householder/Arnoldi's reduction.The theory says that this is $O(n^3)$. In the Phase 2 of the computation, this tridigonal form is transformed to a...
I am trying to solve linear equations in c++ using the Eigen library. For the simple equation Ax=b, I have a sparse matrix A that is n x n, and known values for b which is n x 1, but I need to find the values for x. I tried using x = A.colPivHouseholderQr().solve(b); but this solves it for a dense matrix and since ...
I need to know whether my idea for my final year project could be achieved or not. If its achievable please guide me with the relevant language and other frameworks. The idea I have a piece of paper (A4) on which I draw a circle. Once it is drawn I need to calculate the area and perimeter. In order to calculate the are...
I understand what Neumann BC means physically and how to imply them. However, I am not able to perfectly understand it the way it is represented mathematically as $\partial u / \partial n$ where $n$ is the outward normal vector to the boundary and $u$ is the solution. I understand that the normal vector is essential f...
I am working on a task for which the object oriented (OO) approach fits well. I am doing it in MATLAB, since I am in the prototyping phase. However, I know that later I will surely have to perform larger scale computations (my university has a cluster). On method is to use mex functions for the computational heavy part...
I am trying to model the seismic wave equation and have therefore been reading about discretization schemes and their stability. I recently came across an insightful paper on 'Galerkin FEM methods for wave equation' http://www.math.tamu.edu/~bangerth/publications/2010-waves.pdf. In this document and many other document...
I have my 3 dimensional velocity flow-field u, v and w at a given instant of time from DNS using pseudo-spectral method. I need to calculate the energy spectrum ( in Fourier space ) as a function of magnitude of wave-number, i.e. $E(k)$ as a function of $k$. The equation for energy spectrum I used is as follows: $$ E(k...
I tried to discretize an image into black and white and came into some difficult. The difference between the letters and paper is pretty clear to our eyes: However a simple thresholding trick doesn't work. Here we move everything below 0.4 intensity to 0 and everything above 0.4 to 1: Now let's try moving the thres...
Consider a thermo-mechanical coupled problem, where coupling exists from both the sides, mechanical loading producing thermal effects and vice versa. In such a case, is it necessary to always prescribe a thermal boundary condition along with a mechanical boundary condition on the same boundary for the problem to give v...
I've been working on this code for some hours and it seems I'm doing something wrong which I just can't figure out. I have a function which I integrate and then plot it's values. But the graph I get looks strange. I expected some form of an exponential function but the one I get is far away from my anticipations, and w...
If cardinal basis functions are used (i.e. $\psi_{ij}=1$ iff $i=j$, and 0 otherwise) in interior penalty methods for elliptic equations such as SIPG & NIPG, shoudn't the jump in basis functions when computing surface integrals be [$\psi$] = 0 ? If that is the case the second term (consistency term) is always zero, righ...
When reading literatures about finite element method, the term "hanging nodes" can often be encountered. Could anyone tell me what indeed is a hanging node?
When learning the deal.II FE library, I am a bit confused about the mechanism of its "SparsityPattern" class. Through reading the documentation, I only got to know that it uses the Compressed Row Storage format to store indices of nonzero entries of a sparse matrix. To put my confusion be explicit, suppose I have a qu...
I have written a code in which I find the approximation of the solution of this elliptic problem. I calculated the error using the following part of code: http://pastebin.com/7b5mmuRW but I get the following errors for $a=-1, b=1, k_1=k_2=1$ : For N=10: er = 9.9920e-016 For N=20: er = 2.4425e-015 For N=30: er = 7.1054...
We're currently using a Chirp-Z based implementation: R. W. Cox and R. Tong, "Two- and three-dimensional image rotation using the FFT," IEEE Trans. Image Processing, vol. 8, no. 9, pp. 1297–1299, Sep. 1999 for rotation of astronomical images. I was wondering if there were any algorithms/implementations out there that...
I'm tryin' to implement this method with python3 but i don't solve the problem. This is my code: #!/usr/bin/python # -*- coding: utf-8 -*- import sympy import numpy as np x = sympy.symbols('x') expr = x ** 2 - 2 fx = sympy.lambdify(x, expr, 'numpy') def quad_inv(f, x0, x1, x2, tol, maxiter): fx0 = f(x0) f...
I am looking at the LAPACK DPOSV routine that computes the solution to the real system of linear equations A * X = B. The routine description can be found here: http://www.math.utah.edu/software/lapack/lapack-d/dposv.html How many floating point operations (flops) would a call to this routine take? What is the algorith...
The acoustic wave equation in 2D is $$\frac{\partial^2}{\partial t^2}p(x,z,t) = c(x,z)^2\left[\frac{\partial^2}{\partial x^2}p(x,z,t) + \frac{\partial^2}{\partial z^2}p(x,z,t)\right] + s(x,z,t) \enspace .$$ Can anyone please give an analytical solution to the above, not worrying about the boundary conditions (assuming ...
This question was previously posted to Math.SE here and had received no answers at the time of this posting. When performing computational work, I often come across a univariate function, defined in terms of an integral or differential equation, which I would like to rapidly evaluate (say, millions of times per secon...
I want to solve approximately the following variational problem: Given a function $c:[-1,1]^2\rightarrow [0,1]$, constants $p_1...p_n\in \mathbb{R}^+$, $\alpha_1...\alpha_n\in \mathbb{R}$, and $\beta_1...\beta_n\in \mathbb{R}$ let $$V =\sup_{f_i,g_i}\left\{\sum_{i=1}^n \;\;p_i\cdot \int_0^1\int_0^1 f_i(x,y)\cdot g_i...
I have a eulerian hydrodynamic code, which I have recently implemented the Coriolis force in the integrator. Is there a standard test problem for the Coriolis force? Since this isn't a Lagrangian code there is no tracking of fluid particles. Right now I am thinking about periodic boundary conditions and setting the ent...
I have a system of linear equations that is derived partially from experimental data. Theoretically, the system should have a single, exact solution; however, experimental error causes it to not have an exact solution. Is there a good method to find an approximate solution to this system? My idea for a naive implementa...
Double-precision calculations are significantly slower or more expensive than single-precision calculations. For example, the NVidia Tesla which performs well on doubles is much more expensive then regular GPU. At the same time I do not know about machine learning cases where double-precision is really needed. Current...
I am having problems understanding the boundary conditions of the problem described in this paper on researchgate Essentially the problem consists of a one dimensional fluid chamber in contact with a piston on the right hand side. The problem makes use of the ALE mesh moving technique. The ALE is moved in such a way th...
Given a matrix $M\in\mathbb{R}^{P\times P}$ , is it possible to sample $P$ vectors $u_i\in\mathbb{R}^N$, $i=1..P$ so that $\|u_i-u_j\|=M_{ij}$. Obviously for not any $M$ this is possible, i.e. it has to be symmetric, have zero diagonal, etc., but assume $M$ was created from a different set of vectors which satisfied th...
This question is not homework it is recommended exercises to prepare for the final exam. Consider the family of linear one-step methods defined by $$y_n = y_{n-1} + h(\theta f_n + (1 - \theta)f_{n-1})$$ where $0\leq \theta \leq 1$. 2) For what values of $\theta$ in the interval $0\leq \theta \leq 1$ is the associated ...
I have to invert large, but densely populated matrices with higher precision arithmetic. Therefore I am looking for something like the PLASMA library, which can do Cholesky or LU factorization in parallel on shared memory machines. Unfortunately it does support only classical float or double arithmetic. Therefore I am ...
The basis of Molecular Dynamics simulation is the integration of newton's equations of motion: $$\frac{F}{m} = \frac{d^2r}{dt^2}$$ I understand that there are various methods based on Taylor's expansion, to integrate forward in time and calculate the new position. Doing this always leaves an error term in the expansion...
I need to store large sparse matrices in Eigen. I cannot find anything in the library except the function below, in Eigen/Unsupported. The problem with saveMarket is, that it saves in text format. Due to the size of my matrices I need to store my sparse matrices as binaries. Is there an easy way to adjust the function ...
I know that FVM is based on the integral form of conservation laws, and FDS is based on PDEs. What I'm confused by, is whether FEM and DGFEM formulations are based on integral or pde form of conservation laws. I have developed FEM formulations starting from integral form of transport equations but I've also found lite...
Let $x \in R^N$. From a Spectral Chebyshev collocation method, I have a system of quadratic and linear equations. Denote them, $$ x^T Q_i x + L_i^T x = 0 $$ and $$ A x = 0 $$ Furthermore, I know the solution will fulfill $$ B x \geq 0 $$ for $Q_i \in R^{N \times N}, L_i \in R^{N}, A\in R^{M \times N}, B\in R^{S\time...
This is a question about the computer algebra system Magma. I have been looking for a place to ask this type of question on the SE network and scicomp.SE was suggested to me; hopefully it finds a home here. Suppose one has constructed a polynomial algebra $A$ over a ring $R$ in Magma. How does one construct the sub-$R...
Is there an overview available over tensor visualization software? My personal preference is: A software which is free, well documented, and offers visualization techniques for different physical second order (or higher-order) tensor fields. Some modules that I would be interested in Hyperstreamlines (eigenvector inte...
In FEM classes, it's usually taken for granted that the stiffness matrix is positive definite, but I just can't understand why. Could anyone give some explanation? For instance, we can consider the Poisson problem: $$ -\nabla^2 u = f,$$ whose stiffness matrix is: $$K_{ij} = \int_\Omega\nabla\varphi_i\cdot\nabla\varphi_...
Say I have a set of oriented points at locations $\vec{v_i}$ with each some direction $\vec{n_i}$, in practice they represent the normals of some surface that has been non uniformly sampled. How would I calculate the divergence of this vector field? Standard finite-difference methods would obviously not work because th...
I understand the checkerboard effect due to the use of collocated grid arrangements in FVM. However, I wanted to know whether this problem is definitely bound to effect the results? For instance, I have modelled some problems on 1D structured grids with a collocated arrangement and have produced smooth results. Perhaps...
I am trying to numerically resolve the equation for an Euler-Bernoulli beam that is inextensible, unshearable, and subject to planar deformations: $$\rho I(s) \frac{\partial^2 \theta}{\partial t^2}(s,t) = E \frac{\partial}{\partial s} \left[I(s) \left( \frac{\partial \theta}{\partial s}(s,t) - \kappa_p(s,\theta,t) \ri...
I'm trying to solve the following first order parabolic partial differential equation, \begin{equation*} X \frac{\partial V}{ \partial Q} = -\frac{1}{2} \sigma^2 \frac{\partial^2 V}{\partial X^2} + rV + p \min (X, 0) \end{equation*} subject to conditions \begin{equation*} \begin{split} V &= 0 \hspace{27pt} \text{as} ...
suppose you have this bayesian network: p(a,b,c) = p(c|b) p(b|a) p(a) a -> b -> c are a and c conditionally independent given b? If yes, why are they independent? How can I show that?
I am solving the convection-diffusion equation in 2D using Finite Differences with the $\theta$ scheme. The velocity of the fluid and the diffusion coefficient is low in my case (in the range of $10^{-15}$). The boundary conditions are: open boundary on two sides (Robin boundary), and Dirichlet boundary $u=0$ on the ot...
I'm trying to model the Black-Scholes Equation (transformed into a heat equation) using method of lines in Python. The transformed formula is basically \begin{equation*} \frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} + (k-1)\frac{\partial u}{\partial x} - ku \end{equation*} where $k$ is a constant a...
I am writing a FMM (Fast Multipole Method) algorithm in 3D. I generated the mesh and, currently, I am developing the expansion and the three (M2M, M2L, L2L) translation operators using spherical harmonics. See reference [1], more specifically, these equations are taken from equation numbers 3.36, 3.37, 3.55, 3.56, 3.57...
I know that in FVM, it is possible to show that a discretisation scheme is conservative by adding the discrete terms over a few control volumes and showing that all terms cancel apart from those relating to the flux in and out of the entire domain. I'm not sure what happens in FEM? My thoughts are: for instance for a ...
I have a question about the calculation of center of mass (COM) in systems with periodic boundary conditions. There is a method introduced here: https://en.wikipedia.org/wiki/Center_of_mass#Systems_with_periodic_boundary_conditions But by this method the COM can't be calculated properly, see the image bellow, because t...
I'm working on the Black-Scholes equation, but I'm pretty new to financial modeling. Right now, I am trying to understand the Black-Scholes PDE. I understand that the Black-Scholes equation is given by \begin{equation*} \frac{\partial C}{\partial t} + \frac{1}{2}\sigma^2 S^2\frac{\partial^2 C}{\partial S^2} + rS \frac{...