instruction
stringlengths
43
28.1k
For my thesis, I look in trajectories of vehicles through an atmosphere at very high velocities. I have a set of equations of motion, which I propagate using a Runge-Kutta-Fehlberg (RKF) 7(8) numerical integrator, one that has already been developed by the department of my university. The entire code is programmed in C...
First off some context. The Traveling Salesman Problem(TSP) is to find the most efficient route passing through a series of points only once. However, there is no perfect function to solve for this in a reasonable amount of time. Because with each additional point, the number of possible routes is greatly increased. Th...
I have a mesh which represents a 0-genus model. My goal is to construct a homeomorphism from that mesh to its bounding sphere. I'm trying to understand a paragraph in http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.42.2762&rep=rep1&type=pdf : The basic idea of [the algorithms to project a 0-genus mesh on th...
This is a follow up question to this question. Consider the following SDP in standard form: \begin{align} &\min_{X\in S^n, X>0} \operatorname{tr}(AX)\\ &\mbox{subject to}\; \operatorname{tr}(B_iX)\leq b_i, i=1,\dots,m\\ \end{align} Here, $A\in S^n,B_i \in S^n$, $b_i\in \mathbb{R}$ and $m=O(n)$. Can anyone please explai...
I'm developing an FEM solver for a coupled system. I have diffusion and potential equations which result in positive definite matrices for each equation, but the coupling makes the overall system matrix non-symmetric, non-positive-definite. The solver is planned to run entirely on a GPU. Mesh and data representation is...
I am attempting to simulate projectile flight with drag. However, with a timestep of 0.1 seconds, I am consistently getting an error of ~0.1-1%. while p[1, iterr] >= 0 and iterr < 9999: p0 = p[:, iterr] v0 = v[:, iterr] pp1 = h * v0 vp1 = h * f(v0) pp2 = h * (...
I have a sparse $2\times10^5$ by $2\times10^5$ matrix with $3.2\times10^9$ non-zero elements. I want a sparse solver with out-of-core functionality. I have attempted to use Intel's MKL pardiso, with a varying degree of success. For smaller problems, it is stellar, but for the problem size above, it is taking a huge amo...
Let a Matrix $\mathbf{Y=[A\;b;b^T\;}d]$, where $d$ is a scalar, and $\mathbf{b}$ is a vector. How to find the cholesky factorization of $\mathbf{Y}$ if i know the cholesky factorization of $\mathbf{A}$.?
Solving acoustical wave equation: $$ c_0^2\partial_{xx}p-\partial_{tt}=0 $$ using forward-time centered-space FDM is not very convenient cause of numerical dispersion etc. What about using a little physics and solve this as a system of first order equations (linearized Euler equations), i.e.: $$ \nabla p = -\rho_0\part...
I want to calculate the following equation: $$\frac{\theta \Gamma \left(\kappa+1,\frac{o}{\theta }\right)-o \Gamma \left(\kappa,\frac{o}{\theta }\right)}{\Gamma (\kappa)}+o+s$$ with $s>0, o>0, \kappa>0, \theta>0$ and in which $\Gamma(\kappa,x)$ represents the upper incomplete gamma function and $\Gamma(\kappa)$ the (...
I want to solve a Sturm-Liouville problem in 1D, i.e., \begin{align} [p(x)\ u'(x)]'+q(x)u(x) = f(x) \end{align} with boundary conditions \begin{align} u(0)=a \hspace{1cm} u'(0)=b \end{align} How do I implement these conditions? What I did: First I multiply both sides by a test function $v\in\lbrace c\in H^1\big\vert v(...
I am trying to solve the elasticity equation using Crouzeix-Raviart element. Since this can not be solved using continuous FEM I am trying to solve this by discontinuous Galerkin method. In the discontinuous Galerkin formulation the left hand part of equation $a(U,v)$ term has two parts, the first part is the stiffness...
This is a visualization/programming design problem. I am working on building a geospatial agent based model, meaning that there are multiple agents interacting within some particular spatial container. The movement of the agents and their interactions are based upon some biased random walks and integro-differential equ...
I am solving a problem involving the line with the set of points $(x_3,y_3)$ that are equidistant to two given points $(x_1,y_1)$ and $(x_2,y_2)$. The equation for this line is $$(x_3 - x_1)^2 + (y_3 - y_1)^2 = (x_3 - x_2)^2 + (y_3 - y_2)^2$$ which boils down to $$2 (x_1 - x_2) x_3 + 2 (y_1 - y_2) y_3 = x_1^2 + y_1^2 -...
I am Computer Scientist and now I am interested in matrix multiplication on GPUs. My research are focused on matrix free finite elements method where I multiply sparse matrix. Sparse matrix could multiply regular or matrix free. In general based on special coordinate function. I have a few general question: How popular...
I am Computer Scientist and now I am interested in matrix multiplication on GPUs. My research are focused on matrix free finite elements method where I multiply sparse matrix. Sparse matrix could multiply regular or matrix free. In general based on special coordinate function. I have a few general question: How popular...
Why do people use the classical least squares approach so often ? If I use the absolute value instead of the power, I immediately know how far away the solution is: $$ res = \frac{abs(x - x_{model})}{x}$$ What is the benefit of squaring ?
We're currently solving the heat equation as a part of the PDE sequence in class. We've been given the formula:$$T(i, n+1) = T(i,n)+\alpha \left [\frac{T(i+1,n)-2 T(i, n)+T(i-1,n)}{\Delta x^2} \right ] \quad \Delta t$$ I've got boundary conditions handled. They aren't the problem. The problem here is, if one notices, $...
I was estimating a falling object's position versus time by using a simple first order step function, where for i=2:length(t) % We're using Euler, so we need an initial previous point to start t=t(i); V=V+dv; rho_i= % Calculate our height and then pull rho from data K=(m/(mg-.5*C_d*A*V^2*rho_i)); dv=dt/K; ...
I am a student doing physics hons and have had very little experience in programming. This semester we are supposed to do a computational project in thermodynamics. I have to solve these two coupled diff eqns: $$ \begin{aligned} ω (p,T ) &= \frac{p ^2}{2m} + \frac{2}{N}\sum_q f(p − q)\,n (q) − \frac{1}{N^2}\sum_{s,t} f...
I was estimating a falling object's position versus time by using a simple first order step function, where for i=2:length(t) % We're using Euler, so we need an initial previous point to start t = t(i); V = V + dv; rho_i = % Calculate our height and then pull rho from data K...
This question is a follow-up to this one. Let $A\in \mathbb{R}^{n\times n}$ be large, sparse, symmetric and positive definite. Suppose for I already know $m<n$ eigenpairs of $A$, corresponding to the largest eigenvalues, i.e. $\{( \lambda_i, \vec{q}_i) \}_{i=1}^m \subset \mathbb{R}^+\times \mathbb{R}^n$. I need t...
I am using MATLAB's PDE toolbox to solve the differential equation $-\nabla\cdot\left(c(x)\nabla u(x)\right) + a(x)u(x) = f(x)$ The particular problem in question is an electrostatic problem, but has the solution (voltage) specified at several points inside the domain. Since the PDE tool is setup to apply boundary cond...
I'm working on a fluid solver using dual-time stepping and everything works really well, except the convergence in pseudo-time is slow. I'd like to accelerate the convergence. I know multigrid methods are typically used, but I am thinking about exploring another approach that is, hopefully, easier to implement. I star...
What equation would you all use to estimate the wind speed over the Mojave Desert in December? I'd like to model the speed of the wind up to say 50 thousand feet. I read up about wind speeds on Wikipedia and they give an analytical formula for wind gradient: $$\\ v_w(h) = v_{10} \cdot \left( \frac {h} {h_{10}} \right)...
I have made a solver based on the SymPy.diffgeom library, where I use Scipy.Integrate to solve the following system of second order differential equations : \begin{align} u'' &+ \Gamma^0_{00}(u')^2 + 2\Gamma^0_{01}u'v' + \Gamma^0_{11}(v')^2 = 0,\\ v'' &+ \Gamma^1_{00}(u')^2 + 2\Gamma^1_{01}u'v' + \Gamma^1_{11}(v')^2 ...
I want to solve a integer programming problem with binary variables $x_1,\ldots,x_n.$ I have a permutation group $G \leq S_n$ such that for every $f \in G$ the vector $\overline{x}_1,\ldots,\overline{x}_n$ is a feasible solution if and only if $\overline{x}_{f(1)}, \ldots ,\overline{x}_{f(n)}$ is a feasible solution. ...
I have to solve a simulation of fluid flow on Ansys, but my prof wants me to run a parallel simulation using the Volume of Fluid method in something with more visible guts than Ansys? Any recommendations, or should I try doing it in Matlab?
I have the following optimization problem: $$ \begin{array}{ll} \text{Minimize} & \frac{1}{x_1} + \frac{1}{x_2} + \ldots + \frac{1}{d_n} \\ \text{Subject to} & A x \leq b \end{array} $$ where $x = [x_1~~x_2~~\ldots~~x_n]^T$, $x_1,x_2,\ldots,x_n \in \left\{1,\frac{1}{2},\frac{1}{3},\ldots, \frac{1}{k} \right\}$for some...
I have the following problem. Let's say we have $x_{jk}$ it is an expression value of gene $j$ in a sample $k$. It is the average of expression levels across the cell types $s_{ij}$, weighted by respective proportions $a_{ki}$ ($i = 1 \cdots N$, $N$ is the disease type): $$ x_{jk} = \sum_{i=1}^{N} a_{ki}s_{ij} $$ Gener...
Where can I find manufactured solutions for the 2d Euler equations, with the complete analytical terms, including the Jacobian of the source term ?
The boundary value problem is $$ \begin{cases} \dot{x}_i = \begin{cases} (0.5D^{-1}\psi)_i, \text{ if }(0.5D^{-1}\psi)_i \le 0 \\ 0 \text{, otherwise} \end{cases} \\ \dot{\psi} = 2\Sigma x \\ x(0) = x^0 \\ x(T) = 0 \end{cases} $$ Here $x^0>0$, $T$ is given, $D>0$ is a diagonal matrix, $\Sigma>0$ is a symmetric matrix...
I have difficulties with this equation $$\frac{d^2 u}{d x^2} + u^2 - x^2 = 0$$ with boundary conditions: $u(0)=u(1)=0$ I do not know how to solve nonlinear differential equations with Newton's method. If somebody knows could you please explain? I followed the comments and ı finally reach these two equations (eqn1 and ...
I have coded up a toy implementation of Conjugate Residual and have been testing it. Both wikipedia and the Saad claim that Conjugate Residual and Conjugate Gradient have similar convergence behavior. For some examples I have been doing I haven't found this to be true. For a $128 \times 128$ symmetric indefinite mat...
I have a tracker that outputs the trajectory $(x,y,z)$ of an object (e.g., a can). I want to use these trajectories to train a classifier (i.e., SVM) in order to infer the activity that the person manipulating the object is performing (e.g., drinking from a can or pouring from a can ) Which kind of features should I u...
I use software for pollutant propagation on rivers that takes as input a set of parameters ($p_1,p_2,\ldots,p_n$) and creates an output file which is basically a matrix where on each row the concentration of the pollutant in various places along the river at a given timestamp is given. \begin{array} {|r|r|r|r|r...|r|}...
I'm a computational chemist working with little computational power and dealing with increasingly demanding chemical systems. My work machines are part of a big network (mixed with windows and linux) and I was asking myself: is it possible to "borrow" computational power from machines around me (with permission from my...
How do you approximate a function for interpolated points? I use the natural cubic spline to interpolate points as follows for n = 500 points: t=[0; 3; 6; 9] z=[0; 6; 6; 0] plot(t,z,'ro') ti=linspace(0,9,500) zn = natcubicspline(t,z,ti) yn = line(ti,zn) Is there any way approximate a function for these n-many points ...
The solution space of a nonlinear ordinary differential equation (ODE) often includes a separatrix that is unstable in the sense that nearby solutions depart exponentially from it. The nonlinear Bessel's equation, for instance, f''[x] + f'[x]/x +f[x](1 – f[x]^2) == 0 has this behavior, with a separatrix satisfying f[...
I'm trying to learn how to do optimal rocket trajectory planning. I have a process that works but it converges very slowly; I'm looking for help to understand how to speed that up. The optimal control problem This is a simplified version of the linear tangent steering problem: Imagine a point mass (the "rocket") moving...
I am modelling a 1 dof spring-mass-damper system with friction. As first attempt I modelled the friction according to the simple Coulomb model (figure A here http://article.sapub.org/image/10.5923.j.mechanics.20130301.04_006.gif) and it worked fine. Now I want to add the effect of the static friction when v = 0 m/s (fi...
I'm looking for some physical phenomena for which an adaptive time stepping algorithm would be ideal. A PDE or ODE that showed very large gradients in time at a small period of time and smoother gradients for the rest of the still necessary simulation. Thanks.
Suppose $A\in\mathbb{R}^{n\times n}$ is symmetric and positive definite and that we have several symmetric matrices $B_i\in\mathbb{R}^{n\times n}$ that are low-rank and indefinite. I need an algorithm for solving the following optimization problem: $$ \begin{align*} \min_{x\in\mathbb{R}^n}\ & x^\top Ax\\ \textrm{s.t.}...
I am trying out a few forms of polynomial expression optimization, and I'd like to improve of what I've got, if anyone has anything they know is better. Implementation 1: $$x-\frac{x^3}{3!}+\frac{x^5}{5!}-\frac{x^7}{7!}$$ To the best of my knowledge, this has 3 add/subtracts, 21 muls, and 3 divs. Implementation 2: $$x(...
Central schemes like JST uses artificial dissipation for the stabilization. This modification is an artificial one. Does this additional term makes system inconsistent? Can we expect this term to be zero at the end of the simulation? This is in reference with incompressible flow schemes. In the following references the...
I am trying to implement in Python this ratio: $\frac{w_t(i)}{\sum w_t(j)}$ where $w_t(i) = w_{t-1}(i)\cdot\exp{(-x_{t}(i))}$, i.e. the weights are exponentially decreasing without running into underflow problems. I am using this ratio in a formula later. Has anyone had the same problem? Any ideas? I read a bit about t...
I am solving a nonlinear ODE with a regular singularity using MATLAB ODE45 or ODE113. I am wondering what precision and accuracy they have and what one can say about the numerical error. The idea would be to write a statement like "The solution was found by means of ODE45 which has an accuracy of...".
We have been developing algorithms for detecting "robust" zeros of multidimensional functions $f: X\to\Bbb R^n$ where $X$ is an $m$-dimensional domain in $\Bbb R^m$. More precisely, for a given $f$, we can compute an $r>0$ such that every continuous $g$, $\|g-f\|<r$ has a nonempty zero set in $X$ (under some quite weak...
Is there any function to create or change a matrix, to have $A_{ij} = \text{abs}(A_{ij})$ in PETSc? If possible it should work with MPIAIJ matrices, not only local.
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 ...