instruction stringlengths 43 28.1k |
|---|
I have to write a program where I have to perform matrix-vector multiplication and the matrix is sparse matrix. Most sparse matrices available online are in Harwell-Boeing format and they have to be read in compressed sparse row format in order to do operations on it. How should I read such a file and convert into comp... |
I am looking for credible references stating how much resources supercomputers spend on coordinating versus doing actual task-related work. Resources could be available processing power but even Watts seem like a valid unit.
I believe one of my professors or text books once said that in massively parallel systems, up t... |
I implemented an $LU$ factorization algorithm on c++ for a $n$ by $n$ matrix $A$, and I wanted to now write a routine that solves the systems $Lv = f$ and $Uv = f$. How would you recommend writing such a routine. I am aware of using a linear algebra package on c++ in which I could take the inverse of $L$ and $U$ and so... |
I want to solve two dimensional Navier Stokes equations on a staggered grid for the case of Taylor-Green Vortex. My initial conditions are standard sine and cosine functions. As I am aware, I should use periodic boundary conditions on all the four boundaries. I am facing some trouble regarding implementation of this BC... |
I am trying to solve $Ax=b$ using the conjugate gradient method. However, it is important to me to obtain a bound not only on the usual residual $||b-Ax_k||_2$ but also on the quantity $||b-Ax_k||_1$.
I have two questions:
Is it true that $||b-Ax_k||_1 \leq C ||b-Ax_0||_1$ for all iterations $k$ where $C$ is some con... |
This might be the wrong stackexchange site for this question. math.SE, cs.SE, programmers.SE, and of course stackoverflow are all possibilities. I'm hoping to reach an audience that might actually use this function, to get some feedback on how they'd like it to work.
C's double nextafter(double x, double y) function ... |
I just started working on my master thesis in the theoretical particle physics and my supervisor asked me to start working with FORM, a script interpreter with basic knowledge of lorentz and dirac structures implemented, for the evaluation of some feynman diagrams. As my first glimpse on how FORM looks and works it doe... |
I googled about some code on the complex polygamma function especially C++ code, but can't find anything. Does anyone know where to find such code?
The complex digamma function does exist but not the complex polygamma function.
|
I'm trying to express the following semidefinite program: for given $A \in R^{m \times n}$ and a scalar $\epsilon \in (0,1)$,
\begin{align}
&\gamma_{2}^{\epsilon}(A):= \min\,t\\
&\text{subject to} \left( \begin{array}{ccc}
W_1 & B \\
B^T & W_2 \\ \end{array} \right)\succcurlyeq 0,\, \operatorname{diag}(W_1)\leq t,\, ... |
In this previous thread the following multiplicative way to combine symmetric preconditioners $P_1$ and $P_2$ for the symmetric system $Ax=b$ was suggested:
\begin{align}
P_\text{combo}^{-1} :=& P_1^{-1} + P_2^{-1}(I - A P_1^{-1})\\
=&P_1^{-1} + P_2^{-1} - P_2^{-1} A P_1^{-1}.
\end{align}
This combined preconditioner i... |
I have learnt about Finite Element Method (also a little on other numerical methods) but I don't know what are exactly definition of these two errors and differences between them?
|
I have the following problem:
Given a matrix with n rows and m columns. Some elements of the matrix are unavailable. For each column, you have a set containing a number of zeros and ones which must be distributed over the available elements in that column. The total number of zeros and ones in a set is equal to the num... |
In Gmsh mesh option list ,there is a smoothing concept, what does this mean and what is the effect of its number to the mesh quality?
|
This may be a trivial question, but I've always wondered...
For the classical, central finite difference schemes, if I'm interested in determining the second derivative, does applying the first derivative scheme recursively (2x) give the same answer as performing the second derivative scheme once? What about the behavi... |
I'm currently working with a system where the long range Coulomb interactions are described with the Ewald summation method.
I am using DL_POLY Classic. The Ewald summation method used is described in pages 46-48 in the user manual which I unfortunately can't link because of my low ranking.
I'm working with two paper... |
If we have a discrete saddle point problem with the coefficient matrix
$$ \mathcal{A} =
\begin{bmatrix}
A & B^T \\
B & 0
\end{bmatrix},
$$
then $\mathcal{A}$ is invertible, supposing $B$ has full rank and $A$ is positive semidefinite (which hold in my case), if $\mathrm{ker}(A)\cap\mathrm{ker}(B) = \{0\}$. The... |
I want to discretize and numerically solve the following PDE:
\begin{equation}
v(k)\dfrac{\partial f}{\partial x} + E(x)\dfrac{\partial f}{\partial k} = S\{f\}
\end{equation}
using finite volume (box integration) method.
Since the direct discretization results in an oscillatory solution, I have used the upwind discreti... |
I am looking at a real-world resource allocation problem that is cast as a quadratically-constrained linear program of the form
$$
\max\langle f,x\rangle
$$
subject to
$$
\begin{aligned}
m \leq\,\, & x \leq M, \\
A\cdot x & \leq b, \\
A_{eq}\cdot x & = b_{eq}, \qquad\text{and} \\
\langle x,Q\cdot x\rangle & \leq \alpha... |
Yesterday I was wondering how floats are handled in a computer and what they look like in binary... I learnt about the single-precision floating-point and I tried to see the limit of that format...
I first wrote this little Python (3.4) script
a,b = 1,1
while (a+b)-a-b == 0:
a*=2.0
while (a+b)-a-b != 0:
b+=1.... |
I've been having fun playing around with a simple model for reaction in a co-flow fluidized bed (I'm afraid I'm a chemical engineer, not a computer scientist). Unfortunately, simple physical assumptions often lead to terrifying equations. I've reduced the problem to solving the following set of simultaneous integro-dif... |
I read reference (1),but I am confused about how to introduce a distance vector in Lorentz force like the author does it in equation (11):
$$\rm J\times B = -J\cdot \nabla \left(
B\times r\right)+\left(J\cdot \nabla B\right)\times r$$
$\rm J$ is a current, $\rm B$ is magnetic field, $\rm r$ is the distance vector
and e... |
There are $n$ points in a 2-D plane and each is given by its $x$ and $y$ coordinates. They are stored in an array in an ascending order with respect to $x$.
All points are connected together by line segments ($n\choose 2$ lines). Within the complete graph created by these line segments, how can we find a line which ha... |
This may be a trivial question, and I apologize if so. Consider the following simple problem: We have a 2D, regular grid of points (say $X = [0,5000] \times [0,5000]$) spaced uniformly by units of 1 (e.g., $(0,0), (0,1), (1,0) \in X$ and there exists a function $f(x,y)$ that we aim to approximate on $X$. Let's assume ... |
I am trying to solve the following optimization problem:
\begin{align}
&\min\limits_{s} \rm{tr}\left(S^T S\right) + \mathrm{tr}\left(\left(S^T S\right)^{-2}\right)\\
&\text{subject to }\rm\left\|S^TS-Z^TZ\right\|_{norm}\leq \epsilon\end{align}
Where $\rm \|\cdot\|_{norm}$ could be either the Frobenius norm or the $\ell... |
I am having a really hard time getting any kind of reliable / consistent result from my Metropolis code. I have torn it apart and am now examining just the randomness in my random number generator.
I decided I would just run many iterations over a spread from -1 to 1 and it should give me an average of 0. I was complet... |
Webster equation is a popular generalization of 1D wave equation used for ducts of variable cross-section $S \equiv S(x)$. Assuming harmonicity in time, the spatial equation for propagation of variable $\Phi(x)$ is:
$$
\frac{\partial^2 \Phi}{\partial x^2} + \frac{\partial (\ln S(x))}{\partial x}\frac{\partial \Phi}{\pa... |
I am very new to optimization. so, sorry If I ask a simple question. I have a problem with a dozen of variables. I want to use Augmented Lagrangian for solving the problem. I write a code based on the method(in matlab). Unfortunately, the code doesn't work And I don't know how to understand what's going wrong?
How to ... |
I'm trying to find inverse of a matrix using c++ library armadillo or eigen. But first row of the matrix is wrong, please note that other elements are correct. I'm unable to understand what mistake I committed, please help me.
My code is:
#include <iostream>
#include <armadillo>
#include <cmath>
#include <Eigen/Dense>
... |
Computers can work only with computable numbers, while most of the algorithms are based on analysis of real numbers (real analysis).
When I heard of the existence of computable analysis I immediately had these questions:
Can it help numerical analysis in some way?
Can we for example, help prove convergence of algor... |
I have been doing finite element analysis using Matlab. I look for many examples and tutorials producing only the stiffness matrix letting elements being weightless. However, in my case, I need to do a soil deformation where the self-weight of elements is significant.
Any guidance will be appreciated.
|
I have a problem that I've framed out in a particular way, but I don't know if I'm re-inventing the wheel here. Is there an existing literature base in this problem? Does it have a corresponding term of art? Where would you recommend that I start reading about this type of problem?
The basic problem that I have is that... |
After doing some mathematics related to the stability of elements in 3D Stokes problem I was slightly shocked to realize that $P_2-P_1$ is not stable for an arbitrary tetrahedral mesh. More precisely, in case you have an element where all nodes and three out of four facets lie on the boundary of the domain with a Diric... |
I have a matrix, $X$, it is symmetric. I project $C \odot X$ and $D\odot X$ to semidefinite cone. $C$ is a Gramian matrix with some elements near zero and of course semidefinite, with one row and column equal to zero. $D$ is a matrix of ones except one column and row equal to zero (not the same column and row as $D$). ... |
The free-streaming term in stationary 1D Boltzmann equation satisfies the equilibrium distribution function, that is:
\begin{equation}
\text{Fr}\{f\} := v(k)\dfrac{\partial f(x,k)}{\partial x}
- \dfrac{d\varepsilon_\text{sub}(x)}{dx}\dfrac{\partial f(x,k)}{\partial k}
\end{equation}
equals zero by putting $f_0(x,k) =... |
I have implemented the Richardson extrapolation of the Euler-Maruyama method to 4th order, to estimate the moments of SDE.
The Euler-Maruyama works, and I would expect the Richardson extrapolation to work too, because when I suppress the noise contribution it gives the correct solution in the resulting ordinary differe... |
I'm looking for a benchmark for the lid-driven cavity problem in 3D to compare the results of my code.
In 2D I used:
U. K. N. G. Ghia, K. N. Ghia and C. T. Shin (1982)
High-Re solutions for incompressible flow using the Navier-Stokes equations and a multigrid method. Journal of computational physics.
Do you know a benc... |
I understand how MH work, I'm able to use it to simulate e.g. 2D Ising model. What I don't understand is what you actually take average of.
When I run the simulation, it reaches equlibrium after some time:
Now each new state is going to be the same, so I see no point in taking the average or variance of the sequence t... |
I am trying to solve a singular linear least square problem:
$$minimize: \phantom{2} ||Ax-b||^2 \\
subject \phantom{2} to: \phantom{2} x \ge 0$$
Here $ A \in R^{n \times m} $, and $ n\lt m$. here m is a very large number and the matrix $A$ is dense and almost full.
The least square solution for this is equivalent to so... |
I am trying to learn the Lattice-Boltzmann method and was looking for some good beginner resources explaining the method. I have been looking at some codes online, but have been having trouble understanding them.
Can someone suggest some good introductory resources about the Lattice-Boltzmann method? If you know of an... |
I want to solve the PDE equation numerically. For this, I started my study with something simple; heat equation
$$
\frac{\partial u}{\partial t}=\frac{\partial^2 u}{\partial^2 x}
$$
with the initial condition
$$
u(x,0)=1\qquad(-1<x<1)
$$
I assumed the constant is set to zero.
My next step was to turn this into discrete... |
I searched the web and found some C code for calculating the determinant of a $n\times n$ matrix. This code however seems timing complexity, and run pretty slow especially when handling a larger matrix, for instance, $1000\times1000$ matrix. I need calculate the determinant of a covariance matrix of a multivariate norm... |
I am reading a paper [1] where they solve the following non-linear equation
\begin{equation}
u_t + u_x + uu_x - u_{xxt} = 0
\end{equation}
using finite difference methods. They also analyse the stability of the schemes using the Von Neumann's stability analysis. However, as the authors realize, this is only applicable... |
I need to calculate the inverse of a dense matrix, with some elements taking values as high as 1e9 and some around 1e2. What would be the best method to do it?
Note:
I am more concerned about the precision of the answer rather than minimizing the computational time.
I explicitly need to find the inverse and not the ... |
I am using FEM to do an assignment on a heat conduction problem on a complex domain, which needs me to get the variation of the temparature distribution subject to the variation of boundary conditions, and its exact solution is unknown. Also I have to show the correctness and convergence of my solutions numerically.
I... |
I was wondering what is a more optimized open source BLAS/LAPACK package with respect to modern multi-core processors (Haswell and beyond). Is there any distribution that can attain performance close to that of Intel MKL for instance?
In addition to Intel, which libraries may perform well on AMD architectures for Zen ... |
I have an equation of the form $J^Te=f$, where $e$ and $f$ are known vectors and $J$ is an unknown matrix.
How can I efficiently compute $J^T(JJ^T)^{-1/2}e$ ?
My motivation to address this problem is that, as a part of a bigger problem I need to compute matrix $J$ then compute $J^T(JJ^T)^{-1/2}e$. However, computation... |
I have an interesting problem from my research that I have been struggling to solve. One part of the problem involves generating all possible matrices, where each set contains three integer vectors, of a given volume $V$. That is the determinant of the matrix should be $V$. The constraint is that the maximum of the abs... |
I need to compute a lot of $3\times3$ matrix inverses (for Newton iteration polar decomposition), with very small number of degenerate cases ($<0.1\%$).
Explicit inverse (via matrix minors divided by determinant) seems to work, and is about ~32~40 fused flops (depending on how I compute reciprocal of the determinant). ... |
As per suggestions of the people from MathOverflow, I'm reposting my question here:
I'm currently trying to solve a linear system $Ax = B$, where the matrix $A$ is ill conditioned (i.e. nearly singular), with a condition number of $~10^7$. The aforementioned linear system arises from a finite difference discretization.... |
Can you provide a hash functions $F(x) | F(x) = F(\overline{x}), x \in {\{0;1\}}^n$
$\overline{x} $ is $x$ where all bits are swapped: $0 \rightarrow 1, 1 \rightarrow 0$
Basically it will help me improve my MAX-CUT algorithm
|
I have a problem of the form,
\begin{align}
minimize_{y} maximize_{x}&\quad x^T y - y^T (B\odot x x^T) y\\
s.t. &x\in [l,u]\\
&Ay=b
\end{align}
How to efficiently solve this problem? $B$ is a semidefinite matrix.
What I have done: you can dual the inner problem, and get a semidefinite problem with two sdp variabl... |
I would like to incorporate a CFD topic in a project I currently have. The deadline is a little less than a month from now. Basically, what I would like to do is solve some equations and simulate fluid behavior. The programming language I will use to accomplish this in is C, however I intend to rely on MATLAB for later... |
I'm trying to solve a nonlinear partial differential equation
\begin{equation}
L(u_{xxtt},u_{xx}u_{tt},u_{xt}^2,u_{xt},u_{tt})=0
\end{equation}
using finite difference methods. In order to remove the second derivatives with respect to time, I substitute
\begin{equation}
v := u_t
\end{equation}
such that it becomes
\beg... |
The problem I have may be really simple, but still getting a hard time solving it. So I have the Euler rotation equations:
$$I_{1}\dot{\omega}_{1}+\left(I_{3}-I_{2}\right)\omega_{2}\omega_{3}=\lambda_{1}$$
$$I_{2}\dot{\omega}_{2}+\left(I_{1}-I_{3}\right)\omega_{3}\omega_{1}=\lambda_{2}$$
$$I_{3}\dot{\omega}_{3}+\left(I... |
I am starting to dabble in MPI. I am fairly new to this area and I am currently reading the MPI standard.
I would like to write my first MPI program, a simple hello world program, on a cluster that I have. I am not sure if anyone is familiar with the IBM bladecenter. Supposedly, there is a midplane that connects all o... |
In N queens problem https://en.wikipedia.org/wiki/Eight_queens_puzzle, trying to find solution by backtracking encounters difficulties quite fast (even for SWI-Prolog, http://swish.swi-prolog.org/example/clpfd_queens.pl, which solves N=100 in 0.2 sec, entering N=150 in the link above did not reach a solution in a reaso... |
I do a lot of general processing of data on my desktop computer. It can be stuff like extracting timeseries of point measurements from a large number of NetCDF files, or converting csv-files into binary or making a lot of plots.
My question is, would it be useful to have a Xeon Phi for this kind of work? I try to use t... |
Ok so I'm a complete beginner in computational modelling (I use analytical methods of physics typically) but I would like to model an anisotropic, aperiodic (but not random) finite array of metallic nanorods, all of which have their long axis orientated in the same direction as eachother, but this direction can be comp... |
I have 2 pandas datasets which have 'RF' field in common. The optionsdata variable is ~60K, which map to at most the histdata fields of 5K. Using np.where is incredibly slow:
for j in range(0,len(optionsdata)):
optionsmap[j] = np.where(histdata.ix['RF'].str.match(optionsdata.RF[j]))[0][0]
Is there a much faster ... |
Suppose we use a preconditioned iterative solver for a linear system. If the initial state for the solver can be chosen very close to the exact solution - does this reduce requirements for the preconditioner?
|
I just got a new Macbook and decided to install everything from scratch instead of migrating. Previously I've always installed SciPy etc. through MacPorts, but lately MacPorts as a whole seems not to be as cleanly maintained as it once was, and I spend a lot of time tracking down problems with it. I also generally used... |
Hi I have a code below that solves non linear coupled PDE's given Dirichlet boundary conditions. However I need to implement periodic boundary conditions. The periodic boundary conditions are troubling me, what should I add into my code to enforce periodic boundary conditions? Thanks for the help.
Note, $t\geq 0$ ... |
I have the following two PDEs which I want to check for stability:
$$u_t= u_{xx} , \ u(x,0)=1 , \ u_x(1,t)=-hu^4(1,t) , \ u_x(0,t) = 0 $$
$$u_t = u_{xx}-\sin(x+t)+\cos(x+t) , \ u(x,0)=\cos(x) ,\ u_x(1,t)=-hu^4(1,t)-\sin(1+t)+h\cos^4(1+t) , \ u_x(0,t)=-\sin(t)$$
For the first I got that $d/dt (u,u) = d/dt \int_0^1 u^2 d... |
Consider the following eigenvalue problem
\begin{equation}
\mathcal {L} x(s) = \lambda x(s),
\end{equation}
where
\begin{equation}
\mathcal {L} = \alpha \partial^4_s + (s^2-1)\partial^2_s + s \partial_s + 1,
\end{equation}
with $\alpha = \rm{const}$ and $s\in[0,1]$. In order to find the eigenvalues and the eigenfuncti... |
What are the state of the art methods for fast 2D convolution approximation?
I'm familiar with SVD based multiplication and cross approximation approaches, but would be thankful to get additional references.
The kernel size is typically ~3x3 - 11x11, not separable, with input matrices from sizes ~200x200 - 1000x1000.
T... |
There are many methods for diagonalizing matrices, probably the most widely used is the combination of Householder transformations and the QR algorithm.
Is there any superior method for diagonalizing (large, non-sparse)real symmetric matrices? Superiority can be a bit muddy, so I define it as fast, numerically stable, ... |
It is a commonly known fact that the Rayleigh Quotient converges cubically (1), while the Power Iteration may converge slowly if the difference between the dominant and second-dominant eigenvalue is small.
Knowing this, when would it ever be beneficial to use the Power Iteration over the Rayleigh Quotient Iteration? T... |
If there is an $(n+1)$-dimensional integral of the form
$$ \int_{[0,1]^{n+1}} f(x, y)\,\mathrm{d}^n x \,\mathrm{d}y,$$
normally one would evaluate this using a multi-dimensional integration library over the whole domain, $[0,1]^{n+1}$.
But are there some conditions where it might make sense to perform the integral over... |
In CVX, I encounter a problem. I want to multiply a Matrix of 2x4 with its transpose. I know the result must be positive definite. However, it couldn't let me do the multiplication directly. Says: Disciplined convex programming error:Only scalar quadratic forms can be specified in CVX. What can I do?
cvx_begin
vari... |
I am working on implementing the Fourier beam propagation method in C++. I am really more of a programmer than a physicist but I think I have a good understanding of what I am trying to do. Here is what I am trying to implement.
Two questions. In the flow chart he says you should perform the diffraction and after t... |
I am in the process of building a robotics physics engine. I have been using the Linear ODE $x' = Ax + b$ for the core of my physics integration, but have never found a really good solution method for it.
My problem gets harder than the standard ODE solution because my A matrix is singular.
Here is an example of an $A... |
I need to calculate the lagrange polynomial which approximates $e^x$ at $101$ points, the points $\frac{k}{101^2}$ for $k\in\{0,1,2\dots 100\}$.
I tried the following code:
import java.math.*;
import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionLagrangeForm;
public class interpolation {
publi... |
I want to solve PDE system, which consists of Poisson equation, continuity equations for electron and hole with drift-diffusion equation numerically, by using method called Newton's method.
This method is explained in several literatures, including
https://nanohub.org/resources/1565/download/ddmodel_solution_details_wo... |
I need to solve a set of 5 PDEs for functions $u(x,t)$.
I looked up the Matlab function pdepe. It looked perfect for my case, until I read the line:
$f(x,t,u,\partial u/\partial x)$ is a flux term and $s(x,t,u,\partial u/\partial x)$ is a source term. The flux term must depend on $\partial u/\partial x$.
In my probl... |
When we create numerical models of a real-world system, we usually go through a few phases (from Abramowitz 2010):
a perceptual model, where we consider the relevant components of the system
a conceptual model, where we consider the relationships between those components
a mathematical model, where we come up with equ... |
In my view, it is needed,
To save computational time.
To define accurate boundary conditions at interface where properties changes drastically.
To solver 2 phase problems as single phase only.
To capture breaking and joining of droplets/splashing.
Are there any other reasons which I am missing? Please guide.
Thanks
|
I am trying to simulate an optic-fiber sensor (in-fiber interferometer) to study its respond to temperature. The method I am using is finite-difference time-domain (FDTD), and I come out with a large memory usage problem. The wavelength of the light source centered at 1.55μm while the optical fiber has diameter of 125μ... |
How to numerically find the solution for $a$ and $b$ of this equation
$$\sum_r \frac {\mathrm B_{z_r}(a+m_r+1,b)}{\mathrm B_{z_r}(a+m_r,b)}=K$$
where $m_r$ are non-negative integers, $0<K<1$, $0<a$, $0<b$, and $\mathrm B_{z}(a,b)=\int_0^zx^{a-1}(1-x)^{b-1}dx$ is the incomplete beta function
|
I am using the method by Brandt in the FAS Multigrid algorithm to estimate the truncation error in a 1-D flow problem and then use that as the basis for generating a mesh(r-adaptation) in 1-D.
The process is standard, in that, transform the equations to a computational domain $\xi$, perform/run computations and map th... |
Given some sparse unitary square matrix $A$ ($dim=2^n$ if it matters), is there an algorithm to decompose $A$ into a Kronecker/tensor product of smaller unitary matrices? In other words: decompose unitary $A$ into $$A=U_1 \otimes U_2 \otimes ... \otimes U_k$$ where each $U_i$ is individually unitary and $\otimes$ deno... |
Let $A\in \mathbb{R}^{n\times n}$, symmetric and positive definite. Suppose it takes $m$ units of work to multiply a vector by $A$. It is well known that performing the CG algorithm on $A$ with condition number $\kappa$ requires $\mathcal{O} (m\sqrt{\kappa})$, units of work.
Now, of course, being a $\mathcal{O}$ stat... |
Let $A$ be positive-definite and $C$ diagonal positive-definite, consider the problem of solving the following equation for $\bf x$
$$A{\bf x}+C\begin{bmatrix}
e^{x_1} \\
\vdots \\
e^{x_n}
\end{bmatrix}=b.$$
I believe nonlinear conjugate gradient can solve this, however the nonlinear part is pretty benign as far a... |
I'm a bit confused about the relationships between these two approximation methods mentioned in the title.
Does this kind of interpolation also belongs to the field of spectral methods?
Are the Lagrange interpolants we get from using the roots of orthogonal polynomials also orthogonal?
It's likely to get mixed with... |
In PETSc, I need to generate a random number between 1 and 0.
With the include cstdlib, the classical trick is:
(double)rand() / (double)RAND_MAX
In PETSc, the constant RAND_MAX does not seem to exist.
Is there a work around?
Though it is ugly, I plan to do something similar to:
(rand() % 10000) / 10000.0
|
I am working on a model in COMSOL and I am usin different meshes from coarse to fine keeping the other parameters constant. And, I got different maximum velocities for all the meshes.
What can I do to achieve similar maximum velocities for all the simulations?
|
Note: this question is not strictly related to Matlab or any other environment (even though I would prefer that you refer to my Matlab code).
I've n = 10000 equally spaced elements between -pi and pi in an array produced like this (in Matlab):
n = 10000;
x = linspace(-pi, pi, n);
Then I create a second array x_r, ... |
Setup (complete, but all very standard):
My problem is how to best calculate the cumulative integral of a function which comes out of Spectral Collocation with a chebyshev basis. Take some function $f : [0, \bar{z}] \to \mathbb{R}$ approximated by
$$
f(z) \approx \sum_{n=0}^{N-1}d_n T_n(z),\, z \in [0, \bar{z}]
$$
whe... |
The solvepde function was introduced in MATLAB R2016a. I am able to solve my system of PDEs if there are no time delays involved. Does anyone know how to include time delays in the solvepde function?
|
I need to compute the two-sided (bilateral) Laplace transform of a numerically given function $F$,
$$
I(t) = \int_{-\infty}^{+\infty} {dx} \, e^{-x} \, F(x + t) ~,
$$
where $F(x)$ has some sharp features, e.g., at $ x = \{ 0, x_p, \cdots \} $, has finite support, and vanishes sufficiently fast for $ x < 0 $ to prevent ... |
I have a one-dimensional set of points, i.e. $(n,y_n), 1\leq n \leq N$. I want to fit them with a linear combination of $k$ rectangular functions in a least-squared-error sense. Each rectangle is parametrised by a left edge, right edge, and height. It is similar to the Lebesgue sum but I am looking at horizontal strips... |
I have a simple question that I wasn't able to find an answer to. I have a function f(x) where x is some vector, for example:
function f=f(x)
f=x.^4;
end
Then I want to integrate with bounds as vectors:
x=1:0.1:10;
x_0=2*ones(size(x));
g=integral(@f,x_0,x);
and I want to get g as a vector g(i)=integral(@f,x_0(i),... |
I would like to fit a diffusion coefficient as function of e.g. salt, pH etc. If I use a linear combination of all variables, I will have to apply constraints because the model fails, if the diffusion coefficient will get too large or negative.
I was wondering if there exists a function that behaves similar to the logi... |
I want to write a MATLAB code for Roe solver for 1D shallow water equations.
Is there anyone who can help me with that?
|
I am going to calculate a trajectory, by using a pre-calculated vector field. The values of the field are known on a grid which is quadratic in the horizontal direction, un-evenly spaced in the vertical, and evenly spaced in time.
I'm planning to use a 4th order Runge-Kutta integrator, and my question is if I should si... |
Recently, I took a course on numerical methods where we learned about Galerkin's Method of Weighted Residuals. We were told that it forms the basis of the Finite Element Method .
However, in most introductory texts I've seen on FEM, they start with a simple example where they manually write out the equations to minimiz... |
How can I make a scatter plot like the following, where the density of points represents the magnitude of the scalar field at that point. Consider for example the probability density for an atom:
I managed to plot something like this as a color plot (see my question and the pictures here: https://stackoverflow.com/que... |
In elementary chemistry textbooks you often have pictures like the following one:
Are there any conventions how to get them?
I am not sure, but I guess that it are contour plots with only one iso-surface of constant probability density $|\psi|^2$ such that the (integrated) probability for an electron to be inside of o... |
I am trying to solve Travelling Salesman Problems using tabu search. I have been able to successfully find "near enough" optimal solutions (as well as one optimal, yay!).
For the moment I am using sub-tour reversal as the local search precedure. The basic gist of it is similar to 2-opt, but rather than swapping two cit... |
The documentation of PETSc shows an example of usage:
PetscRandomCreate(PETSC_COMM_SELF,&r);
PetscRandomSetType(r,PETSCRAND48);
PetscRandomGetValue(r,&value1);
PetscRandomGetValueReal(r,&value2);
PetscRandomDestroy(&r);
In the example random 1, we can find also the use of PetscRandomSeed.
However, it seems n... |
I've got an elliptic problem in a domain with two materials in a checkerboard arrangement. Both materials are highly dissimilar, being one much more compliant than the other.
If I use classic linear lagrange finite element, because of the corners of the checkerboard, there will be singularities that will make the solu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.