All Questions

7,564 questions
21 views

How to model a hysteresis behavior using MILP on CPLEX?

The question is below: 1: y[t]=10,if x[t]>=2; 2: y[t]=-1,if x[t]<1; 3: y[t]=y[t-1],if 1<=x[t]<2. How to model the function in cplex using c++? Thank you very much! My model is added as "...
133 views

Generate high n quantum harmonic oscillator states numerically

How can I generate the higher $n$ quantum harmonic oscillator wavefunction (in position space) numerically? Here, higher means around $n=500$, or say $n=2000$, where $n$ is the $n$th oscillator ...
171 views

C standard for computational science

Which C standard should be used for computational science code ? Should we keep compatibility with C89/90/ANSI or jump to C99 or C11 ? Context: Code will use third-party : BLAS, LAPACK, MKL, ...
85 views

How to simulate water, falling under gravity, and impinging on a curved surface, which is kept/present in a domain, containing air?

TL;DR: How do I simulate a hole, at the bottom of a (full) water tank? I am attempting to simulate water, flowing out of a hole/slit, at the bottom of a tank (Water Domain) (under the influence of ...
32 views

Computing a Flux Integral in Paraview

I am currently looking into post-processing of simulation data using Paraview. I would like to compute certain integrals of field quantities. As an example, consider the following surface integral of ...
84 views

Computing the Inverse of a matrix, using the Cholesky decomposition

I have to compute $CA^{-1}B$ and $CA^{-1}x$, where $A,B,C$ are conformable matrices and $x$ is a vector. I've read that the a very computationally stable way to compute these inverses is by computing ...
74 views

Best way to numerically compute elliptic integrals of the third kind with complex arguments?

I need to compute elliptic integrals of the third kind with complex arguments, preferably in C++. Is there code out there to do this? I have discovered the Arb library, but that does much more than I ...
87 views

Analytical convergent sequence and numerical divergent sequence

Is it possible to construct a sequence that converges in theory but when computed numerically with a computer program is diverging. I feel that today our computer programs doesn't allow such ...
59 views

Block matrix and DSYRK

I want to compute the matrix $$A = \sum_{i=1}^N v_i v_i^T$$ where each $v_i$ is a given vector of length $2500$, so that $A$ is $2500 \times 2500$, and my $N$ is about 2 million. Rather than call ...
101 views

Efficient root finding algorithm for monotonic function

This is my first time asking a question here, so I may not be asking this in the right place. I am trying to find the roots of a monotonic function with as few function evaluations as possible. I ...
57 views

Consider $$I = \int_{-L}^L f(x)dx,$$ where $f(x)$ is real-valued and analytic on $[-L,L]$, but it has a pole in the complex plane whose real part lies in $[-L,L]$. Call it $z_0$, and assume it is a ...
26 views

Is this a form of stochastic gradient descent?

I want to minimize the following with respect to parameters $B$. $$\sum_{k = 1}^{K} f(A_{k}, B)$$ where $A_k$ are $K$ different data-sets and $B$ is a matrix of parameters. Can I do this by a ...
25 views

Gmsh: Recombine 2D in script file or command line

I have many STL files and I want to reduce their size, so I use Gmsh in this way: gmsh -2 -bin -format vtk -o file.vtk file.stl -0 It reduces the size from 7 MB ...
182 views

How does a stiff equation solver work?

I am trying to understand how stiff differential equations are solved. For instance the equation, $$\frac{\partial y}{\partial t} = \alpha\frac{\partial ^2 y}{\partial z^2}$$ can be solved using ...
55 views

63 views

...
52 views

...
153 views

Best software to do big number calculations quickly

I am trying to do some work on some math conjecture. I am testing the conjecture numbers using very large math numbers (100+ digits ). I am currently using python to test these numbers. In the ...
40 views

Step size updating scheme adaptive embedded RK methods

If I have a RK method $y$ of order $p$ and a RK method $z$ of order $p-1$ I have read I can estimate the local error as $r_{n+1} = y_{n+1} - z_{n+1}$. First of all I don't see how this estimates the ...
58 views

TVD for temporal dicretisation

I have come across schemes where TVD (with flux limiters) is used for spatial discretisation along with Runge-kutta for Temporal discretisation. Can TVD be used for Temporal discretisation? If so ...
55 views

Implementing boundary condition

I'm studying the transport of species A in the blood vessels, $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$ At x=0, I want to use the ...
91 views

Golub-Kahan-Lanczos Bidiagonalization Procedure implementation doesn't produce bidiagonal matrix

I'm trying to implement the aforementioned procedure using this website as a reference. At the end of the page the algorithm is described as follows: I think I've mapped the given algorithm to code ...
47 views

Memory and time requirements of the scipy sparse spsolve

I have a system of fairly large set of linear equations (approximately 30K equations). I am using scipy.sparse.spsolve to solve these equations. Initially, I tried ...
55 views

I'm trying to model the temperature distribution over a curved surface. Apart from the heat equation, I need to take into account the energy emission/absorption through electromagnetic radiation. The ...
42 views

Question about strange outputs from the CVXPY solver

I am familiarizing myself with CVXPY, and encountered a strange problem. I have the following simple toy optimization problem: ...
63 views

49 views

Nonlinear system with diagonal nonlinearity

Consider a nonlinear system of the form $\boldsymbol{f}(\boldsymbol{x}) = \boldsymbol{0}_{\mathbb{R}^n}$ for $\boldsymbol{x} \in \mathbb{R}^n$, where the function $\boldsymbol{f}$ is given by \begin{...
41 views

Why is it assumed that $c_i = \sum_{j=1}^sa_{i,j}$ in the butcher tableau of a RK-method?

In my textbook it is stated that we make a "simplifying assumption" $$c_i = \sum_{j=1}^sa_{i,j},$$ where $c_i, a_{i,j}$ are the constants in the butcher tableau. What's the relevancy of this ...
65 views

Solution of constrained system of ODEs

Can someone point me in a direction to solve this kind of integral constrained system of ODEs. \begin{align} &\int_0^{1/2}\dot{y}^2(t)=p\\ &2\lambda_1\ddot{y}(t)+\pi cos(\pi y(t))=0\\ &y(...
Determine conditions on parameters (for consistency) on RK method $y_{n+1} = y_n + ha_1f(t_n,y_n) + ha_2f(t_n + b_1h, y_n + b_2hf(t_n,y_n))$
I'm asked to find the conditions on the coefficients $a_1,a_2,b_1,b_2$ in the RK method $$y_{n+1} = y_n + ha_1f(t_n,y_n) + ha_2f(t_n + b_1h, y_n + b_2hf(t_n,y_n))$$ such that is consistent of (a) ...
I have a matrix which I want to assembly quickly, which is in block form: $$A = \pmatrix{ A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33}}$$ ...