All Questions

Filter by
Sorted by
Tagged with
2
votes
0answers
41 views

Is upwinding needed for slope limiter / flux limiter and numerical flux?

I have a cell centered cartesian grid and am trying to implement the flux inside the divergence term using numerical flux with a flux limiter. I found different formulas for MUSCL flux limiter, where ...
1
vote
0answers
31 views

Algorithm for computing inner products multipe 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}_{\...
0
votes
0answers
11 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 .................... .................... ...
4
votes
1answer
25 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 ...
1
vote
0answers
50 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
2answers
55 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) ...
1
vote
0answers
24 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
21 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
25 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 ...
0
votes
0answers
49 views

how to Implement linear tetrahedral elements for finite element computations?

I am trying to implement 3D tetrahedral elements in my finite element code (which works fine for linear triangles and quadrangles in 2D). But my simulations are crashing with tetrahedral elements. My ...
3
votes
0answers
50 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
52 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 ...
1
vote
1answer
53 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 ...
0
votes
0answers
24 views

COMSOL Cannot evaluate expression [closed]

I'm working on a 2D model to simulate groundwater flow through pores using the Darcy's law interface. I'd like to eventually tie in flow and transport of diluted species. The domain is defined as a 0....
1
vote
1answer
78 views
+50

Calculating Error for Poisson Equation using Successive Over-Relaxation technique, Python

I am trying to solve the Poisson Equation $\frac{\partial^2 T}{\partial x^2} + \frac{\partial^2 T}{\partial y^2} = 32(x(x-1) + y(y-1))$ for a 61x61 grid using Python3 with boundary conditions being $T=...
1
vote
1answer
89 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
2answers
136 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 &...
2
votes
0answers
144 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 ...
-1
votes
0answers
55 views

I am plotting too many figures the animations get slower as a result. Need to clear figure or something

I am trying to embed an animation using FuncAnimation from matplotlib into a tkninter GUI. In the execute button at the bottom I am calling the Execute function. If I click the execute button many ...
1
vote
0answers
36 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(...
1
vote
0answers
57 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 ...
0
votes
0answers
28 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 ...
1
vote
0answers
24 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 ...
0
votes
1answer
35 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
43 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
1answer
50 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
44 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 ...
2
votes
2answers
96 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(\...
2
votes
1answer
99 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 ...
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
75 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 ...
1
vote
1answer
20 views

What does this definition of two's complement representation of signed integers mean?

I am reading a book on digital circuits. It says that given a n-bit binary number $N$, its two's complement representation is itself, if $N$ is positive; and its two's complement representation is $2^...
2
votes
0answers
41 views

Haw to apply central difference to viscous flux in energy equation?

In many modern papers Navier-Stokes equations are solved with finite-difference or finite-volume methods using WENO reconstruction for non-viscous fluxes and central differences for viscous ones. It ...
2
votes
1answer
75 views

Efficient change of basis real positive definite symmetric matrix

I need to optimize a code where the most performance critical part is doing a 'change of basis', in other words it is an unitary similarity transformation on a big real positive definite symmetric ...
0
votes
0answers
27 views

Implementation method selection for sparse constrained linear least squares or quadratic programming

I need to slove one optimization problem of quadratic programming. The number of optimization variables is about 16,000. The constraints include equality constraints and inequality constraints. I have ...
3
votes
1answer
71 views

Numerical integration in time for finite elements

I am trying to solve $M\ddot{u}=-Ku+F_\text{ext}$ for a 2D linear elastic model with $M$ be the mass matrix,$K$ the stiffness matrix and $F_\text{ext}$ the external load vector coming from a uniformly ...
2
votes
1answer
74 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} ...
3
votes
1answer
93 views

Why do people omit the lowest times when averaging timing results?

Most of the time, when I see someone reporting the average timing of a certain algorithm on a computer in a computational mathematics paper, they do something like this: Run the operation $n$ times (...
1
vote
0answers
57 views

Convergence of Conjugate Gradient Algorithm

I am trying to solve a linear elasticity model using finite element discretization in a rectangle domain [0,1]x[0,1]. For the solution of the the linear system $Ku=F$ I am using the CG algorithm. ...
1
vote
1answer
35 views

Constraint programming problem with conditional constraints and some unknown indicator variables

I have an interesting little problem that I believe can be formulated in terms of optimization or constraint programming. I have a few dozen variables $a$, $b$, $c$ ... and a set of constraints that ...
1
vote
0answers
24 views

Most scalable distributed consensus mechanism based on message complexity? [closed]

One of the most challenges in distributed consensus mechanisms is both time complexity and message complexity. For example, PBFT message complexity is O(n^2) that ...
5
votes
0answers
47 views

2nd-order TVD criteria for flux-limiter

Consider a nonlinear hyperbolic conservation equation: $$ \partial_{t}u = -\partial_{x}f(u) $$ The spatial derivative of $f(u)$ may approximated after a spatial discretization by $x_{j}=j\Delta x$ $$ \...
2
votes
2answers
1k views

Is `#define INT_MIN 0x80000000` okay?

In Computer Systems: a Programmer's Perspective: Writing TMin in C In Figure 2.19 and in Problem 2.21, we carefully wrote the value of TMin32 as -2,147,483,647-1. Why not simply write it as either -2,...
2
votes
2answers
63 views

How can I detect lost of precision due to rounding in both floating point addition and multiplication?

From Computer Systems: a Programmer's Perspective: With single-precision floating point the expression (3.14+1e10)-1e10 evaluates to 0.0: the value 3.14 is lost ...
0
votes
1answer
25 views

Plotting two data sets in Octave

I have two data vectors $y1$ and $y2$, and I want to plot both of them as functions of the vector $x$. I want the result to be two overlapping curves. Here is the set of commands I am using. y2=[0.003,...
1
vote
1answer
37 views

Why is quadratic penalty method used for equaltiy-constrained optimization?

When one equality-constrained optimization is formulated, the method of Lagrange multiplier will be the choice for me. In Chapter 17 from the book Numerical Optimization, quadratic penalty method can ...
1
vote
1answer
47 views

Numerical integration problem: IntegrationWarning The integral is probably divergent, or slowly convergent

I am trying to get the numerical integration of a function using scipy's integrate.quad as follows. $$ \begin{equation} G (\alpha) = \frac{4\alpha}{\pi}\int_0^{\...
3
votes
1answer
42 views

Shall I use global, heap allocated array or local, stack allocated one if references to its elements are made too many times?

I actually have this data locality as a possible problem for why my fortran program runs somewhat slow. In one part of this program, I have nested loops and throughout these loops, a given section of ...
2
votes
2answers
107 views

L1 least squares minimization with a sparse matrix

I have the following problem: $$\min_{x\in \mathbb{R}^n}\|Ax-b\|_1$$ where the matrix $A$ is large and sparse. I am looking for methods/code that can minimize this efficiently. References are very ...
2
votes
0answers
25 views

Scaling tensor approximation by symmetric tensor decomposition with SciPy's L-BFGS-B

I am trying to approximate a symmetric tensor of which the values are in the range of [1e-7,1e-4], by a symmetric tensor decomposition of lower rank. For this I am using the L-BFGS-B method in SciPy's ...

15 30 50 per page
1
2 3 4 5
183