instruction stringlengths 43 28.1k |
|---|
I am trying to estimate a few unknown parameters of my continuous non-linear PDAE model (simulated through finite-volume method spatial discretisation, and time-stepping through method-of-lines). I am planning to do this by minimising the least-squares error of the model output to experimental data.
I read about the v... |
I am trying to solve an elliptic PDE in 2-D:
$$-\nabla^{2} u = 20tanh(10x-5)(10-10tanh(10x-5)^2) = f$$
I know that the solution is $u = tanh(10x-5)$ but I am unable to get $O(h^2)$ solution with a cell-centered, finite-difference on a uniform mesh with Dirichlet boundary conditions.
Discretization : central differenc... |
I am trying to numerically solve a PDE, and just had a question as to the validity of a certain approach. For example, given the PDE:
$$ \frac {\partial ^2 E}{\partial t^2} = - k\frac {\partial E}{\partial t} + c^2 \frac {\partial ^2 E}{\partial z^2} - c\frac {\partial E}{\partial z}$$
If I was to apply an explicit R... |
I have a convex optimization problem as follows:
\begin{align*}
maximize_{x\in R^n} &\sum_{i=1}^n a_i log(x_i)\\
st\quad & \sum_{i=1}^n p_{ij} (x_i-1) = 0 \quad \forall j\\
& x_i \geq 0
\end{align*}
where, $a_i \geq 0$ and $P$ is an $n\times m$ probability matrix with rows sum up to 1.
Is... |
I am reading the paper, http://math.mit.edu/~gs/cse/codes/mit18086_navierstokes.pdf
It says applying the divergence to both sides of this equation
$$\frac{1}{\Delta t} U^{n+1} - \frac{1}{\Delta t} U^{n} = - \nabla P^{n+1} $$
yields the linear system,
$$-\Delta P^{n+1} = - \frac{1}{\Delta t} U^{n} $$
Why does the $\fr... |
I have the following problem, there is an objective function f() depending on 7 variables x=(x1,x2,...x7), so f(x)=f((x1,x2,...x7)) and I want to find the combination of variables that minimize the objective function (x* for which f(x*) is minimum). The formula of the objective function is unknown. The problem is that ... |
I am reading the paper, http://math.mit.edu/~gs/cse/codes/mit18086_navierstokes.pdf
I could not really understand the description. Could someone explain a little bit more?
It says,
"For the lid driven cavity problem this means that homogeneous Neumann boundary conditions are prescribe everywhere. This implies in partic... |
I am looking for a good numerical method to solve a linear system (of small/moderate size) with a matrix of the form
$$
\begin{bmatrix}
a_1 & b_1\\
& a_2 & \ddots \\
& & \ddots & b_{n-1}\\
b_n & & & a_n
\end{bmatrix}.
$$
What would you suggest?
Entries not displayed are zero. The $a_i$ and $b_i$ entries can be arbitrar... |
Let $\bar{x}$ denote the analytical solution of a PDE. Let $x^{(k)}$ be the solution at the $k^{th}$ iteration. The initial guess for the solution is $x^{(0)} = 0$. Let $r_{0} = ||\bar{x}-x^{(0)}||_{2}$ i.e. the $l_{2}$ norm of the error. Let $r_{k} = ||\bar{x}-x^{(k)}||_{2}$ be the $l_{2}$ norm at the $k^{th}$ iterati... |
I have a quantum mechanics simulation where I need to multiply three matrices that look like this:
$$\rho(t_1)=U^\dagger \rho(t_0) \, U$$
where $U^\dagger$ is the hermitian conjugate of $U$. This evolves the density matrix $\rho$ from one time point to another time point. $U$ is called the evolution operator.
My questi... |
Hi I want to approximate $u(x,t)$ solution of:
$\begin{cases}u_t+H(u_x)=0 \\u(x,0)=u_0(x)= e^{−(x−3)^2}
\end{cases}$, where
$H(u_x)=\frac{u_x^2}{2}$ and my spatial domain is $\Omega=[0;10]$.
Now i want to apply Hopf-Lax formula (Evans' chapter 3 theorem 4), who says
$u(x_j,t_n+\Delta t)=\min_{a\in \mathbb{R}} \left\{ ... |
Hi I am trying to take a derivative of an array but am having trouble. The array is two dimensional, $x$ and $y$ directions. I would like to take a derivative along $x$ and along $y$ using central difference discretization. The array has random values of numbers, no values are NaN. I will provide a basic portion of... |
I am reading the paper, http://math.mit.edu/~gs/cse/codes/mit18086_navierstokes.pdf
In the paper, the nonlinear term is treated as mix of central central difference and upwind difference using a transition parameter $\gamma \in [0,1]$, and it's defined as
$$\frac{U^*-U}{\Delta t} =
((\bar{U}^h)^2 - \gamma \lvert \bar... |
I am new to MPI and am trying to figure out the subtleties in it, and for that reason I am just playing around with an easy example. The question I have is that when I run the code below with 2 processors, even though the printf statement is BEFORE the MPI_Init both processors print it. Is there anyway to not have this... |
A dull matrix multiplication algorithm where we use the formula
$$C_{ij}=\sum_{k}A_{ik}B_{kj}$$
By literally following this in 3 loops we'll get a very slow program, because we don't utilize processor's vectorization power. An example of this slow implementation is:
T comp;
for (int i = 0; i < lhs.rows(); i++)
{
fo... |
Consider the 1D Poisson equation
$$\nabla^2 u = f.$$
Using finite difference method on cell corner data and a uniform grid with ghost points, I think we can write the system of equations with Neumann BCs as:
$$Au = f-Au_{BC},$$
where
$$
\begin{aligned}
A &= \frac{1}{\Delta x^2} \left[\begin{array}{ccccccccc}
-2 & 2 ... |
Here is the flow past a square cylinder configuration. The problem is a viscous and incompressible with parabolic velocity profile using freestream velocity $U$ across a single cylinder. I use the single relaxation time lattice Boltzmann method. For the two-dimensional nine-velocity lattice(D2Q9), the directions of the... |
I wanted to implement a basic example from the book "The Art of molecular dynamics simulation" in LAMMPS. It describes the 2d-movement of molecules in a Lennard-Jones-potential, defined as
$$u(r_{ij})=\left\{\begin{matrix}4\varepsilon\left[\left(\frac{\sigma}{r_{ij}}\right)^{12}-\left(\frac{\sigma}{r_{ij}}\right)^{6}\... |
I want some scalar spline function defined on regular 2D grid $F(x,y)$ with continuous first derivative which is easy to intersect with arbitrary ray/line ${\vec l}(t) = (c_x t,c_y t,c_z t)$.
Finding the intersection means finding roots of equation $f_{c_x,c_y}(t)-c_zt=0$ where $f_{c_x,c_y}(t)=F(c_x t, c_y t )$ are ... |
Suppose we have equation of the form:
$$H \Psi = E \Psi $$
where $H$ is Dirac Hamiltonian (also my question can be answered by people who are not familiar with Dirac Hamiltonian but familiar with numerical solution of different eigenvalue problems):
$$ H = \vec{\alpha} \vec{\nabla} + V(r) = H_0 + V(r)$$
and $\vec{\alph... |
How to normalize the CPU time for comparing algorithm execution time on systems with different hardware configurations?
|
I have to solve a least squares problem:
$$
x=\arg \min\|Ax-b\|
$$
where $A$ is a $m\times n$ matrix, $m>n$, and $b\in\mathbb{R}^m$.
I always thought that doing this via QR factorization is better than solving the normal equations
$$
A^*Ax=A^*b
$$
directly.
However, I am now in the situation where the columns of $A$... |
Edit: (copying from my comment)
Let's consider the inverse problem when I need to transfer velocities from particles to the grid (inverse bilinear interpolation). How'd I transfer a particle's x-velocity to the velocities located at cell's face in the Q region? Would the particle's velocity be distributed among the 2 f... |
I'm trying to take data in numpy arrays, interpolate them and retrieve this function to differentiate/integrate at different stages.
Here is how I got here, data included:
import numpy as np
x = np.array([ 50., 55., 60., 65., 70., 75., 80., 85., 90.,
95., 100., 105., 110., 115., 120., 1... |
I am trying to parallelize a program with CUDA that has irregular memory access. To explain what I am talking about, I have attached two figures. In the first figure, I have plotted the indices of the output and input arrays that needs to be accessed during each loop iteration. Obviously I have plotted only a few itera... |
The title says is all. This question is in the contest of an incompressible Navier-Stokes solver.
Specifically, I am currently working on a new solver while referring myself to an older code for guidance. The use of high-order methods - WENO5 for convection and 4th order finite difference other derivatives - is compuls... |
I am solving a first-order ODE:
$\frac{\partial \rho }{\partial t} = -a \rho^2 + b |A(t)|^2 \rho +c|A(t)|^{2m}$
This is the evolution of the plasma density in the presence of a laser pulse (complex amplitude A, which is normalized). The coefficients a, b and c depend on the material and the initial laser intensity. Typ... |
I have solved a PDE with an analytical equation. Through operator splitting I divided the PDE into one PDE and one ODE, using a sequential approach.
Finally for different $dt$, I got euclidian norm of the difference:
Euclidian norm
$dt_1$ $error_1$
$dt_2$ $error_2$
$dt_3$ $error_3$
I would like to know the order of ... |
If I have a system of equations as follows (where $i = \sqrt{-1}$):
$$
\frac {\partial A}{\partial t} = iA^*B - A \tag{1} \\
$$
$$
\frac {\partial B}{\partial z} = AB^* - B \tag{2}
$$
Using the method of lines, in general, I discretize space and solve the system for all time for a particular $z_k$—this transforms the ... |
I'm using the finite element method to obtain the time response of a structure harmonically excited. I'm using a linear displacement function to obtain the stiffness matrix and the consistent mass matrix, i.e., I have this set of equations:
$$[M]\{\ddot x\} + [K]\{x\} = \{F(t)\}$$
What is the best way to apply the boun... |
I'm trying to solve exercises of the book "Computational Geometry in C" by O'Rourke. Could you please help me with this one?
Design an algorithm to find a line $L$ that:
has all the points of a given set to one side
minimizes the sum of the perpendicular distances of the points to $L$ Assume a hull algorithm is av... |
I have a Triangular Plane T given by three points in 3D space $$P_1 = (x_1,y_1,z_1)\\ P_2 = (x_2,y_2,z_2) \\ P_3 = (x_3,y_3,z_3)$$
I want to find the Shape Functions on this plane as $N_1(x,y,z),N_2(x,y,z),N_3(x,y,z)$.
I am totally aware of finding the basis function for
2D but I have no clue on how to do it for the ... |
Why, you may ask?
The Python sympy symbolic library provides solutions to single, linear Diophantine equations in terms of parametric variables. For instance,
{(t_0, -9*t_0 - 5*t_1 + 154, -5*t_0 - 3*t_1 + 77)}
Without worrying about coding details, how can one solve such a system of parametric expressions for values o... |
I have a usual vtk file with a mesh of triangles and a scalar velocity.
I want to obtain this type of plots:
something like an "elevation", but in paraview I just had obtained plane plots like
How can I obtain plots like the first one?
I Edited my message with an example of my vtk file. Note that the points of the m... |
I need to implement the following in python:
For a given discrete time series $Z_t$ ($t={0...T}$), find the smallest $t$ such that:
$$c\sum_{s=0}^t e^{[k(Z_t-Z_s)+m(t-s)]} \geq \frac{p^*}{1-p^*} $$
where $c,k,m$ are constants and
$$P^*=\int_0^{0.5} \frac{(1-2y)e^{-d/y}}{(1-y)^{1+d}y^{1-d}}dy=\int_{0.5}^{p^*} \frac{(2y... |
For the heat equation
\begin{equation}
u_t(t,x) = \nu u_{xx}(t,x)
\end{equation}
for $x \in [0,1]$ with boundary conditions $u(t,0) = u(t,1) = 0$ and initial value $u(0,x) = u_0(x)$ it is easy to show that the "energy" defined as
\begin{equation}
E(t) = \frac{1}{2} \int_{0}^{1} u^2(t,x)~dx
\end{equation}
decays over t... |
Do you know some interesting literature concerning the comparison of Simplex and Interior-Point-Methods referring to linear optimization?
I also read about the possibility of combining both of them but couldn't find much literature on that either.
|
I implemented the Jacobi iteration using Matlab based on this paper, and the code is as follows:
function x = jacobi(A, b)
% Executes iterations of Jacobi's method to solve Ax = b.
assert(size(A, 1) == size(A, 2))
assert(size(A, 1) == size(b, 1))
% matrix with all zeros except the diagonal elements,
% which are those... |
I have a pretty basic question about Lattice-Boltzmann methods. I heard that this is a meshless simulation method. How do you account for obstacles and boundaries in a Lattice-Boltzmann code. Does it work like a $\Delta x$, $\Delta y$ grid ?
|
In the finite element method, in order to use MPI, we need to decompose the domain into sub-domains first. Then my question is whether we can solve each sub-domain using a direct solver?
Of course, unlike solving the entire domain as a whole, we don't get the right solution in one iteration. Will the solution converge ... |
I am trying to approximate the exponential of a matrix. I want to use a tolerance but I am confused as to how to compute the error. Any ideas or hints?
|
For the closed Newton-Cotes quadrature over $[x_1, x_n]$, the coefficients $H_{n,i}$ for
$$
\int_{x_1}^{x_n} f(x)\:\text{d}x = h \sum_{i=1}^n H_{n,i} \; f(x_i)
$$
are given explicitly by
$$
H_{n,r+1} =\frac{(-1)^{n-r}}{r!(n-r)!}\int_0^n \frac{\prod_{k=0}^n (t-k)}{t-r}\:\text{d}t;
$$
see http://mathworld.wolfram.com/New... |
Consider the following regression model :
Y = AX + BU
where the size of Y is $N \times n$, A is $N \times n$, X is $n \times n$, B is $N \times n$ and U is $n \times 1$.
The matrices X,Y and U are kown and the matrices A and U have to be estimated.
Is there an optimal method (in the sense of minimal residual error betw... |
Update: Thank you very much for all of you who answered below. I'm studying each answer now. In the long term, I'm more interested in solutions that work for sparse tensors (sorry I should have mentioned this earlier), but I can use your ideas as a temporary solution (I will need to add more RAM for larger size problem... |
I'm working on a certain problem of slow, non-Newtonian, thin-film flow. This problem can be modelled with the incompressible Stokes equations:
$\nabla\cdot 2\mu(\dot\varepsilon)\dot\varepsilon - \nabla p + \rho g = 0, \qquad \nabla\cdot u = 0$
where $u$ is the velocity, $\mu$ is the (nonlinear) viscosity, $\dot\vareps... |
This is a follow-up to this answer.
Suppose you have a possibly very ill-conditioned matrix $A$, and you compute its inverse with LU/GE to get $X_{\text{lu}}\approx A^{-1}$.
The Newton-Raphson iteration
$$ f: X \mapsto 2X-XAX $$
generally converges to the matrix inverse of $A$.
Does computing applying the Newton-Raphs... |
I have been trying to solve a nonlinear PDE related to structural mechanics (nonlinear Timoshenko beam to be precise). I am doing both h-refinement and p-refinement to reach the solution. The nonlinear equations were solved using Newton-Raphson method and I am comparing my solution (transverse displacement at a specifi... |
I need to calculate the integral of this function
def f(z):
return ((1-2*z)*np.exp(-d/z))/(((1-z)**(2+d))*(z**(2-d)))
Here d is a constant. I am using this function:
import scipy.integrate as integrate
return integrate.quad(f,0, 5)
However, I need to calculate this for many different d values. I tried putting a... |
This example is a dummy example, but it describes exactly whats goes on in my problem.
As a result from some sympy calculation and manipulation i got two arrays
array_1 = ([f_1(x,y) 0 f_3(x,y) ])
array_2 = ([g_1(x,y) g_2(x,y) g_3(x,y) ])
where f_n(x,y) and g_n(x,y) are complex functions. When I prin... |
I have a loop that has a similar structure as give below:
DO WHILE (t < tend)
t = t + dt
DO j = 1,dim
var2 = 0
CALL func_a(param1,var2)
CALL MPI_COMM_RANK(comm(j),rank,ierr)
CALL func_b(param1, var2,rank)
var2 = var2 + 0.5d0*var3(j)
CALL func_c(var3,param1)
var2 = var2 - 0.5d0*var3
... |
Assuming that the underlying algorithm can be ported to multi GPU, what aspects should one consider while porting from MPI (on multiple nodes) to multi GPU (again on multiple nodes)?
Making use of Hyper Q ? Of MPS ? Peer to peer communication ?
For example, if we consider an MPI code that solves for the Navier Stokes ... |
I am trying to solve a LP in which one of my constraints is of the form
$$\frac{A(x)}{B(x)} = 1$$
I transform this constraint into a linear one
$$A(x) - B(x) = 0$$
However when CPLEX solves the problem, this constraint is of the order of ~1.e-5, but the ratio is of the order of ~1.4, which is a large deviation for my ... |
I'm doing some simulations of the Langevin equation, for various external forces. Being told that C's rand() from stdlib.h can introduce bias in my results, I'm using a Mersenne Twister.
Nevertheless, I would like to know (and see) exactly what kind of errors a linear congruential generator can introduce in my simulati... |
I am simulating the wave equation using FEM. For a 2D wave equation, when I visualise my output in Paraview, I see a separate solution in 'x' and 'y' direction for each node on the mesh. Therefore, if I freeze the time, I will have a solution vector of the size: (No. of nodes x 2). This makes sense to me because when a... |
I understand these equations in particular can be solved easily without use of computational methods. Although right now I am concerned with trying to solve these equations using numerical integration strictly.
$$ \frac {\partial ^2 E}{\partial t ^2} = c^2 \frac {\partial ^2 E}{\partial z ^2} \tag{1}$$
$$E(t=0) = \sin(... |
I have a linear system of equations $Ax = b$ where the number of unknowns $N$ is intractably large but the right-hand side has only small support and the unknown $x$ is known to decay exponentially. I hence want to find a sequence of reduced linear systems $A_n x_n = b_n$ with only $n \leq N$ unknowns such that $x_n \t... |
I need to find the roots of a function. I am currently using scipy.optimize.fsolve
def f(z):
return ((1-2*z)*np.exp(-d/z))/(((1-z)**(2+d))*(z**(2-d)))
# d is a constant ndarray of shape(300000,)
# hence f(z) is an ndarray of shape (300000,)
def trap(func,a,b,num): #trapezoidal approach... |
I am reading the paper, http://math.mit.edu/~gs/cse/codes/mit18086_navierstokes.pdf
I want to solve an optimization problem using this Navier-Stokes code as constraining PDE. Now I am trying to add an external force parameterized some input parameter to the method. The method solves the Navier-Stokes equation in 3 step... |
I have to solve the following equation:
$-u_{xx}=1$,
with $x\in(0,1)$ and $u(0)=0,u(1)=0$. I have to solve it with the following numerical scheme:
$\frac{1}{h_k^2}(-\frac{1}{2}u_{k-1}+u_k-\frac{1}{2}u_{k+1})=1$. So I have to use a non-uniform grid. I have done this so far:
n = 4; %Number points
k = 0:n;
x = 0.5 - 0.5*c... |
Is there a single noun that indicates unambiguously (to a computational scientist, at least) "the ordering (row-major or column major) used in an array"?
For instance, the term endianness (or sometimes even the odd-sounding byte sex) refers to whether a word is stored in little-endian or big-endian order, and one singl... |
I would like to solve in Matlab the following optimization problem
$$\begin{array}{ll} \text{maximize} & \bigg\| \displaystyle\sum_{l=1}^{2}\alpha_l \int_{\tau_{m+l-1}}^{\alpha_1\tau_m+\alpha_2\tau_{m+1}}e^{J(h-s)} \mathrm{d}s \bigg\|\\ \text{subject to} & \alpha_1+\alpha_2=1\\ & \alpha_1, \alpha_2 \geq 0\end{array}$$
... |
Given a distributed Epetra CrsMatrix $A$, along with a a list of rows, a list of columns and a processor ID, I would like to extract a sub-matrix $A_{sub}$, all the entries of which should be stored on the specified processor.
I think this may be done with Import/Export object with suitably defined maps but I cannot se... |
In the following staggered grid setting,
I want to solve diffusion equation as a linear system.
$$\frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}$$
For discretization, use central difference for space and backward euler for time, you can obtain
$$\frac{u^{n+1}-u^{n}... |
I have an application in sensitivity analysis of complex system models with moderately nonlinear interactions between arguments
Arguments potentially dozens or hundreds in number
Arguments mostly real-valued but some categorical with a handful of levels (unordered settings) per variable
The outputs of interest are rea... |
I'm trying to perform inference over a subset of the latent variables of a hierarchical hidden Markov model I built.
I've derived the relevant optimization problem, but it's a pretty nasty piece of work, I'm wondering if I have any hope of optimizing the following expression:
\begin{align}
&\max_{z}\frac{\pi_{z_1}}{(\s... |
Good morning
I'm trying to develop an unstructured CFD code to solve Euler equations in a finite-volume (cell-centered) context (learning purposes). I was able to build from a cgns file some basic information for the code. What I have now are:
Node index and its 'x' 'y' coordinates.
Element index and nodes (indexes) t... |
I'm aware that a 2nd order accurate finite-difference method using variable properties for central differencing can be written in a finite-volume type way:
$$ \nabla \bullet (k \nabla f) = \frac{\frac{f_{i+1}-f_{i}}{\Delta x_{i+1/2}}k_{i+1/2}-\frac{f_{i}-f_{i-1}}{\Delta x_{i-1/2}} k_{i-1/2}}{\Delta x_{i}}$$
This discre... |
I want to compute $\Delta f/f$ (as explained in this link, reference 1), but I am not able to do integration as I have distinct values and no function to generate the continuous time based values.
I have a $1\times N$ time series data where $N$ is the total number of neuron response for one neuron, one for each millise... |
First of all, let me set up some notations.
Suppose we have a hierarchy of meshes $\mathcal{T}_0 \subset \mathcal{T}_1 \subset \dots \subset \mathcal{T}_n$. For simplicity I restrict myself here to $\mathcal{T}_H := \mathcal{T}_0 \subset \mathcal{T}_1 =: \mathcal{T}_h$:
$\mathbb{U}_H$ and $\mathbb{U}_h$ are spaces of... |
My goal is to create a numerical solution of 1D-solute transport (Convective-dispersion equation, CDE) to match it's analytical solution based on experimental data. The CDE can be written as (where, C= solute concentration, D= dispersion coefficient, v=velocity, t=time):
$$-v\frac{\partial C}{\partial x} + D\frac{\part... |
[t,y] = odeXX(odefun,tspan,y0)
I have a solver odeXX, and the tspan = [0 0.0001]. It seems that for any ode solver in MATLAB, they integrate by breaking tspan into multiple steps (some adaptive like ode45 and some non-adaptive). But I am looking for the most primitive one--just integrate from 0 to 0.0001 in one step. W... |
I have a PDE that I solve in MATLAB over a 2D domain using the "recommended workflow", i.e. the functions descg, createpde and so on. The solver (solvepde) works and return a solution which looks reasonable. So far so good.
Now I want to take the result and calculate various integrals on it over the whole domain. Mainl... |
I am using CVX to solve an optimization problem. One of my constraints in the problem is
$$M \succeq \eta {\eta}^T$$
where $M$ is a square matrix and $\eta$ is a column vector (both $M$ and $\eta$ are variables). CVX issues the error
Only scalar quadratic forms can be specified in CVX.
I think the error results fro... |
Rather than
gesv -> solve $AX = B$
gemm -> compute $M = BX$,
somehow I feel there are better ways to compute $M$ with lapack/mkl?
|
Unlike finite element (FEM) or finite difference methods (FDM), where the original PDE is transformed into a sparse linear system, spectral methods return a dense linear system. For a large system, it's not practical to use the a direct elimination method, so a natural choice is iterative methods. As far as I know, mos... |
In Hamiltonian Monte Carlo, Hamiltonian dynamics are used to generate new proposals from the current state. I understand why these dynamics are used as opposed to random walk behavior to generate proposals, but I don't understand why Hamiltonian dynamics are used as opposed to any other dynamics. Could someone please... |
The partial differential equation is a combination of the diffusion plus convective transport equations and an adsorption sink. The equation for one-dimensional solute transport model is:
$$\frac{\partial C}{\partial t} = D\frac{\partial^ 2C}{\partial^ 2x}-v\frac{\partial C}{\partial x} - \frac{\rho}{\theta} \frac{\pa... |
I am looking for a kind of modern test set of large nonlinear problems. The only option I managed to find so far is rather dated: http://folk.uib.no/ssu029/Pdf_file/Testproblems/testprobRheinboldt03.pdf
|
What will be the complexity of finding Gini Index of a sorted vector of $N$ values, which is defined as:
$Gini(\mathbf{x})=1-2\sum_{k=1}^N \frac{\mathbf{x}(k)}{\Vert\mathbf{x}\Vert_1}(\frac{N-k+.5}{N})$
|
I have to simulate a cylinder moving in transverse direction due to an external force (no damping). The equation of motion is: $M\frac{d^2Y}{dt^2}+kY = F_Y$
My confusion is regarding $kY$, how to get displacement when the cylinder is not at $(0,0)$ but at an arbitrary position say, $x_c=0.5, y_c=0.5$. The cylinder shou... |
I have to solve this equation
$$\ddot{x}x = -\frac{3}{2}\dot{x}^2 + \frac{\dot{x}}{h} + \sin(t)$$
where $h$ is defined by
$$h = \left(\frac{\dot{x}}{h}\right)^{1/3} + \frac{\dot{x}}{h}$$
My idea is to initialize $h=1$, solve the first equation, calculate a new value for h:
$$h = \frac{\dot{x}}{x\ddot{x} + (3/2)\dot{x}^... |
How can I determine a matrix $R$ in matlab such that, given a known matrix of coefficients $A$ gives me back its row reduced echelon form? Obviously I need an algorithm/function that works also with matrices that are not fully ranked.
$$
RA=\text{rref}A
$$
I don't know how to handle this... please can anybody help me... |
I'm developing my own generic Runge-Kutta solver, and I'm currently implementing the adaptive step-size routine. I say generic because I want to be able to test different RK implementations by only passing the solver a Butcher tableau, such as the following.
\begin{array}{c|cccc}
c_{1}&a_{11}&a_{12}&\dots &a_{1s}\\
c_{... |
I am trying to solve the Poisson equation in a rectangular domain using a finite difference scheme with a rectangular mesh.
I have happily generated the matrix system of equations Ax = b which is required to be solved, but when I try to impose Neumann boundary conditions (using ghost cells) of zero gradient I am runnin... |
Using the code from http://math.mit.edu/~gs/cse/codes/mit18086_navierstokes.pdf, I simulated cavity flow with an external force with the boundary conditions on the all 4 sides are $u=v=0$ and $\frac{\partial p}{\partial n}=0$. I just added external force to u direction in the step that calculates nonlinear term
$$\text... |
I have a set of data, $x, y$ and $ z$, each with length n:
$x \rightarrow \{x_{1}...x_{n}\}$
$y \rightarrow \{y_{1}...y_{n}\}$
$z \rightarrow \{z_{1}...z_{n}\}$
$y$ and $z$ are parameterised by $x$:
$y = y(x)$
$z = z(x)$
Problem 1
I wish to find derivatives $\Large \frac{dy}{dx}$ and $\Large \frac{dz}{dx}$.
The 'secon... |
Suppose that we have to find an optimal solution $x^*$ to an optimization problem involving some function $f$, such that $0\in\partial f(x^*)$ where $\partial$ denotes the subdifferential.
Let $(x_n)_{n\ge 0}$ be a sequence generated by some algorithm, satisfying $\lim\limits_{n \to \infty} (x_{n+1} -x_{n}) = 0$, and t... |
I have to solve this problem
$$\left\{\begin{matrix}
y''=4y'+\frac{1}{h}-7y\\
y(1)=1\\
y'(1)=1
\end{matrix}\right. \text{where} \; h=5y'-2y$$
as it were a DAE (I know I could just substitute $h$ into the equation, but this is just an example, because in reality the problem I have to solve is a DAE and more complex th... |
Let say I have N computers and 2 N-by-N matrices distributed across them called A and B. Matrix A is row distributed while B is column distributed. Therefore, processor i knows
A(i,1:N) and B(1:N,i)
Do you know an efficient way to determine if A and B are identical that scales well to many processors? (some kind of ch... |
As far as I know, precision errors become larger as the condition number of a matrix increases.
Consider a matrix-based operator:
$$A = \nabla \bullet k \nabla $$
And a matrix-free operator:
$$\tilde{A} = B_{1} + B_{2} + B_{3}, \qquad B_{i} = \partial_{x_i} k \partial_{x_i}$$
One difference between the matrix-free oper... |
Bengt Fornberg derived a general way to compute the weights for arbitrary finite difference schemes in two papers: his 1988 paper and (better) his 1998 paper.
What are the numerical errors associated with his approach as codified in the 1998 paper? Can the truncation and round-off errors be calculated for double preci... |
There are a number of packages available for generating Continuous Galerkin (CG) FEM meshes (gmsh, tetgen, netgen, etc.), but I have been unable to find one that generates Discontinuous Galerkin (DG) FEM meshes.
I'm currently interested in focusing on the solver part of DG, not the mesh construction, so a package that ... |
According to this article from Wikipedia, the box-covering algorithm calculates the fractal dimension of a graph. The algorithm is based on the concept of distance between nodes; see for example the sentence:
A box consists of nodes separated by a distance $l < l_B$.
The distance between nodes can be defined also for... |
I have a generalized eigen-problem: $A\psi = \lambda B \psi$ with $A$ and $B$ are large (>1000) complex non-Hermitian matrices. I know that eigenvalues with largest and smallest absolute values can be found using iterative approaches like ARPACK. But I am only interested in those complex eigenvalues (not all of them) w... |
When does it typically make sense in programming to be testing the equality of two floating point numbers?
i.e.
a == b
where both a & b are floats.
My naive impression is that one would always test the difference against some tolerance epsilon.
Am I wrong? Can testing the equality of floats be meaningful in certai... |
I want to solve a small (20 $\times$ 20 up to 30$\times$30) system which is not symmetric, not diagonally dominant, and not sparse. Each row contains a modified form of the Legendre coefficient of a set of user specified functions. The difference between between each row is that the functions are raised to a different ... |
I have the following PDE.
$\frac{\partial c}{\partial t} + v\frac{\partial c}{\partial x} - D\frac{\partial^2 c}{\partial x^2} = 0
\\$.
I have discretized it such that i now have
$\frac{dC}{dt} = aC_{i+1} +bC_{i} +cC_{i-1} \\$ (1)
I have been given the following initial conditions:
$\\C=C_0\quad\forall \ 0<t<\tau... |
How can the non-smooth functions be integrated using Matlab? Can the Cash-Karp Method be used? The Dormand-Prince method seems to give an error while integrating a nonsmooth solution.
I am using MATLAB ODE45 for the integration of my ordinary differential equation.
$\{q\}$ is a Column Vector of length 14. The excitati... |
Concerning edge finite element (not nodal element), is there any explicit function (e.g. polynomial) to describe the interpolation within the element?
I've read numerous literatures such as "Mixed finite element methods and application" by Boffi et al, and "FENICS manual (https://femtable.org/)". I could follow the co... |
Suppose I wish to solve the following optimization problem:
$$
\begin{array}{rl}
\min_{\mu\in\mathbb{R}^n} &\mu^\top c\\
\textrm{subject to} & \mu\in C_1\cap C_2\cap\cdots\cap C_k,
\end{array}
$$
where each $C_i\subseteq\mathbb{R}^n$ is a convex set. Furthermore, I have access to projection operators
$$
p_i(x):=\left\... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.