All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
33 views

How can the choice of coarsening factor affect Multigrid's convergence?

The linear system $Ax=b$ is coming from the discretization of an elliptic PDE. Multigrid method is used in order to solve it. Suppose $c_0$ is the coarsening factor on level 0 and $c_m$ the coarsening ...
2
votes
1answer
220 views

Solving nonlinear PDE with finite difference based on Newton-Krylov

I am now working on solving MHD equations with finite difference method, which include nonlinear equations: $$ \frac{\partial\rho}{\partial t}+\nabla\cdot\left[\left(\rho_0+\rho\right){v}\right]-\...
2
votes
1answer
117 views

Rootfinding algorithm that takes advantage of automatic differentiation

Is there any algorithm (or tricks) for rootfinding to take advantages of automatic differentiation (AD)? Rootfinding algorithms typically solve $$ \mathbf{f}(\mathbf{y}) = \mathbf{0} $$ where $\mathbf{...
2
votes
1answer
30 views

Using spline or piece wise function as input (intermediate) in Gekko

Simple paraphrase of my question is what is the best way to use a table or curve as an input for an optimization problem in Gekko (and/or AP Monitor)? For example, I have simplified atmospheric ...
0
votes
0answers
30 views

Integration of a discretized field in a cylindrical coordinate system

I would like to integrate a discretized field in cylindrical coordinates, given as A(r, z), with z being spaced regularly (...
4
votes
4answers
3k views

How to deal with nonlinear term in Navier Stokes equations (finite element code)

I am trying to solve the Navier Stokes equations using the finite element method. I plan on using the pressure correction method to deal with the pressure and an implicit time stepping scheme for ...
4
votes
1answer
353 views

Conway's FRACTRAN

I've implemented fractran and playing with sequences iteratively in C. https://mathworld.wolfram.com/FRACTRAN.html Sloan: https://oeis.org/A007542 I can generate correct results, but I would like to ...
5
votes
5answers
934 views

Open source auto-differentiation for MATLAB?

Are there any open-source auto-differentiation libraries for MATLAB? I am aware of commercial packages such as Tomlab/MAD and plenty of C++ libraries, but I can't find many more for MATLAB other than ...
4
votes
1answer
83 views

Which algorithms(paper) should be reproduced by a student to enter the field of computational fluid-structure interaction?

We'd better not to reinvent the wheel. But without some programming, one can hardly understand computational fluid-structure interaction. And I would like to know which papers or algorithms should a ...
2
votes
2answers
105 views

Hack for using hardware to take square roots of 128 bit numbers

I need to take integer square roots $\lfloor \sqrt{n}\rfloor$ of (lots of) 128 bit numbers $n$. Calling gmp seems to take surprisingly long (though I can't tell for sure, since gmp routines are not ...
0
votes
0answers
50 views

Python evaluating a second order ODE with RK4

Pasted below is my python code. It is a 4th order runge kutta that evaluates the 2nd order ode: y'' +4y'+2y=0 with initial conditions y(0)=1, y'(0)=3. I need help fixing it. When I run my code, my ...
2
votes
0answers
81 views

Algorithm for computing inner products multiple times

I am taking a computational linear algebra course and i got stuck during a homework problem concerning the computation of inner products. I am supposed to compute the inner product:$$\mathrm{a}_{\...
2
votes
2answers
69 views

How to refine the tetrahedron if exist two longest length edge?

In some algorithms to refine tetrahedron, we need to calculate the longest edge. background If exist a tetrahedron with node ABCD, it has edges ...
0
votes
1answer
103 views

Global to local transformation matrix in 2D frame structures

In section 3.2 of this paper [1], where 2D planar frame structures are being analyzed, the authors mentioned a transformation matrix to be used in extracting the element displacement vector from the ...
4
votes
1answer
43 views

Guidelines for publishing data from a stochastic simulation

So, my question is if one should ideally keep a record of all seeds that are used when publishing numerical work that involves one or more random number generators (e.g. a stochastic simulation), and ...
0
votes
0answers
19 views

3d surface image for given datasets

I have some data that looks like as follows x-cor y-cor z-cor 0.02 0.0251 0.02 0.01 0.0257 0.02 0.014 0.02 0.03 0.023 0.003 0.05 0.013 0.002 0.77 .................... .................... ...
2
votes
1answer
195 views

Is there a simple way to avoid carbuncles for FD WENO methods?

I have implemented finite-difference WENO scheme for Euler equations (with some variants - WENO-JS, WENO-Z, WENO-M, different flux splitting). It works well, but have problem with so-called carbuncles ...
3
votes
1answer
644 views

Clever ways to update LU factorization for ridge regression [duplicate]

Ridge regression can be posed as minimizing the following objective function (over $x$): $$\frac{1}{2} \lVert Ax - b \lVert_2^2 ~+ \frac{\lambda}{2} \lVert x \lVert_2^2 $$ Which has a closed form ...
0
votes
2answers
72 views

“WY” representation of QR factorization — implementations?

I have a matrix $A \in \mathbb{R}^{m \times n}$ where $m \gg n$ and I want to compute the full QR decomposition $A = QR$. Where $Q$ is an orthogonal $m \times m$ matrix. Bishof & Van Loan (1987) ...
0
votes
2answers
57 views

Grid Independence Study

Is the change in time step necessary for the grid independent study? As the CFL is based on the relation between dt and dx. In mesh independent study, only change should be mesh i.e, dx isn't it so?
1
vote
1answer
66 views

Help understanding Brent's root finding method

Help me understand a part of Brent's root finding algorithm. In a typical iteration we have samples (a,fa), (b,fb), (c,fc) all real with (a<b<c) or (c<b<a) . Also, in the case I am ...
1
vote
1answer
715 views

Split-step Fourier method applied on Schrodinger equation

I'm trying to solve a Schrodinger equation of the form $i\frac{\partial}{\partial t}\psi=-\frac{\partial^2}{\partial x^2}\psi + (V(x)+\alpha|\psi|^2)\psi$ using the split-step Fourier method ...
0
votes
1answer
30 views

Task Spooler – Executing an Executable within an Executable

I am currently using Task Spooler, which is a job scheduler I have installed on my iMac. I have encountered a problem in which I cannot execute a job properly. Using a bash script, this is how I run ...
1
vote
0answers
34 views

Multigrid Reduction In Time Convergence

I am trying to solve a 2D dynamic linear elasticity model parallel in time using Xbraid. The spatial domain is [0,1]x[0,1] and time domain [0,1]. For time integration I am using a backward Euler ...
0
votes
0answers
30 views

Error in Monte Carlo integration

I am looking for a concise description to help me understand the error for Monte Carlo Integration using Uniform Sampling and Importance Sampling For Importance Sampling I have that the error is just ...
0
votes
0answers
32 views

discretizing advection equation with variable wave speed + stability

I currently have a code that solves $u_t+ cu_x=0$ with periodic boundary conditions, and constant $c$ (using an upwind method). I'm wondering how I would alter this code to solve something of the form ...
2
votes
2answers
159 views

Heat equation in non-dimensional form behaving differently than in usual format

Starting from $$ c_p \frac{\partial u }{\partial t} = k \nabla^2 u $$ in a one dimensional domain [0,1] where $c_p$ and $k$ are modeling two different materials: $$ k = \begin{cases} 1 ~\text{if} ~x &...
4
votes
2answers
113 views

Meshing surface of a sphere with a subdomain

I am trying to build a triangle mesh of the surface of a sphere which also includes a subdomain defined by a 'polygon'. Here is a successful example (subdomain defined by the red dots): Note that the ...
4
votes
0answers
60 views

Optimize linear equation using inner products and subject to L1 norm

I have a linear system of the form $A x = b$ where $A$ and $b$ are known, $A$ is "square", and $\lvert b \rvert_1 = \lvert x \rvert_1 = 1$. Unfortunately, I am working in a framework that ...
0
votes
1answer
58 views

Sum of random variables - Check your derived distribution against a numerical calculation/histogram

Consider independent random variates $X_0, X_1, . . .$ each uniformly distributed on the support $[0, 1)$ Let's say $Y = X_0 + X_1$, where $X_0$ and $X_1$ are independent uniform random variables with ...
0
votes
1answer
82 views

Dealing neighbor list in NVT Monte Carlo (MC) simulation

I'm making a NVT Monte Carlo (MC) simulation code with only short range interaction. I found many MC tutorial codes (usually Lennard-Jones system) in online. However, most of them are doing energy ...
1
vote
1answer
92 views

Trouble Making 3rd-Order Sympletic Integrator for Planitary N-Body Problem (A Hamiltonian System)

I am doing a solar-system simulation. I am using Ruth's 3rd order sympletic integrator to avoid the problem of Energy Drift (which I had with RK4), but the the planets quickly leave orbit, and energy ...
2
votes
0answers
148 views

Parallel In Time with Multigrid

I am trying to solve the linear finite element equation $M\ddot{u}+Ku=F(t)$, where $M$ is the mass matrix ,$K$ the stiffness matrix and $F(t)$ the external load vector, parallel in time using XBraid ...
2
votes
2answers
106 views

Use Monte Carlo integration to compute the volume and centre of mass in Python

In particular, I want to focus on finding the volume $V$ because I will need it to start working on solving the centre of mass This $3D$ homogenous body (Torus section) is defined by $$x^2 + \left(\...
0
votes
1answer
45 views

Clarification regarding 3D FMM translation operators

I am implementing an adaptive 3D FMM with the "basic" $O(p^4)$ translation operators. I am looking for clarification on the multipole-to-multipole (M2M) translation operator. I will explain my ...
1
vote
0answers
46 views

Determining the voxels between two boundary surfaces

Update (Solution) -17 October 2020- I finally did it! You can check the code on my GitLab repo. The function is to do this is the domain_extract which identifies ...
2
votes
1answer
105 views

(Lack of) Availability of Finite-Difference library for simple 2D PDEs

I would like to solve two types of simple 2D problems, namely the stationary heat equation on an L shaped geometry like this: And also compute the magnetostactic field in an air gap of the following ...
1
vote
0answers
41 views

How can I implement a bvp problem in a non uniform grid?

I want toconstruct a difference method for the the numerical approximation of the solution of the following boundary value problem: $u:[a,b]\to \mathbb{R}$ function,such that $$ -u''(x)=f(x)$$ and $u(...
17
votes
4answers
668 views

What are some applications which require interval arithmetic?

I have a very basic notion about interval arithmetic (IA), but it seems to be a very interesting branch of computational science both theoretically and practically. It is clear that the obvious ...
0
votes
1answer
37 views

Vector format export for screenshots

How to best export Scene/Screenshot in Paraview as a vector graphic? It seems PDF and PS export are not working really good for me (Paraview 5.3/5.5/5.8), either the scene is cropped at the borders or ...
0
votes
0answers
29 views

Dolfin convert : How to interpolate data at vertices of (3D) cells?

I hope that one of you guys can help me because i have been stuck here for a week. I am trying to read a gmsh file (.msh) using dolfin convert to XML and then download it with dolfin. The thing is ...
0
votes
0answers
47 views

How to use FEniCS to calculate the electric field of an isolated charged sphere

Initially I thought that this is the kind of question which ought to have already been answered in the form of an example online, but so far I haven't found one. I will admit that I am very new to ...
1
vote
0answers
60 views

Solution predictors for accelerating convergence in nonlinear FEM

I am looking for the details of commonly-used predictors for accelerating the convergence of iterations using Newton-Raphson scheme for nonlinear problems in FEM. I am looking specifically for static ...
1
vote
0answers
28 views

Bipartite Euclidean Matching simple to implement approximate algorithm

I am looking for a simple to implement algorithm for the bipartite euclidean matching problem (or an implementation of any practical algorithm). I am aware of Agarwal's paper, but I would like to ...
1
vote
1answer
66 views

scipy odeint: excess work done on this call and very sensitive to initial value

I am trying out odeint and received the error 'Excess work done on this call (perhaps wrong Dfun type).'. The values returned are also super sensitive to small ...
0
votes
0answers
47 views

Time complexity of derivation, gradient,differential, jacobian matrix

what is the time complexity of gradient $\nabla_{f}$ using the $\mathcal O$-notation? what is the time complexity of jacobian matrix using the $\mathcal O$-notation? who knows some references to ...
0
votes
1answer
184 views

Time complexity of numerical finite differences

I have a function $f:\mathbb R^N\to \mathbb R$ and I would like to compute all the partial derivatives of $f$ w.r.t. the $N$ input. What is the computational complexity using the (ones-sided) finite ...
2
votes
1answer
80 views

Methods to improve the efficiency and the memory requirement of LU factorization for complex symmetric system matrix

I want to solve a linear set of equations (Ax=b) using LU decomposition. My "A" matrix is a complex matrix which is ...
0
votes
0answers
25 views

Negative binomial expansion of general symbolic polynomial

Using Sympy, I would like to compute the negative binomial expansion of a general symbolic polynomial, e.g., $(x_1 + x_2 + x_3 + 4 x_4)^{-1}$. I understand that I can go by recursively partitioning ...
2
votes
1answer
78 views

Rank of a double-precision augmented matrix

Let $A$ be a matrix with real entries, and let $A_+$ be $A$ augmented by a single column. From linear algebra we know \begin{equation} \operatorname{rank}(A_+) = \operatorname{rank}(A) \hspace{10pt} ...

15 30 50 per page