instruction stringlengths 43 28.1k |
|---|
I noticed that 'Eigen' matrices with dynamic dimension are less efficient than the matrices with static dimension. My algorithm uses a lot of matrices which don't need to be resized, so I wanted to use static dimensions, but the dimension is not known in advance and this doesn't work:
const size_t n = 3;
Eigen::Matrix<... |
Why does the dot() function in MATLAB return different expressions based on the order in which I pass vectors?
|
I want a tool for load rebalances.
I have a distributed grid. Each process can handle a part of the global grid. Each process has a different node and I want to rebalance it. I want a tool that can give color on a distributed grid.
A typical procedure is:
before rebalance:
process 0: 1000 node
process 1: 600 node
aft... |
A finite set $R$ of fixed, axis aligned 2-D rectangles $r_i=\left\{x_{0i},y_{0i},W_i,H_i \right\}$ is given. These rectangles are potentially overlapping. Given a new axis aligned rectangle $t$, I would like to find the subset $S \subset R$ with minimum number of elements $M$ such that $t \subset \underset{i=1,\ldots,M... |
I have a sparse $n\times n$ matrix $A$ with a pretty interesting structure. It has a block structure with a symmetric structure but asymmetric blocks. Expressed mathematically the block $A_{jk} = A_{kj}$ but $A_{jk} \neq A_{jk}^T$, so my matrix is not actually symmetric. Are there any algorithms that can take advantage... |
In general,if we know that the marginal Gaussian distribution for some variable $\textbf{x}$ and a conditional Gaussian distribution for some $\textbf{y}|\textbf{x}$ of the forms:
$$p(\textbf{x}) = \mathcal{N}(\textbf{x}|\boldsymbol{\mu},\Lambda^{-1})$$
$$p(\textbf{y}|\textbf{x}) = \mathcal{N}(\textbf{y}|A\textbf{x}+\t... |
I am looking for a general purpose library which can solve a 2D or 3D linear elliptic PDE on a rectangular domain with mixed/Robin boundary conditions. I am a C programmer, so I would prefer a C library, but fortran is ok too since its easy to call fortran code from C. So far I have found only 1 option: MUDPACK. This i... |
Do the faces of tri-linear hex elements have to be planar? Three nodes define a plane. If the fourth node does not lie on the plane, then the nodes are not planar and the face is not plane. In general, the geometry of element may not be convex. Will this cause problems in mapping the element to the unit cube? If I reca... |
Given an LU decomposition of $A\in \mathbb{R}^{n\times n}$, is there a way to compute $\operatorname{trace}(A^{-1})$ with lower complexity than that of the inversion ($O(n^3)$ in practice)?
This question has been asked already on Mathoverflow twice and on Math.SE, but the answers there are not useful.
|
In https://commons.wikimedia.org/wiki/File:YI_%3D_PI.png, you will find a formula-based solution for an overdetermined logical matrix pseudoinverse. This simple formula gives the same result as the Moore-Penrose method. Does anyone know of any other overdetermined logical matrices that can be solved without using SVD m... |
In linear elasticity, the governing PDE is the equilibrium equations (absent of vibration considerations):
$$
-\nabla \cdot \sigma = F
$$
Is this equation simply derived from the sum of forces and moments?
In most linear elasticity papers, I see these governing equations. Is there an original source for where these equ... |
Let $\Omega\subset \mathbb{R}^{2}$ and $\tau_{h} = \{\Omega_{k}\}_{k=1}^{N}$ be a triangulation of $\Omega$. The $L^2$ error for a FEM approximation $u_{h}$ is given by:
$ || u-u_{h} ||_{L^2} = \sqrt{ \int_{\Omega} \left( u-u_{h} \right)^2 } = \sqrt{ \sum_{k=1}^{N} \int_{\Omega_{k}} \left( u-u_{h}^{k} \right)^2 } $.... |
I have a problem where I have to minimize a certain quantity $Z$ subject to the following constraints:-
$w_1 + w_2 + w_3 = 1$
$\frac{f_1(w_1*Z) + f_2(w_2 * Z) + f_3(w_3 * Z)}{Z} >= k$
where $k$ is a known constant. $f_1$, $f_2$ and $f_3$ are non-linear functions that we have empirical curves for. (These curves are a... |
Consider we have a linear bivariate polynomial:
$$p(x,y)=ax+by+c.$$
To construct the linear polynomial using least square method, we need to evaluate the value of the average polynomial $p$ in at least in three cells that approximately must be equal to the average of conservative variable $\bar{\psi}$.
$$\frac{1}{\Delt... |
In cubic spline interpolation, we use the set of knots and function values $(x_i,y_i),i=1,...,n$ to construct a (tridiagonal) system of equations for the unknowns $\sigma_i$:
$$
h_{i-1}\sigma_{i-1} + 2(h_{i-1} + h_i)\sigma_i + h_i \sigma_{i+1} = \Delta_i - \Delta_{i-1}
$$
where $h_i = x_{i+1} - x_i$ are the distances... |
I'm trying to find a convergent finite difference scheme for the PDE
\begin{equation}
\begin{split}
u_t + (x-1) u_x &= (x-1)u, \hspace{.5cm} x \in [0,1] \\
u(x,0) &= 1 \\
u(1,t) &= 1. \\
\end{split}
\end{equation}
I know that the exact solution is $u(x,t) = e^{(x-1)(1-e^{-t})} $, but just wanted some practice working w... |
I'm currently using Python's scipy.optimize package to perform parameter estimation for a system of 10 ODEs. I have some observed data, and I'm trying to find the set of parameters which makes the ODE solution best fit the data in the least squares sense. (The ODE, by the way, doesn't have an analytic solution, so I'm ... |
I want to write the following anonymous function in MATLAB.
I have a piecewise function. I want to turn this into a single expression. How can this be accomplished in MATLAB ?
$$f(x,t) =
\begin{cases}
20e^{-4x^2} & \text{if $0 \leq t \leq T/2,$} \\
0 & \text{otherwise.}
\end{cases}$$
|
Context: Hello, I am an undergrad student of physics self-studying Python Programming. I am trying to find the value of H_lam for which limit cycles corresponding to the triple galaxy system governed by the equations
given here occur
Code
# Import solve_ivp, matplotlib, numpy
from scipy.integrate import solve_ivp
impor... |
I'd like to visualize scalar data located on the nodes of a quad mesh (2D) using VTK in Python3. The closest example I've found is vtk quad mesh, but it only seems to visualize the mesh, not data on the mesh. Could someone point me to a better example?
|
I'm using lattice Boltzmann method (LBM) to do simulation of flow in a pipe. The diameter of the pipe is 0.02 m and its height is 0.1 m. I put a parabolic velocity profile at the inlet:
$$\mathbf{u}(\mathbf{r},t) = \bar{u}(t) \Bigg(2 - \frac{2|\mathbf{r}-\mathbf{r}_{C}|^{2}}{R^{2}}\Bigg)$$
Where $R$ is the radius of th... |
What I'm trying to do is simply a variation of a heavyside function, for 3 before the discontinuity and 4 after. But when I plot it, at the discontinuity it's not a straight vertical line but a sort of $x=\alpha*x$ function.
Can someone explain why it's like that?
|
I want to implement the upwind method in following advection equation problem :
$$ u_{t}+2 u_{x} =0 ,$$ for $0\leq t \leq 1,$ $0\leq x \leq 1 $
$$ u(0,x) = u_{0}(x) = \begin{cases}
10^4 (0.1-x)^2 (0.2-x)^2 & 0 < x < 0.2 \\
0 & otherwise
\end{cases} $$
with wind coefficient $\alpha = 2 $ , $Nt = 10... |
I have non-symmetric real-valued matrices with real-valued eigensystems. How to compute eigenvectors efficiently?
Using scipy.linalg.eig (which calls dgeev) is 3-4 times slower than scipy.linalg.eigh (=>dsyevd) and 2x slower than scipy.linalg.svd (=>gesdd), but neither SVD nor hermitian eigenvalue decomposition are app... |
I am searching for a faster method to calculate an approximate inverse of a large matrix (up to 32000x32000) resulting from a discrete non-linear system of partial differential equations. I'm using C++ together with the Eigen library (MKL activated). Unfortunately the resulting matrix is not sparse as it can be seen in... |
I have been writing a software package in Fortran for solution of the Vlasov-Poisson system in 2D2V. I want this software to be useful beyond its current application (e.g. systems with different number of position or velocity dimensions, change in numerical methods used, solution of full Maxwell system, etc.), which le... |
I've set up a system of differential equations, obtained after discretizing pde, in the following way
dY(1) = terms_starty;
dY(end) = terms_endy;
dY(2:end-1) = (1./Vector1).*(Matrix1*Y+Matrix2*Y);
dZ(1) = terms_startz;
dZ(end) = terms_endz;
dZ(2:end-1) = (1./Vector1).*(Matrix1*Z+Matrix2*Z);
dYZ = [dY dZ];
I'm solv... |
I have the following inhomogeneous parabolic initial/boundary value problem:
$$u_{t}(t,x) = (1-x^{2})u_{xx}(t,x)+u(t,x),$$ for $t \in [0,1]$ and $x \in [-1,1]$
$$u(0,x) = \sin(\pi x),$$ for $x \in [-1,1]$ initial condition
$$u(t,-1)=u(t,1)=0,$$ $t \in [0,1]$ Dirichlet boundary conditions.
I want to construct a Backwar... |
What is the reason NVIDIA's Turing has twice the FP16 performance compared to it's FP32 whereas AMD has same performance in FP16 and FP32?
Like GTX 1650 Super has around 8 teraflops in FP16 but half of that in FP32.
RX 580 has around 6.174 teraflops in FP16 and same number in FP32.
|
Is there any computation accelerator (like a GPGPU) available, that natively (this means in hardware, not emulated by a library) supports arithmetics using floating point numbers with a fractional part longer than 64 bit (like e.g. IEEE 754 quadruple-precision)?
|
I'm trying to solve 2D unsteady compressible Navier-Stokes equations with finite-difference or finite-volume method. Here is the system, it's pretty standard:
$$
\frac{\partial U}{\partial t} +
\frac{\partial F}{\partial x} +
\frac{\partial G}{\partial y} = 0;
$$
$$
U = \left( \begin{array} {c} \rho \\ \rho u \\ \rho ... |
I'm more or less familiar with procedures and methods to fit a curve to experimental data, and I have done this many times using Matlab. However this time I have a problem that I'm not sure how to solve and I'm stuck.
I have some experimental data which I have plotted in the figure below (blue curve).
The data seem to... |
Problem
I'm trying to calculate CPU / GPU FLOPS performance but I'm not sure if I'm doing it correctly.
Let's say we have:
A Kaby Lake CPU (clock: 2.8 GHz, cores: 4, threads: 8)
A Pascal GPU (clock: 1.3 GHz, cores: 768).
This Wiki page says that Kaby Lake CPUs compute 32 FLOPS (single
precision FP32) and Pascal cards... |
I am trying to simulate a 2-DOF planar robotic manipulator (have its joints follow a predefined trajectory) that's described by its dynamic model:
$$ M(q)\ddot{q}+C(q,\dot{q})\dot{q}+G(q) = \tau $$
where $q = [q_1 \ q_2]^T $ are the angles of the two joints, $\dot{q}$ the angular velocities and $\ddot{q}$ the angular a... |
In this StackOverflow answer, @Gokul has shown how to get a basis of the kernel of a matrix with the help of the 'Eigen' function CompleteOrthogonalDecomposition. The complete orthogonal decomposition of a matrix is related to the so-called URV decomposition of this matrix. I don't know this topic. I read somewhere th... |
The Problem
The TR-BDF2 explained in this paper [1], is quite a popular numerical scheme used to integrate $\dot{y} = f(t,y)$, consistent of the following two stages:
\begin{align}
y_{n+\gamma} & = y_n + \gamma \frac{h}{2}\left( f_n + f_{n+\gamma} \right) \tag{1} \\
%
y_{n+1} & = \frac{1}{\gamma(2-\gamma)}y_{... |
Imagine I have a differential equation and I have some data and the model is supposed to fit the data. If I now rescale the time in the range 0 to 1, do I need to adjust the parameters of the equations? How would one adjust them?
|
The Problem
I am currently reconstructing a TR-BDF2 scheme which contains the following two stages:
\begin{align}
y_{n+\gamma} & = y_n + \gamma \frac{h}{2}\left( f_n + f_{n+\gamma} \right) \tag{1} \\
%
y_{n+1} & = \frac{1}{\gamma(2-\gamma)}y_{n+\gamma} - \frac{(1-\gamma)^2}{\gamma(2-\gamma)}y_n +
\frac{1-... |
I know that the the Conjugate Gradient iteration fails when $0\in \mathcal {W}(A^{H})$, which means there's a complex vector $x+iy$ such that $(x+iy)^{T}A^{H}(x+iy)=0$. I wonder how to derive a real initial vector such that the Conjugate Gradient iteration fails if $A$ and $b$ are real based on this complex vector? The... |
I try to solve a system of coupled equations, where a very nasty division operation occurs. In fact, I need to compute a derivative of two exponential decaying functions. Let's illustrate this with the following example which can easily computed in an analytical way. Assume we have given the function $$f(z) = e^{-2z^2}... |
I need to calculate the magnetic field along a straight line in proximity of an array of 6 magnets. I used the tutorial files "magnets" included in Gmsh and I slightly modified the file in order to describe the position of the magnets in my desired configuration.
I set the mesh size with a rather small value:
Mesh siz... |
I would like to calculate the Adjugate matrix of a given matrix $A$, and its updates in the diagonal:
$B=A-\lambda I$, where $I$ is the identity matrix, $\lambda$ is a scalar. To this end, I am using the algorithm explained here, using a decomposition $A=XDY$. Unfortunately, the matrix $A$ or $B$ could be singular.
Is ... |
I want to detect chords on a guitar as early as possible, but my approach with a sliding window and a filter bank seems to introduce too much lag.
Would required observation time decrease by using a model where there are only a finite number of tones possible and only a finite number of simultaneous tones? (I.e. the di... |
I need to have a sparse matrix whose elements are not simple numbers, but objects, e.g. a couple of floating point values and a bunch of integer indices.
I am wondering if Eigen has something similar, beyond its Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex > class template (the only sparse matrix I have found ... |
Are there interesting examples of (systems) of equations where it is known to be harder to find a solution (in terms of scaling with respect to problem size) than verifying a provided solution for correctness?
A non-expert may find it surprising that Stein, Riccati, Sylvester matrix equations with $d\times d$ matrices ... |
Thanks for note! So I have an optimization problem with simple form but the decision variable is a large-scale matrix. My problem is similar to a existing problem here about multinomial manifolds and my objective function is simpler than the counterpart in that problem. The decision variable $\mathbf T \in {\bf R}^{130... |
In a machine learning code, that computes optimum parameters $\theta _{MLE}$ of a linear regression model, by maximum likelihood estimation:
$$ \boldsymbol \theta^\text{ML} = (\boldsymbol\Phi^T\boldsymbol\Phi )^{-1}\boldsymbol\Phi^T\boldsymbol y $$
Where $y$ is the target vector and $\Phi$ is the polynomial feature mat... |
I write the following fast Fourier transform code into my Python notebook expecting to see a plot wherein there's a spike at $1/2\pi$ since that's the frequency of the sin function, but instead I get the plot below. Any ideas as to what's going on?
import math
import matplotlib.pyplot as plt
import numpy as np
from sci... |
I want to study the dynamics of a 2d linear flow, whose dynamical equation is- $\begin{pmatrix} \dot{x_1}\\ \dot{x_2}\\ \end{pmatrix}=\begin{pmatrix} 1 & 1\\ 4 & -2\\ \end{pmatrix}\begin{pmatrix} x_1\\ x_2\\ \end{pmatrix}$. Now I have tried to solve and plot y vs. x of this coupled differential equation using RK4 in py... |
Say I have a directed graph given as an adjacency matrix $A$ in CSR format represented by the arrays ia (row indexes) and ja (column indexes).
In my application the graph serves as the underlying spatial connectivity for an RBF-FD discretization of a PDE. The graph originates from finding the $N$-nearest neighbor stenc... |
I need to solve the following equation for $x$ in [0, 1]. Assume $0<\alpha<1$ and $0<\lambda$.
$$(1 - x)^{\alpha+1} - \lambda (x+1)^{\alpha+1} = -2\lambda (\alpha + 1) x^\alpha$$
Would very much appreciate any kind of help!
|
As far as I understand, you need to define boundary conditions in time and space to select a unique solution to a PDE and make it solvable. However, in ODEs I only need to specific the initial value in time which I think of as a boundary condition. If I now use the method of lines to transform a PDE into a system of OD... |
I have two masses, and two springs which are atattched to a wall on one end. For context I attached the system of equations.
How can I add a command to see my analytic solution for my system of equations? I want to be able to compare the numeric vs analytic. I think it would be something like (t, answer, t, answer). T... |
I have created a program to solve 2D, time-dependent PDEs with the finite element method and get reasonable looking results for the 2D acoustic wave equation. Now I would like to go further and solve a PDE with a known exact/analytic solution to compare against. However, I have a lot of trouble finding a suitable equat... |
It is well known that unpreconditioned Krylov subspace methods applied to the finite-difference-discretised Poisson equation with $n$ grid points per direction require $O(n \, |\log(\varepsilon)|)$ iterations to reduce the error in the initial guess by a factor $\varepsilon \in (0,1)$. This is typically a prohibitively... |
We have challenge in my current assignment where we need to modify/minimize an existing logical expression to another new logical expression. But the result should be the same.
For eg: the ask to convert
(1 AND (2 OR 9 OR 10) AND (3 OR 4 OR 5) AND (6 OR 7) AND 8) OR (1 AND (2 OR 9 OR 10) AND (11 OR 12) AND 8)
into
1 AN... |
According to the Wikipedia article on Singular Value Decomposition, the asymptotic complexity of computing the SVD of an arbitrary m×n matrix M with m>n by the popular Householder QR methods is O(mn2). Are there any algorithms (perhaps Householder QR) that provide better asymptotic guarantees for fixed-rank matrices?
I... |
We want to start a new project to solve a large-scale inverse problem (O(10^6) number of parameters) to invert for subsurface wave speeds. We will use FEM to solve forward and adjoint PDEs. In our project, we will need to have both sparse and dense solvers. Previously in similar projects, we were using PETSc library bu... |
We are comparing two techniques in computer science.
We want to say X has "significantly high latency" when executed on system Y.
Is there a better one-word term we can use for the above to mean the same as 'significantly high latency'?
e.g., slow <-- but a better word than slow?
|
I am converting some MATLAB code in to python and have the encountered the error "ValueError Traceback (most recent call last)
in
1 for ig in range(nbas):
----> 2 psi[:,ig] = np.polyval(np.array(pp[ig,:ig]),nodes)
ValueError: could not broadcast input array from shape (56,1) into sh... |
I have been granted access to a cluster running PBS and I'd like to run a Evolutionary Algorithm (EA) on it.
To those unfamiliar with EAs, Wikipedia summarizes it as:
Part One: Generate the initial population of individuals randomly (first generation).
Part Two: Repeat the following steps until termination:
Evaluate t... |
The Problem
I would like to determine the gradient of a least squares objective function which depends on a vector of 40 parameters $p$, and the solution of a system of 32 differential equations. In specific, let the aforementioned system be:
$$\dot{y} = f(t,y(t,p),p) \tag{1}$$
then the least squares objective functio... |
Suppose I have solved an ODE $v'(t) = f(t,x)$ via some adaptive stepper, such as RK4 or Dormand-Prince, generating a list of points $\{(t_i, v_i, v_i' = f(t_i, v_i))\}_{i=0}^{n-1}$.
I wish to use this data structure to compute the curvature and torsion of the ODE solution, however, computation of curvature requires acc... |
I would like to find the contours of a scalar function $u(x,y)$ available as a discrete set of function values $u_i = u(x_i,y_i)$ over a scattered set of points $(x_i,y_i), i=1,...,N$.
In my case, the scattered data comes from a numerical solution to a PDE using the RBF finite difference method, however interpolation o... |
I want to implement the Lax Wendroff method for a non linear advection equation which is
$$\frac{u_{i}^{n+1}-u_{i}^{n}}{t} + \frac{f(u_{i+1}^{n})-f(u_{i-1}^{n}) }{2h} -\frac{t}{2h} \left( F_{i+1/2}^{n} \frac{f(u_{i+1}^{n})-f(u_{i})^{n}}{h}) - F_{i-1/2}^{n} \frac{f(u_{i}^{n})-f(u_{i-1}^{n})}{h} \right)=0$$
for the probl... |
I want to solve an underdetermined system of linear equations $A x = b$ with $A \in \mathbb{R}^{n \times r^2}, x \in \mathbb{R}^{r^2}, b \in \mathbb{R}^n$. The matrix $A$ has the following additional structure: each row of $A$ takes the form $v_i \otimes v_i$ for some $v_i \in \mathbb{R}^r$ (here $1 \le i \le n$). (I.e... |
I'm very new to computational Physics and am finding conflicting statements on whether the velocity Verlet algorithm, defined as:
$\begin{align}
x_{n+1} &= x_n + v_n \Delta t + \frac{1}{2} a_n \Delta t^2 \tag{1}\\
v_{n+1} &= v_n + \frac{1}{2}(a_n + a_{n+1}) \Delta t \tag{2}
\end{align}$
is time-reversible.
From my unde... |
There are $N$ particles with positions $x_i(t)$ and velocities $v_i(t)$ and mass 1. There is a potential function $U_{i,j}(x_i, x_j)$ between each pair of particles, which is $0$ unless the particles are close enough. I want to update the simulation so that total energy $\sum_{i,j} U_{i,j}(x_i, x_j) + \sum_i \frac{1}... |
I am solving a structural mechanics problem that involves setting constraints, and I use Lagrange multipliers to set it. Consequently, some diagonal entries of the tangent stiffness matrix vanish, and I couldn't solve the system using the KSP solver.
I will appreciate any help.
|
I need to solve linear equations system Ax = b, where A is a sparse CSR matrix with size 500 000 x 500 000. I'am using scipy.bicgstab and it takes almost 10min to solve this system on my PC and I need to repeat this calculations in loop so there's a need to speed up the calculations.
Is there a way to somehow paralleli... |
I am currently facing some challenge implementing a less traditional PDE which take a form similar to the Navier-Stokes equation, except that the continuity equation is modified such that:
$$\epsilon \nabla \vec{u} + \vec{u} \cdot \nabla \epsilon + \frac{d\epsilon}{dt} = m $$
where $\epsilon(t,\vec{x})$ is known at all... |
Are there any well-known algorithms for partitioning a dense tensor into block-sparse form?
In other words, I need to find a set of non-overlapping blocks that contain all non-zero entries of the tensor, while trying to minimize both the number of blocks and the the number of zeroes in each block.
The tensor in questio... |
Define an "image differential linear system" as a linear system $A\mathbf{x}=\mathbf{b}$ wherein $\mathbf{x}$ contains the ($\mathbb{R}$) pixels of an image and each row of $A$ constrains the difference between pixels that neighbor each other (vertically or horizontally) in the image.
Such a linear system:
has entries... |
I want to plot the 100,200 and 400 iterations of this function of non homogeneous parabolic pde
def solver(L, Nx, Nt, T, theta=0.5):
x = np.linspace(-L,L, Nx+1) # mesh points in space
dx = (L-(-L))/(Nx-1)
dt = 1/Nt
Nt = int(round(T/float(dt)))
t = np.linspace(0, T, Nt+1) # mesh points in ... |
The statistical physics literature is replete with papers describing simulations of lattice models, such as the Ising model. Typically, these are done through Monte Carlo methods, such as the Metropolis algorithm. A major concern in these studies is whether the algorithm has reached equilibrium. If the dynamics are not... |
We are given the 2D coordinates of 2 points: the first point is where the ray starts and it goes through the second point. We are given another ray in the same way. How do we determine if they have a point of intersection? I would like to know the general algorithm and its explanation, don't mind about the extreme case... |
I am currently working on a DNS turbulent solver and I would like to compare my IHT simulations to papers. Those papers show the Probability Density Function of the velocity field:
I would like to reproduce this figure from data. I have access to all the velocity fields at any point during the simulation. I don't unde... |
Fluid simulations solving the hydrodynamic (HD) or the magneto-hydrodynamic (MHD) equations are very useful in physics, the latter being particularly useful for modeling plasmas.
Of course these equations are highly nonlinear and solving them accurately is difficult. My first question is, in the general case what some ... |
For simpilcity, consider a single quad linear elasticity finite element in 2D. The Dirichlet boundary conditions on node 1 and node 2 are easy to implement and can be handled in the standard way. However, the Dirichlet boundary condition on node 3 is more general and is of the form:
$$
au_{3x} + bu_{3y} = 0
$$
where $... |
I tried implementing the algorithm in Aasen's 1971 paper on factorizing symmetric indefinite matrices. I've translated the code verbatim from Algol into Python, and I used the test example given in the paper. Their print-out from the test example matches mine. I've tried to extract the output into a usable form: A trid... |
Basically, I'm trying to use Least-Squares to estimate the parameters of a DC motor.
My system can be modeled by the following matrix equation:
$$\begin{bmatrix}V_{input}(t)\\0\end{bmatrix}=\begin{bmatrix}\frac{\text{d}i}{\text{d}t}(t) && I(t) && \omega(t) && 0 && 0 \\ 0 && 0 && -I(t) && \frac{\text{d}\omega}{\text{d}t... |
I've implemented the version of Aasen's algorithm described in the book Matrix Computations 4th Edition. The version there doesn't have pivoting. The book's description of how to add pivoting is a bit sketchy for me. Can someone illustrate with actual code how to add pivoting?
I should add that my implementation has su... |
In MATLAB's ODE suit, there seem to be two basic methods of controlling the Local Truncation Error (LTE) of the ODE which the user can choose from, namely:
The absolute error control (default), |e(i)| <= max(RelTol*abs(y(i)),AbsTol(i))
The norm error control (setting option normcontrol, on), where norm(e(i)) <= max(Re... |
I have an optimization problem of the following form: $$\min_y\left[\max_x f(x,y)\right].$$ It is fairly straightforward to minimize $f(x,y)$ over $y$ with $x$ fixed, and similarly to maximize $f(x,y)$ over $x$ with $y$ fixed. If it helps, my $x$ problem is concave---but while I can solve the $y$ problem in closed-f... |
I am having trouble with implementing the method of subspace iteration to find the eigenvalues and vectors of a random, symmetric matrix, A that is mxm with m = 10. The function that I have written to perform this task is
def subspaceiterate(A,V,v,j):
if j == 0:
return v
else:
v_jm1 = V[:,j-1]
... |
I am reading the Chapra and Canale book on numerical methods, and was working through the chapters on solving linear systems. Now the book goes through direct methods including Gaussian Elimination, as well as LU factorization, versus iterative methods like Jacobi iteration, Gauss-Seidel, and conjugate gradient methods... |
I'm trying to parse the following expression (Eq. 35 in The Magnetic Field in the Vicinity of Parallel and Twisted Three-Wire Cable Carrying Balanced Three-Phased Current) in Python and calculate its sum over indices (...-5, -2, 1, 4, 7...). Relations between Bessel functions explains that these are the modified Besse... |
I have a problem with computing a derivative of a Gauss function using FFT and IFFT from NumPy library. I use the fact that
$$
\begin{equation}
\frac{d}{dx}f(x) = \frac{1}{\sqrt{2\pi}}\int{ike^{ikx}\mathscr{F}(f(x))(k)dk},
\end{equation}
$$
where $\mathscr{F}(f(x))(k) = \frac{1}{\sqrt{2\pi}}\int{f(x)e^{-ikx}dx}$.
$$
\\... |
Consider the half-planes $\{x \leqslant 2\}$ and $\{x+y \leqslant 3\}$. These two half-planes are coded with the R package 'rcdd' as follows:
library(rcdd)
A <- rbind(
c(1, 0), # x
c(1, 1) # x + y
)
b <- c(2, 3)
H <- makeH(A, b)
And we can get a representation of their intersection as follows:
V <- scdd(H)
whic... |
Basically, I'm trying to use Least-Squares to estimate the parameters of a DC motor.
My system can be modeled by the following matrix equation:
$$\begin{bmatrix}V_{input}(t)\\0\end{bmatrix}=\begin{bmatrix}\frac{\text{d}i}{\text{d}t}(t) && I(t) && \omega(t) && 0 && 0 \\ 0 && 0 && -I(t) && \frac{\text{d}\omega}{\text{d}t... |
Given an anti-Hermitian and sparse matrix $X$, I am using Python (NumPy and SciPy) to compute the matrix exponential $f(t) := e^{tX}$ for many values of $t$. The method I am currently using is to essentially compute the exponent with the following function:
X = SomeSparseMatrix
def f(t):
return scipy.sparse.linalg... |
The initial wave of reviews for Apple's M1 hardware are out, and there's lots of generic benchmarks and data on workflows on professional programs for creative users, but I haven't seen anyone talking about the experience of using something like the scientific computing ecosystem in Python or R.
Does anyone have direct... |
I want to use vectorized computation (with python and numpy) to do some calculation involving bessel functions.
As is often the case, I need to calculate the sums of bessel functions of (infinit) differnt order. I need to do that for a whole vector field, and would like to use vectorized computation. Actually, both, th... |
I'm studying iterative methods for solving linear system, and I find the following setting in Wikipedia:
Consider a matrix splitting $A = M-N$, where $A,M,N$ are all symmetric and positive definite matrices. Define iteration matrix $C=I-M^{-1}A$. We aim to show that the condition number $\kappa(I-C)=\kappa(M^{-1}A)$ is... |
I am interested in finding preconditioner to solve the problem for one dimensional problem $u''(x)=\sin(x), u(0)=u(1)=0$ using Dirichlet-Neumann method.
The preconditioner $M$ coming from Dirichlet-Neumann method is $\theta^{-1} S_2$, where $\theta$ is the relaxation parameter use in Dirichlet-Neumann method with $0<\t... |
I am studying some computational methods and I am trying to program simples equations to understand how the methods work... Particularly, I am trying to understand how multiorders ODE's work.
I've tried to program the ODE $y''=y'+x$, with conditions $y(0)=0$ and $y(h)=-h^2/2-h$, ie, the function $y=-x^2/2-x$.
So, I've ... |
Assume we have an IVP $y'(t) = f(t,y)$, and that $\partial_t f$ and $\nabla f$ are cheap to compute.
Assume further that more derivatives are not cheap to compute, or inaccessible for some reason, perhaps API related.
What are the best ODE steppers for this case?
Taylor series methods are available with $O(h^3)$ error,... |
This question is related with this other question:
Trying to model a simple second order ODE.
On this other question, I get some useful comments on why the simulations are so terrible.
However, I have another question: Why time-step smaller is not better? Thank you in advance.
h=0.05 %h=0.5;
max=100;
np=max/h;
u=[];
y=... |
I want to know summation of some small numbers, such as {e^-1000, -e^1001, e^1002...}
If all numbers are positive, I can use log-sum-exp algorithm. But unfortunately, negative numbers are also included in numbers.
Is there any method to calculate the sum of such numbers?
|
Suppose $a_i,b_i$ are $d\times 1$ matrices, $y_i$ is scalar, and I need to find least-squares solution $w$ of the following system of $n$ equations:
$$y_i=(a_i^T\otimes b_i^T)w$$
Is there a specialized approach for this system?
Converting to normal equations and applying Cholesky to solve for $w$ takes takes $O(d^6)$ o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.