instruction
stringlengths
43
28.1k
I have a plant that can be modeled with nonlinear equations as $$f(x,u,p)=0$$ where $x$ is the state vector, $u$ the control vector, and $p$ the model parameters. In order to control this system, I compute the discrete state-space model $$x_{k+1}=A_p x_k+B_p u_k$$ where $A_p$ and $B_p$ depend on the parameters $p$. No...
So far what I understand is that two neighbouring elements are conformal if their edges and faces match exactly, whereas with non-conformal elements this is not the case. For instance, h-refinement gives rise to hanging nodes, and h-nonconforming elements. But then there is the concept of p-nonconforming. Note sure, bu...
Suppose that we are given a numerical scheme. In order to find the CFL condition , we set $U_j^n= \lambda ^ne^{ik x_j}$ and put it into the numerical scheme. I have shown that the given method is unstable since $|\lambda|>1$. In this case, how do we calculate the CFL condition? I get $| \lambda |= \sqrt{1+\gamma^2 \nu...
I am trying to compute (in C) a sum like $S = \sum_i \exp( - a_i )$, where $10^{4} < a_i < 10^{5}$ are approximately normal distributed. So even if I do the Log-Sum-Exp trick $S = \exp(\log[\sum_i \exp( - a_i + K )] - K)$, with $K = \min_i(a_i)$, I have exponents of order $-10^5$. That means that almost every term v...
I'm currently working with "A Multigrid Tutorial" by Briggs et al, Chapter 8. The construction of the interpolation operator is given as: Then construction of restriction operator and fine grid operator are given as: Let's assume we have three grid points x0, x1, x2 with the middle one x1 is fine and the others are c...
I have the function of an electric dipole expressed in cartesian coordinates and I want to create the vector field using Matlab . The function is $$E_z= \frac{p}{4\pi\epsilon_0} \cdot \left(\frac{3z^2}{r^5}- \frac{1}{r^3}\right) $$ and $$E_x=\frac{p}{4\pi\epsilon_0} \frac{3xz}{r^5}\;. $$ . The code I've come up wi...
I have 4 ordinary differential equations that are coupled. The variables in the 4 equations are functions of time and space and one of them is second order in space. \begin{equation} \frac{ \partial t_g}{ \partial t} = \frac {hp(t_m-tg)}{A(\rho_gCp_g)}- u\frac { \partial t_g}{ \partial x} \end{equation} \begin{equat...
The problem I want to solve is the displacement formulation of the linear elasticity : $$ \nabla \cdot \sigma = 0 \quad \text{in} \quad \Omega \\ \sigma = \lambda ( \nabla \cdot u ) I + \mu (\nabla \cdot u + \nabla \cdot u^t) \quad \text{in} \quad \Omega \\ u = 0 \quad \text{over} \quad \Gamma_D \\ \sigma \cdot n = ...
Any differential operator can be written as a finite difference matrix acting on a vector of values. I recently used it to solve $\Delta A = j$ by writing the Laplacian as a finite difference tridiagonal (second order approximation) matrix. I then used SciPy's spsolve, which solves matrix equations of the form $Ax=b$ b...
Are there libraries for conducting parallel AMR on an unstructured grid ? For a finite volume code, polyhedral cells with arbitrarily shaped faces are as easy to handle as hexahedra, and infact maybe better for AMR because one doesn't have to do anything special for the refined grid. Due to the lack of libraries, I a...
Now I need to sum up more than one thousands of terms and then make the four-dimmensional integral in my Fortran program. I found that there are some numerical errors. Can you give me some suggestions that how to check and avoid the possible round-off errors for this kind of general problem ?
I'm working on a small fun project on the side for a numerical method I've been working a bit with. Roughly, the computational problem I have to solve is the following: Assume you have a collection of $N$ points, call this collection $X$. For each $x_i \in X$, the following steps occur: 1: Find $k$ nearest neighbors to...
I am in the process of implementing adaptive mesh refinement for a finite element code that solves the Poisson equation. I have had some trouble finding good references on deciding which elements to refine. I have come across the Kelly error estimator from the deal.ii library: \begin{equation} \eta^{2} = \Sigma_{F\ep...
Short version I'm computing the zero-order Hankel transform of a function $f(r)$, $$F(k) = \int_0^\infty f(r)J_0(kr)r\,\mathrm{d}r$$ I know $f(r_n)$ at selected $r_n$ but it is impractical to compute $f$ at additional values of $r$. I need the transformed function $F(k)$ to have the best possible accuracy at large valu...
I've been given a second-order non-linear ODE: $$\frac{d^{2}\theta(s)}{ds^{2}} = sf_{g}\cos{\theta} + sf_{x}\cos{\phi}\sin{\theta}$$ where $f_{g}, f_{x}$ and $\phi$ are constants. The boundary conditions for $[0,L]$ are: $\frac{d\theta}{ds}\Big|_{s=0} = 0 $ $\theta (L) = \theta_L$ I will be repeating this numerous ti...
I am considering using petsc4py instead of scipy.integrate.odeint (which is a wrapper for Fortran solvers) for a problem involving the solution of a system of ODEs. The problem has the potential to be stiff. Writing down its Jacobian is very hard. So far, I have been able to produce reasonable speed gains by writing th...
In a parallel MPI code, I have load balancing issues. My 2D computational domain is distributed on a 2D MPI Cartesian topology, which leads to equal sized 2D sub-domains per MPI process. However, the amount of work to do per domain is determined by the number of "compute points" belonging to each domain. And the densit...
I'm working on a computational physics assignment and I was looking for some help as I've got stuck! The question is: Write a function to create the finite-difference approximation of the 2nd derivative operator matrix for a staggered grid. Given the inputs $N$ (the size of the matrix) and $\delta x$ (the grid spacing...
Given the functional $J_A(y,u) = \frac{1}{2}||y-y_d||^2_{L^2(w,\omega)} + \frac{\lambda}{2}||u||^2_{L^2(w^{-1}, \omega)}$ where w is a function belongs to Muckenhoupt class. Given the optimization problem: min $J_A$ subject to -$div(A\triangledown{y}) = u$ in $\omega$. Assume matrix $A$ satisfies these inequalities fo...
As an example for an ODE course I used the ODE $$ y' = \frac{y}{x} + \frac{1}{\cos(\tfrac{y}{x})} $$ to illustrate domains of existence. Standard substitution $z=y/x$ turns the equation to $$ z' = \frac{1}{x\cos(z)} $$ which can be solved by separation of variables to obtain the solution $$ \phi(x) = x\arcsin(\ln(x/x_0...
I like to set my scientific simulation programs to generate a picture after a certain number of iterations, such that I can follow what is happening and maybe cancel the simulation before the initially planned iteration. The periodicity of the pictures must be such that they don't affect performance too much. Sometimes...
I have some values imported from excel about the annual sell of a product, with 3 var: month, price, sold items I have seen how to plot a chart using curve fitting tool but I need to define a math expression that can describe the relation between these variables. How can I do this in matlab? Is there any tool that...
I have to use the LANL2DZpd basis set. It can be obtained from EMSL Basis Set Exchange. But trying to calculate simple Me2Se molecule : %chk=test.chk %NProcShared=12 %mem=64300MB # B3lyp/gen pseudo=read opt freq scale=0.9806 Freq NMR=GIAO pop=(Full) Me2Se 0 1 6 0.000000000 1.497766000 -0.847272000...
I have: 1) The dark image with few groups of high-brightness pixels and some amount of noise around it. 2) Number of clusters. Example: 1) 2) 2 clusters And i need find centers of bright pixel groups. Centers, in that case, should be placed like this: Question: Which clustering alghoritm is suitable for this task?...
I have a matrix P of m rows and n columns. P(i,j) contains the price of occupying position i at time j. I want to plot this in Matlab but in a way to get some kind of density plot with different price levels corresponding to different colors. An example of the output would be something like this:
is there a way to add a user defined convergence criteria to an ode solver so that the solution is stopped? I know that Matlab uses absolute and relative tolerances but would that suffice in solving CFD equations or is a user-defined criteria needed? Thank you.
I'm looking for an implementation of the ellipsoid algorithm for linear programming since the application I have in mind has the constraints represented as a separation oracle. Is such an implementation available anywhere? If there isn't, is there maybe an implementation of the interior point method that works with a s...
Assume I have an expression for an matrix initialization, for example the following: A[i,i-2*j+k] = B[i-k] * C[i] * D[i+j+k] In order to execute such a process, I could loop over all i, j and k. The problem is that loops are slow in python, compared to e.g. loops in C. Is there some way to use compiled packages for op...
I have been experimenting in building a C++ project for a FDTDS system for Electro-Magnetics. I have implemented a class [see below] which I called mesh using the Armadillo library. The 3D matrices {Cubes} for the fields Ex, Ey, Ez, Hx, Hy, Hz are declared as private members of the class. The size of these 3D Matrice...
I have the following system of PDEs for which I have given parameters $\gamma, \tau$ and $\mu$, $$\begin{align} T_t = &\ \gamma\,(L +\tau F-T)\\ F_t = & -F_x-(F-LT)\\ L_t = &\ \mu L_{xx}+(F-LT)\end{align}$$ with no-flux boundary conditions at $x=0$ and $x=\infty$ for $F$ and $L$. The initial conditions are $L=T=F=e^{-...
I have a python code that calculates the solution of the inhomogeneous acoustic wave equation for a 2D medium with any velocity and source configuration. It was implemented using Finite Differences from the following set of equations: $$ \rho( \mathbf{r}) \mathbf{\nabla} \cdot \left( \frac{1}{\rho (\mathbf{r})} \mathb...
Does the order of accuracy of a combination of schemes applied to solve a system of non-linear equations, match those of the same schemes applied to the linearised version of the system? In other words, does linearisation alter the order of accuracy of a scheme?
I have written a sparse quadrature routine to integrate multidimensional Gaussian integrals. I'm trying to show convergence plots in my thesis and demonstrate that the code works correctly. I am in the process of benchmarking this using multidimensional integrals with closed forms. With normal numerical schemes one wou...
I want to frame a higher order Central difference scheme of about $20^{th}$ order for first derivative. I'm using $20^{th}$ order because I need one scheme with good modified wave number. To find the co-efficient matrix (eg. for CD-2 it is [-1/2,1/2]), I have to solve $Ax=b$ equation. $x=A^{-1}*b$. I tried to solve tha...
I have two data sets that are quasi-periodic. They have the same period and can be seen clearly by eye. For example when $x\in(100,200)$, both of them have about 32 periods. Below is a zoom-in of the data: You can see that the two data sets have quite different nature. Question is, how can I count the exact number of...
If I have a physical system which contains a time reversal symmetry (for example a Hamiltonian $H(x,p)=p^2/2m + V(x)$ with $V(x)$ real) and I want to solve the differential equations which describe this system, which solver for ODEs should I use in order to keep the time reversal symmetry (for example in mathematica)? ...
I cannot find a reference explaining clearly and rigorously the links between the notions of conservative form for a PDE, a conservative numerical method and discrete conservation. I would be very grateful for a complete explanation.
We have the advection equation $u_t+a u_x=0, a>0, 0<t<T_f, x \in \mathbb{R}$ with initial condition $u(0,x)=u_0(x)$. Suppose that we have the following sheme: I want to find the CFL condition using the domain of dependence of the finite difference method. To calculate $U_j^{n+1}$ we need the values $U_{j-1}^n$ and $U...
I'm working on a voxel-based modelling application and one of the features that I've implemented is a method to do a 3D mesh reconstruction from a series of 2D image slices (similar to an MRI). I've got a basic brain scan image set that I've been working on, but ultimately I'd like to release a small demo example show...
I am implementing from scratch an Hartree-Fock calculation in the STO-3G basis set to perform Born-Oppenheimer molecular dynamics. I have a Restricted Hartree-Fock procedure that can reproduce very well the total energies of Ref. [1] and of Gaussian09 with pre-optimized molecular geometries. Now, during a Born-Oppenhai...
I am looking for some helps concerning an optimization problem. I have an optimization problem defined on two sets $\mathcal{X}=\{x_i\}_{i=1}^n $ and $\mathcal{Y}=\{y_j\}_{j=1}^m $ and described as follows $$ \begin{equation} \begin{aligned} & \underset{\alpha, \beta}{\text{max}} & & \sum_{i=1}^n \alpha_i x_i^T x_...
I have a certain convex optimization problem which depends on the order of a set of $N$ objects. Meaning, for every possible ordering, I get a different convex optimization problem. My ultimate goal is to find the best optimal solution given all possible orderings. One way of doing that is by solving all $n!$ possible ...
Here is the function I want to minimize: $$\sum_i\frac{\rho_{\tau}(1-\alpha-\pmb x_i^{\top}\pmb\beta)}{\sqrt{1+\pmb\beta^{\top}\pmb\beta}}$$ where $\alpha\in\mathbb{R}$, $\pmb\beta\in\mathbb{R}^p$ are the parameters we want to optimize over and $\tau\in(0,1)$ and the $\pmb x_i$ are given and: $$\rho_{\tau}(x)=\tau\max...
I need to synchronize intermediate solutions of an optimization problem solved distributively over a number of worker processors. The solution vector is known to be sparse. I have noticed that if I use MPI_AllReduce, the performance is good compared to my own AllReduce implementation. However, I believe, the performanc...
Does anybody know if any graph partitioner library such as Metis, Scotch, or Zoltan can (besides splitting a domain), differentiate between internal (i) and boundary (b) nodes?
How can I estimate how much memory will be needed to find eigenvalues and eigenvectors of a given large sparse matrix? I have a real symmetric matrix with roughly $5 \times 10^4$ rows and columns, and an average of $10$ nonzero elements per row. I would like to find the smallest eigenvalue and the corresponding eigenve...
I am looking for some production-ready code to update dense QR and/or Cholesky factorizations (by adding / removing rows and columns or making small-rank updates -- yes, I need all these cases). I have done my Googleliterature research, but I have found very little: Matlab has this covered, but unfortunately this is f...
First of all, hope I've found the right forum for this question, if I haven't please pass me on to one which would fit better. Out of curiosity from an argument with someone who may or may not be more into CPUs than I am. We were arguing about the performance of floating point operations on modern CPUs. Is there any so...
There are lot of articles being written about how the newly launched Intel Xeon Phi will steal the HPC\Super Computer market share from the competitors. Intel Knights is equipped with 72 cores and 4 sockets making it 288 core system. Whereas a single Gtx980 has 2048 CUDA cores. How can these two compete in terms of Com...
I recently timed the linsolve direct solver and I was kind of shocked to see that the solver seemed to be scaling quadratically even upto a 1000 dimensions. Specifically I ran the following code and it showed that the cubic coefficient of time taken $a_3 \approx \frac{1}{1000}a_2$. From my recollection the cubic coeffi...
I have been trying to make a biologically accurate 2D spatial model of tissue layers, where different physiological processes happen. This includes mainly chemical reactions, diffusion and fluxes over boundaries. I am making this model in COMSOL Multiphysics, a finite element software package that solves different phys...
Lets say I've decomposed a continuous function $y(x)$ over some domain $L_x$ using known finite element method with local basis $Q_i(x)$. Suppose $L$ is divided into $M$ "elements". If I want to know the function $y(x)$ at a point $x=p$ (where $p$ is not at a nodal value) then I will need to first know which element $p...
I encounter an optimization problem. The simplified version is like following: Denote function $F(x):\mathbf{R}^n\rightarrow\mathbf{R}$, where $F(x)$ is a smooth lower bounded convex function (i.e. $F(x)>0$). The hessian matrix of $F(x)$ is positive definite. However $F(x)$ is not a strongly convex function, namely we ...
I am currently working on an iterative closest point algorithm (in C++, see here). I understand the basic premise of an ICP algorithm. You have two point clouds (a target and a reference) and you want to register the reference into the target. You do this by: Associate Pairs of Points (k-d tree or something similar) F...
I am interested in fixed-step simulation of an ODE. The methods I know of are either variable-step with prescribed error tolerance or fixed-step without error control. Are there methods known which work on a fixed time grid (for inputs and outputs) AND allow the specification of an error tolerance? The solution for th...
I am given a $n \times n$ matrix $A$ with real entries and define the inner product $$\langle x,y\rangle = x^T A y.$$ I am also given an integer $k$ and need to find all binary vectors $x$ such that $\langle x,x \rangle = k.$ By binary vector I mean a vector whose entries are in $\{0,1\}.$ For $n$ small it is not hard...
I'm trying to solve a 1D Poisson equation with pure Neumann boundary conditions. I've found many discussions of this problem, e.g. 1) Poisson equation with Neumann boundary conditions 2) Writing the Poisson equation finite-difference matrix with Neumann boundary conditions 3) Discrete Poisson Equation with Pure Neumann...
I was taught in my freshman college computer programming course that using global variables is almost always a bad idea. However, I have found that when designing Fortran programs for very complex simulations, such a practice seems to make things easier; for instance, I never have to worry about passing variables to va...
I know that for a dependent-mesh norm Nitsche' method for boundary conditions is coercive. But how to prove this for the usual norms for $H^1$?
I am looking for a reliable library where I can find polylogarithm function and newton/secant method for solving non-linear equations. Basically I have something like this: f(x) = x - A*PolyLog(3/2, B*Exp(-t*x)) f(x) = 0 and f(x,y,z) = 0 g(x,y,z) = 0 h(x,y,z) = 0 involving polylogarithm function. Implementation of P...
I work with scientific simulation, but what I like the most in programming is creating graphical user interfaces and 2D or 3D outputs to visualize the evolution of the simulations. I know most input data in scientific simulation are in text files, not in GUIs, and that more usually statistical graphs are scientifically...
I'm currently working on cubic splines interpolation. My question has to do with the end conditions. Instead of using natural or clamped cubic splines, I am asked to use the following condition : $S_{1} = S_{2} $ and $S_{n} = S_{n-1} $ but I am not pretty sure how this is applied. Could anyone help me clear this out? ...
Say I have a random number generator that generates a number within [0, RAND_MAX], and RAND_MAX < UINT_MAX. How do I generate a random number within [0, i] such that i>RAND_MAX and i<UINT_MAX, while maintaining an even distribution, and without exceeding UINT_MAX in any calculations? The first attempt is to split the r...
I'm working in a finite element code where I need to calculate $$\int_F b_F$$ where $F$ is a face of some tetrahedron $K$ in the mesh, and $b_F$ is the usual bubble function defined by $$b_F=9\lambda_1\lambda_2\lambda_3$$ where $\lambda_i$ are the usual barycentric coordinates. Note that $\textrm{supp}(b_F)=K_+\cup K_-...
I'm using power iteration to find the dominant right eigenvector of some large-ish matrices ($1000\times 1000$ to $10000\times 10000$ or so, maybe I'll need to go bigger later) with non-negative elements. I need to know both the left and right eigenvectors corresponding to the largest eigenvalue. Obviously I can find t...
I am running molecular dynamics simulations of water for testing purposes. The box is quite small, if you ask a guy running classical MD, and relatively large, if you ask a DFT guy: I have 58 water molecules in periodic boundary conditions. To save CPU time, I am optimizing my cell with a classical force field before r...
When simulation atoms, molecules, colloids, autc., are there programs that define each interacting unity as an object in the OOP sense? In my own case, I've been simulating magnetic nanoparticles in colloidal dispersion in Fortran, but I have many arrays that are unrelated in the code for each attribute of the nanopart...
As you may know, Fortran is widely and longly (?) used in science. I've heard a lot of people saying that we natural scientists should all migrate to C++ or Java. I've seen people increasingly suggesting also Python, that I thought it was basically a script language like Bash, but which supports floating-point number o...
I know that it is possible to determine the theoretical order of accuracy (B) of numerical solutions in FVM (for instance for a steady problem in which only the central differencing scheme (CDS) is used to interpolate, B = 2 since CDS is 2nd order accurate). I know that with FVM the order of accuracy is obtained from ...
I need to devise a algorithm (in Python) that calculates adjacency matrices for the platonic solids. Inputted into the algorythm needs to be the number of polygons meeting at each vertex and the regular polygon on which they are based. Any ideas are welcome as I've tried a few avenues and haven't come up with anything ...
Are there any frameworks that could be classified as "general computational fluid dynamics framework"? What I'm thinking of is a framework that's modular and extensible in order to allow the development of new algorithms pretty much unlimitedly. And scaleability over different computer configurations (laptop - HPC). Do...
Note: this is a continuation of Generate Random Number outside Bounds. I have a function (thanks to the previous question) with the following prototype which returns an integer in the range $[0,b]$, $b \le UINT\_MAX$: unsigned int randrange(unsigned int b) Now I want to create a function which returns an integer in th...
The Weierstrass approximation theorem says any continuous function $f(x): [0,1] \to \mathbb{R}$ can be approximated uniformly by polynomials. Given any $\epsilon$, we can find $p(x) = x^n + \dots $ such that: $$ |f(x) - p(x)| < \epsilon $$ is always true. In practice how to do we find $p$? Let's say $f(x)$ was the s...
Are there any known issues (such as precision issues) with $\mathsf{MATLAB}$ eig and charpoly functions for large enough $\{-1,0,+1\}$ matrices? Even if I change $1$ or $2$ entries between matrices would it be able to find the accurate eigenvalues and characteristic polynomials? I am using size less $40\times40$. My ma...
I'm reading a technical report on Simulated Annealing: On the Convergence Time of Simulated Annealing, by Sanguthevar Rajasekaran. You may find it following this link. Given $G=(V, E)$ is the graph whose vertices are possible solutions to the given problem, and $E$ is the set of edges between the neighbours, the goal i...
I'm trying to solve this problem: $\begin{cases} \partial_t E=-k\left([f(\rho)-i.\left[\delta+\frac{1}{2}a\left[\dfrac{\nabla^2_{\bot}}{4}+1-\rho^2\right]\right]]E - 2CP\right)\\ \partial_t P=-\gamma_{\bot}[(1+i\delta)P + ED]\\ \partial_t D=-\gamma_{\parallel}(D-\chi(\rho)-\frac{1}{2}(E^*P+EP^*)) \end{cases}$ Here $f(\...
I want to solve 3 coupled equations. I converted them to a system of odes in time and discrete it in Length and radius. Now I have a problem in one of the equations in first point. Because in this point I have A second order derivative and when I discretize it I dont have $y$ in second point. This is my equation: $\fra...
As stated in the title I have a raster image (black or white) with no complex or fuzzied components (only horizontal or vertical text, italic or bold are allowed). I need to express that raster image in as cheap a way as possibile using vertor representation (I only have one primitive that can draw a rectangle). My fir...
Given: Several circular series of map GPS coordinates for several bus routes. The GPS coordinates are not all equal when they run along the same road. The number of GPS coordinates for a single bus route runs from 140-600. Problem: When the points are downloaded drawn, the raw routes don't follow each other perfectly a...
I'm developing a solver for solving linear hyperbolic equations of first order with respect to time and spatial derivatives. The formal order of accuracy of the solver must be 5 because I use 5th-order accurate Runge--Kutta method and 5th-order finite-difference WENO for Hamilton--Jacobi equations. To verify my solver,...
I want to solve 7 coupled equations.I use method of line(MOL) and discrete the equation in Length and radius and convert them to a system of ODEs in time.and use ode15s to solve them in MATLAB. But an error occur: Warning: Failure at t=5.422028e-006. Unable to meet integration tolerances without reducing the s...
I am solving the monodimensional diffusion/reaction equation by discretization using the well-known method of lines ${\partial c\over\partial t}=D{\partial^2 c\over\partial x^2}+ r\text{ for t>0 and -L<x<L} \quad[1]$ $c(x,0)=1 \quad[2], \quad \text{ initial condition}$ ${dc\over dx} \mid_{(0,t)} =0\ \text{ for ...
I have a system of seven nonlinear equations that I want to find their symbolic solutions. The solution will depend on the parameter K, and I should have different solutions by varying the parameter. I want the program to give the ranges of K and the solution associated with each value. I tried to solve the system usin...
In the recent question Solving system of 7 nonlinear algebraic equations symbolically, Brian Borchers experimentally confirmed that Maple can solve a polynomial system that Matlab/Mupad cannot handle. I have heard in the past from people working in the field that Maple has a high-quality implementation of Gröbner bases...
I am working on adaptive techniques for solving some elliptic equations. The technique is based on residual on elements. My problem is that when I use a predefined tolerance for refining elements, the number of elements that refined are too much, even for a tolerance around $10^{-2}$. I also, tried refining those eleme...
How can I understand the flow is incompressible or not with this information at 4 edges?
I have code that attempts to implement a solution to the Schrödinger equation where there is a central potential (more or less im thinking of hydrogen), in 1-D using the numerov method to construct the wave function. It does not take care of the states (N=1,..) as my goal is to understand the link between the theory a...
So I am attempting to solve a 3D poisson problem with Discontinuous Galerkin (interior penalty method). The weak form (written in FEniCS) is as following: a = dot(grad(v), grad(u))*dx \ - dot(avg(grad(v)), jump(u, n))*dS \ - dot(jump(v, n), avg(grad(u)))*dS \ + alpha/h_avg*dot(jump(v, n), jump(u, n))*dS \ - d...
Ridge regression can be posed as minimizing the following objective function (over $x$): $$\frac{1}{2} \lVert Ax - b \lVert_2^2 ~+ \frac{\lambda}{2} \lVert x \lVert_2^2 $$ Which has a closed form solution: $$x = (A^TA + \lambda I)^{-1} A^T b $$ Let's say we want to solve this problem for several different values of $b$...
I would like to efficiently and (to the extent possible) reliably find the Perron-Frobenius eigenvector of non-negative matrices. These are not stochastic matrices, they are typically dense, and their entries differ by many orders of magnitude. They are probably usually irreducible, though if you think of the very smal...
I'm trying to compute the Madelung constant of the ZnS lattice. The method is as follows: The lattice is a face-centered-cubic with basis $S^-: (0,0,0)$ and $Zn^+: (1/4,1/4,1/4)$. The Madelung constant is $$\alpha=\sum_j \frac{q_j}{r_j}$$ where $q_j$ is the charge (in this case divided by the number of neighboring bloc...
I want to show convergence of a finite element method for a higher order equation.I have a coupled equations that solved together and gives two variables as answer $[u, v]$. $$w+\Delta u=0$$ $$\Delta w=f$$ for finding the answer $$[u,w]=K^{-1}F,$$ Unfortunately, I am really confused about that and have a lot of quest...
Suppose $A\in\mathbb{R}^{n\times n}$ is a symmetric, positive definite matrix. $A$ is big enough that it's expensive to solve $Ax=b$ directly. Is there an iterative algorithm for finding the smallest eigenvalue of $A$ that doesn't involve inverting $A$ in each iteration? That is, I'd have to use an iterative algorithm...
I am solving the 1D advection problem given by: $$\frac{\partial u}{\partial t}=-c\frac{\partial u}{\partial x}$$ where c is the wave speed, and u is the unknown field variable, and x and t are time and space. I am using central differencing to discretise in space. My initial $u$ profile which is being convected is a s...
Not 100% sure where this question belongs, since I'm not sure if the problem is code related or not. I've written a program to model the solar system. I am now testing its accuracy. I've checked conservation of angular momentum, and it is perfectly conserved, as is energy - I'm using the velocity verlet algorithm. I'v...
I'm trying to solve these equations of hypersonic adiabatic flow over a flat plate. I did all the simplifications and got these equations for the stagnation point flow. $$\left(Cf''\right)' + f f'' = \left(f'\right)^2-g$$ $$\left(\frac{C}{p_r} g'\right) + fg'=0$$ For a calorically perfect gas, $g=h/he$, and $he = \rm s...
The geodesic differential equations are given as \begin{align} \frac{d^2 x^j}{ds^2} + \Gamma^{\phantom{h}j}_{h\phantom{j}k}\frac{dx^h}{ds}\frac{dx^k}{ds} = 0, \end{align} where the $\Gamma^{\phantom{h}j}_{h\phantom{j}k}$ is the Christoffel symbol of second kind. According to T. A. Moore - A general relativity workbook...
The strong form of a PDE requires that the unknown solution belongs in $H^2$. But the weak form requires only that the unknown solution belongs in $H^1$. How do you reconcile this?
I have a discrete 2D temperature field, i. e. a dataset of N points (x, y, T). I would like to compute line integrals at fixed radii, $\int_0^{2\pi}T(r,\theta)d\theta$. My first thought was to transform all coordinates into radial coordinates, and then interpolate to a regular grid in $r,\theta$, so the integral would...
I have two parts, which need to be meshed. One part is located inside another. To simplify the problem, imagine two cubes: one inside another. Geometries are stored in STL files. From CAD point of view, one file contains an internal cube, another contains cube with a hole for an internal cube. All dimensions fits (the...