instruction stringlengths 43 28.1k |
|---|
The supplied code draws some data points and the corresponding regression line.
The regression line goes through or is near most of the data points on a linear scale.
.
However, on a log scale, the line doesn't look very accurate. Also, the lengths of the lines become shorter.
How can I make the regression line look ... |
I have a 3D surface, defined as collection of points in a 3D evenly spaced mesh. I have a rectangle of fixed size (height x width), and I need to find a collection of rectangles positions in the 3D space (i.e. I also need the tilt angles of the rectangle, or the vector normal to the rectangle) which will cover all the ... |
I have a curve on a plane, and a rectangle with one side much longer than the other (let's say it is a "thick segment). I need to find a set of positions of the rectangle which would include all the points of the curve. Overlaps of the rectangle positions are allowed. Possibly I would need to optimize the problem, find... |
In the 4D Henon-Heiles system, it is well-known for certain parameters the attractor is a 2D torus. I am wondering how can we plot this actual torus (embedded in 3D) by somehow projecting all 4 components to some 3D space and to observe if a torus-shaped object will pop out.
I have seen people visualize this 2D torus s... |
Please refer to the PhD thesis given at the following link:
Etienne Bernard. Algorithms and applications of the Monte Carlo method : Two-dimensional melting and perfect sampling.
I want to draw the following plot given on page 68:
Figure 3.2: Example of error estimation for the orientational correlation function of... |
I am reading a book: Introduction to Algorithms.
In the first chapter is itself, Algorithm is defined as is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output in a finite amount of time.
I am not able to understand the what doe... |
I noticed that libraries like numpy and pytorch are able to perform arbitrary tensor contractions at speeds similar to comparably sized matrix multiplications. This leads me to believe that underneath they somehow express these operations in terms of BLAS routines.
However, I can't think of a general algorithm to do so... |
I've been looking into solving a linear system $$Ax=b$$ where $A\in\mathbb{R}$ is the sparse coefficient matrix of size $K\times K$, $b\in\mathbb{R}$ is the right-hand side (i.e., the source term) of size $K\times 1$, and $x\in\mathbb{R}$ is the vector of unknowns (also of size $K\times 1$). The system of equations is ... |
Suppose we have a fluid particle mixture, where the particle have cylindrical shape, no gravitation force, flow is laminar (let's say $Re_f=100$), and we want to do numerical simulations, and we are interested in hydrodynamics forces exerted from flow on a single particle. I think the hydrodynamic forces can be categor... |
For decision vector $x$, I have a constraint that either $x\leq0$ or $x\geq5$, that is, all positive entries must be at least 5.
Is there a way to cast this under LP? The problem is already a mixed-integer program, so introducing binary/integer auxiliary variables are ok, if necessary.
I tried to use the usual positive... |
The following is the Discrete Spectral Vorticity Evolution PDE for incompressible flow:
$$ \frac{\partial \Omega_{pq}}{\partial t} = \nu \left( \frac{\partial^2 \Omega_{pq}}{\partial x^2} + \frac{\partial^2 \Omega_{pq}}{\partial y^2} \right) - \mathrm{fft2} \left( u_{ij} \frac{\partial \omega_{ij}}{\partial x} + v_{ij... |
I calculated SASA for 4 systems using the following command. The trajectory file (run.xtc) is not treated with gmx trjconv option. In my MD simulation, I followed two annealing cycles in each 50 ns simulation time. In the graph, I observed a pattern at every 25 ns and I am unable to explain why I get it. I would like t... |
For surrogate models which predict derivatives based on the current state: how do you avoid the accumulation of state errors due to modeling error in each state update?
It seems to me that if you used a surrogate model (predicting derivatives) for e.g. turbulent simulations. Then by definition of chaotic dynamics/fixed... |
I am aware of the following question Evaluating the surface integral in an FEM (Finite Elements Method) procedure. But they use the volumetric coordinates while I want to use the cartesian isoparametric coordinates.
I am using the cartesian coordinate system ($xyz$) and the corresponding isoparametric coordinate system... |
For surrogate modeling Reduced Order Models seem relatively common. And in particular one approach is called P.O.D. (proper orthogonal decomposition). Which essentially computes a linear manifold of the original state variables.
How do these reduced order models save compute costs? In particular once you have the reduc... |
I'm struggling to determine the order of error when considering the error value denoted by $\text{err}$ in relation to the variable $h$. Specifically, I aim to ascertain the value of $x$ in the expression $\text{err}=O(h^x)$. Assuming $\text{err}=ch^x$, I attempted to use the logarithm with base $h$ as follows:
$$\log_... |
I've looked into distributed numerical computation work before, but I've realized that 3D applications are all about 3d surfaces and meshes.So I'd like to look into related work on mesh and parallel numerical computation
|
So I recently learned about Polynomial Chaos Expansion (aka PCE), and it seemed to me that its purpose was to propagate uncertainty from the inputs to the outputs more efficiently (via closed-form moments). But I am no longer sure that makes sense (only considering a non-intrusive case)...
Given: $Y=\eta(X)$ s.t. $\eta... |
Context:
I was reading a tutorial on polyhedral optimization. But got confused while trying to translate the iteration domain (i.e. loop bound) to set builder notation.
Problem Description:
A code snippet from the article;
for (int i = 0; i <= 2*N; ++i)
S: Z[i] = 0.;
The iteration domain for the statement 'S' is d... |
I had heard in a lecture, perhaps 15 years ago, that the vast majority of the world's HPC resources were dedicated to solving linear systems by iterative methods. I seem to remember it was 90%. I can't find a reference for a figure like this. Are there any recent estimates for this?
|
I often do simulation of dynamics of mass points connected by strings (e.g. molecular dynamics, soft body dynamics etc.). Typically I do it simply by integration of equations of motion by e.g. verlet integrator (with some time step dt). There I evaluate all forces in every step. This includes:
hard/strong forces ( e.g... |
Finite differences are usually used to integrate ODE's and PDE's. However, sometimes they can be used for differentiation which I illustrated simply by using the Matlab code below to differentiate the function $\cos(x)$. I am confused about when I can use finite differences for differentiation, and when I can't. I woul... |
I have a triangular matrix stored in packed format (ie $L$). I need to compute $LL^T$ (not the decomposition, just the multiplication). What would be the preferred way of computing this with blas/lapack?.
One obvious way would be to follow the following steps:
Convert packed format to full triangular (DTPTTR)
Compute ... |
I have a 2-D matrix with 2 spatial coordinates and I want to be able to vectorise the process of numerically differentiating with respect to its 2 coordinates, rather than just looping along the rows and columns. On page 307 of this, they have the equations:
(2.9a) $\quad f^{\prime}\left(x_i\right) \approx \alpha_{i,-2... |
I want to find optimizations to my code for the 3BP, and more specifically computing accelerations. I'm using a data-driven approach, so I have a bodies structure that contains arrays for mass, position, velocity, and acceleration, all stored as Vector2d's of the library Eigen. So something like array<Vector2d, 3> posi... |
Consider the standard weak form of the Poisson equation with coefficient $\alpha$:
\begin{equation}
\int_\Omega \dfrac{\partial v}{\partial x} \dfrac{ \partial \left( \alpha u \right) }{\partial x} = \int_\Omega v f
\end{equation}
If $\alpha$ is constant it can be dragged from inside the partial derivative and one c... |
I am trying to use a shooting method to compute the shape of liquid-gas interface given by the following differential equation:
$$
\frac{d^2 \theta}{ds^2} = \frac{f(\theta)}{h(h + 3\lambda)}
$$
with $\frac{dh}{ds} = \sin\theta$. Here, $f(\theta) = -0.67(\sin\theta)^3/(\theta - \sin \theta \cos \theta)$, $\theta$ is an ... |
This question is largely motivated by the famous paper "UNIFIED ANALYSIS OF DISCONTINUOUS GALERKIN METHODS FOR ELLIPTIC PROBLEMS"
The Bassi and Rebay biliniar DG form is given in page 11 in the paper mentioned above as:
\begin{equation}
B_h(u_h, v) = \int_{\Omega} (\nabla u_h \cdot \nabla v + r([[u_h]])r([[v]])) \,dx -... |
I'm currently working on understanding some very old code. They are trying to solve an underdetermined system and the comments say that they want the minimum norm solution.
The system they solve is: $A x = b$, with $A \in \mathbb{R}^{5 \times n} (n > 5)$
Unless I'm mistaken, you can obtain a minimum norm solution via a... |
I want to calculate the divergence of a rank-2 tensor field $$\nabla \cdot T$$ defined on the surface of a sphere in spherical coordinates. As an example, let the field be given as follows :
import numpy as np
np.random.seed(42)
LAT = 100
LONG = 100
tensor_field = np.array([np.random.rand(LAT,LONG) for i in range(9)]... |
Solver.py:
import numpy as np
import math
E=3000000
A=2.0
truss = [
np.array([[0, 0], [0, 8]]),
np.array([[0, 0], [8, 8]]),
np.array([[0, 8], [8, 8]])
]
lengths=[]
for i, t in enumerate(truss):
lengths.append(math.hypot(t[0][0] - t[1][0], t[0][1] - t[1][1]))
n_joints = len(truss) + 1 # assuming the ... |
Consider this Stokes equations,
$$
\left\{
\begin{array}{r}
- \mu \Delta \vec{u} + \nabla P = \vec{f} \\
\nabla \cdot \vec{u} = 0
\end{array}
\right.
$$
Weak form I is:
$$
\left\{
\begin{array}{r}
{\color{red}{\mu <\nabla \phi, \nabla \vec{u} > - <\nabla \cdot \phi,P>}} &=& {\co... |
I need some help to minimize a numerical integration. It's about a classical problem in physics (hydrogen atom). It can be solved analytically but I need to solve it numerically in Python.
We have an electron's wave function $\psi(r,a)=e^{-r/a}$ and a Hamiltonian (in Ry units) $H=-\nabla^2-\frac{2}{r}$. The expected va... |
I'm trying to do something that I thought would be very straightforward but somehow I'm struggling.
I have a time series and I want to extrapolate it, assuming a linear trend, to forecast when will it reach a certain point.
For that, I tried using NumPy to fit the polynomial
$$
y = c_0 + c_1 x
$$
with this code:
from n... |
I am currently working with convection equation $\frac{\partial C}{\partial t}+u\frac{\partial C}{\partial x}+v\frac{\partial C}{\partial y}=0$. I assume that the velocity field is incompressible i.e. $\frac{\partial u}{\partial x}+\frac{\partial v}{\partial y}=0$. However in most scenarios, I don't have the explicit e... |
I have a finite element project based on deal.II and cmake/make as build system.
I am aware of popular libraries such as deal.II, trilinos, petsc, mumps, superlu_dist,... to solve large sparse linear systems $Cx=d$.
However, for some preprocessing tasks, I am looking for packages that allow me to solve
$Cx = d$ subject... |
I wrote the following function which is simulating a damped mass-spring oscillator. It is being driven by the audio sample input at 44.1 kHz sampling to create the same effect as a resonant bandpass filter.
The "base" is being directly positioned by the audio input samples (input), then I calculate the spring length, a... |
I'm developing molecular dynamics where my time-step is limited by stiffness of the bonds. I trying to get inspiration from game-engines, where they solve similar problem (hard bond constrains). These people think really hard how to get reasonable approximation with low computational effort on GPU, which is exactly wha... |
The are good methods to deduce finite difference schemes for derivatives of functions of one variable. But how to get a good one for the mixed derivative of a function of two variables $u=u(x,y)$, namely:
$$\dfrac{\partial^2 u}{\partial x\partial y}$$???
I know and I understand the formula $\dfrac{\partial^2 u}{\partia... |
I'm working on a Uni project where I need to determine the length of a stainless steel pipe that is required to heat a fluid up to 1000°C. The pipe will be placed in an oven that can reach up to 1400°C. The pipe's outer diameter is 6mm, and the inner diameter is 4mm.
I've developed the following heat transfer equation ... |
I will shortly be teaching a second-year Python-based course on scientific computation in a mathematics department. It is just a one semester course with many things to cover, so I do not want to spend too much time on any one thing. However, I would like to get the students to read and understand a small chunk of co... |
I have a large structure with many DOFs. But the application of force is very localized say over one or two nodes. If I try to run FEA on this with Guyan Reduction, I think the efficiency of reduction would be very less.
The stiffness matrix can be partitioned into master and slave stiffness matrices:
$K = \begin{bmat... |
I have a smooth function $F: \mathbb{R}^n \to \mathbb{R}^{n-1}$ and points $x_0, y_0$ with
$F(x_0) = y_0$.
For theoretical reasons, I know that $y_0$ is a regular value of $F$,
which means that the Jacobian at every point that maps to $y_0$ has full rank
$n{-}1$.
Since $y_0$ is a regular value, the preimage $F^{-1}(y_0... |
I am trying to solve the Euler–Bernoulli beam numerically in structural dynamics analysis:
$$\frac{\partial^2w(x,t)}{\partial t^2}= \frac {q(x,t)}{\mu(x)}-\frac {1}{\mu(x)}\frac {\partial^2}{\partial x^2}\left[E(x)I(x)\frac {\partial^2w(x,t)}{\partial x^2}\right]-\beta(x) \frac {\partial w(x,t)}{\partial t}$$
I use bac... |
I am struggling with an assignment concerning Newton's method. We are to approximate 3 intersection points using intersecting circle coordinates P1, P2 and P3, using Newton's method. And I can do that for say 1 point at a time with an initial guess. But I need this in a for-loop for all 3 points.
I am struggling with i... |
What I did
Using the finite difference method, I solved with a certain amount of error the following system of hyperbolic partial differential equations in cylindrical coordinates (the problem is axisymmetric, so the angular coordinate is not used):
$$ {\partial ^2 u \over \partial r^2} + {1 \over r}{\partial u \over \... |
I am trying to use quintic Hermite basis functions for FEM applications, could someone please direct me to the general formula that would help me generate quintic Hermite shape functions?
In natural coordinates from -1 to 1, for instance in cubic Hermite functions it is
$$\phi = 0.25 x^3 - 0.75x + 0.5\, .$$
|
When I do my project, I need to optimize piecewise linear objective functions (perhaps non convex) with equality constraints.
The piecewise linear objective function may be not convex like this in the graph
Since it is not convex, I fail to get the right result in https://or.stackexchange.com/questions/11583/
Now I am... |
I have a 3-body simulation which must run millions of times.
As far as I know, the GPU shines when it gets to preform simple operations on huge matrices/arrays. Currently I'm debugging and running my simulation one at a time, in which case there is basically no need for the GPU, since 3 objects really isn't a lot. I'm ... |
Is there a standard way of implementing rolling friction in COMMERCIAL finite element software?
There's no book about such a subject in COMMERCIAL FEM software though there are books on algorithms that are best for people writing code themselves (e.g. Wrigger's "Computational Contact Mechanics' book has a section on ro... |
I am trying to optimize the following objective function according to some constraints. However, the optimization fails at the first iteration with the message that the desired error was not necessarily achieved due to precision loss. Does anyone have any advice as to why this happening so early on? Can you recommend a... |
Here in the documentation of mosek (https://docs.mosek.com/latest/pythonfusion/debugging-numerical.html)
we see:
Never use a very large number as replacement for infinity
. Instead define the variable or constraint as unbounded from below/above. Similarly, avoid artificial huge bounds if you expect they will not becom... |
I'm trying to follow the wikipedia page about catastrophic cancellation but I've hit something that just doesn't make sense to me. They say that subtraction can amplify existing approximation errors (by making relative error of the difference much larger than relative error of the terms).
But also they say that relativ... |
I obtained a list of $\overrightarrow{r}_{end-to-end}$ from a Monte Carlo simulation of polymer movement.
# r_end-X r_end-Y r_end-Z
-177.236 100.309 -130.930
-184.354 88.047 -117.760
-172.577 87.168 -117.745
-197.651 103.270 -124.953
-190.053 104.223 -128.100
-187.985 102.387 -127.593
-190.839 91.210 -118.643
... |
suppose that I have a region called $\Omega $,suppose that this is a 2D or 3D region, how to generate the corresponding space-time mesh by using FEniCS? and how to extract the boundary and implement integration on boundary?
|
Finite Element allows one to divide a continuous medium into a mesh and compute structural properties of it. Instead of discretizing the continuous, why not start with a discrete method to begin with? Could we not see the entire structure as a space grid, whose equations are known and test the structure accordingly?
I ... |
Is there any reference on solving the heat equation on irregular geometries via creating a mesh and using the graph Laplacian instead of FEM techniques? (Convergence to real solution).
That is to say, given a set of points $\{x_i\}\in\Omega$, with $\Omega$ a domain, what is the Laplacian matrix best approximating the L... |
I would like to use gradient descent to "randomly sample" solutions to a set of homogeneous polynomial equations. Because the equations are homogeneous, setting all variables to 0 is a valid solution. I'd like to somehow "bias" the search to finding solutions with many of the variables non-zero. Is there an easy way to... |
I'm currently reading the book computational fluid-structure interaction, but the book doesn't provide any code, and I can't understand the ALE method, could you please provide some codes written in python by using external libraries on ALE or space-time stabilized SUPG method? thank you
|
I am currently writing a code for the Bose-Hubbard model, and I am calculating the ground states and single-particle density matrix for different values of U and J. As U=0, one would see how the energy gap between the first two energy states would close, which happens. However, as I look at the eigenvector of the groun... |
I have a NN for PINNs, which takes an 2D input and provides an 1D output. I need to normalise the input data(lets say between -1 to 1). I can think of two approaches where
Approach 1: one approach computes the normalised data outside the gradient scope(NN) and passes the normalised input value into the NN
x = np.linspa... |
I am currently studying the effects of group velocity on the finite difference solution of the wave equation. Most of what I learned is from this source. I understand that high frequency components in the initial and boundary conditions can cause numerical dispersion and anisotropy in the 2D case. While the dispersion ... |
I ran the FEM analysis for a simple supported beam problem using solid elements in plane strain condition, with linear kinematics and linear elastic material. I'm not happy with the solution since there is stress concentration at the point boundary condition, see the figure below. I know this is not avoidable for this ... |
I have a program that implements a multivariate function, call it $f = \mathcal{Q}(Z,v)$ that I can compute given $Z,v$. The $v$ variable is related to the $f$ variable by another relation, call it $v = \mathcal{L}(f)$ (so given $f$ I have a program that can compute $v$). I would like to use this to obtain how $v$ vari... |
I obtained a list of $r^2_{end-to-end}$ from a Monte Carlo simulation of polymer movement.
#r-end-squared
58617.14512069625
55606.1082220041
51244.724846185505
65344.140277928964
63392.17236605068
62101.375689808614
58814.8832777033
60040.00627213609
52019.130880313125
56984.44642212785
... ... ... ...
I want to compu... |
In ALE, we first set a referenced space for fluid, then we extend the boundary fluid displacement to the whole fluid region, take harmonic extension as an example, we need $$\Delta \left ( \hat{u} \right )=0,\hat{u_{f}}=\hat{u_{s}} \ on\ \hat{I}\, and \ \hat{n}\cdot \hat{u{_f}}=0 \ on\ \partial \hat{F}-\hat{I}$$, so ... |
I am trying to self-learn concepts at the intersection of physics and programming. When reading up on the Ising Model, I find that the typical programming tutorial (such as this one) covers the Metropollis-Hastings algorithm; most online resources show this algorithm being used to flip one spin-state at a time until th... |
I manage to implement adaptive sampling by drawing samples iteratively from an update distribution which is represented by a mixture of two distributions, such that
$$ρ_{new} = a * ρ_{old} + (1 - a) * ρ_{add}$$
where $ρ_{old}$ is uniform distribution at first iteration and $ρ_{add}$ is always normal distribution.
It go... |
What sort of path should I follow to make a the transition from high school physics to computational science?
Context
15 years teaching experience in physics and general science. Maths is currently rusty, but currently I teach college level physics to 14 year old students in China using algebraic approaches and soon to... |
In my earlier question Interpolating the gradient of a cylindrically symmetric potential field expected obey the Laplace equation, especially near/across r=0 I give a simple example of a Jacobi relaxation script - the Laplace equation is solved for a cylindrically symmetric electrostatic lens system. The symmetry reduc... |
If I have some dense matrix that can be decomposed into a product of sparse matrices with known(but different) sparsity patterns. Can I somehow use this information to more efficiently compute its Eigenvalues and Eigenvectors and its Moore-Penrose Pseudoinverse? By efficiently I mostly mean with lower memory cost since... |
The elliptic integral of the second kind is given by
$$
E(t,m) = \int_{0}^t \sqrt{1-m \sin(s)^2} \operatorname{ds}
$$
and there is for instance a scipy function ellipeinc that computes it.
The following formula comes up in the parametrization of constant negatively curved surfaces of rotation.
$$
H(t,m) := \int_{0}^t ... |
If we want to improve the accuracy of our numerical estimation of a derivative, we can use Richardson extrapolation. The method is very beneficial when using a centered difference scheme and the stencil can be derived the following way. Let $h$ be the step size. Using Taylor's expansion, we can write:
$$f(x + h) = f(x)... |
I'm trying to implement a simple Neural Network for Couette Flow. I'm working with a Fully Connected Neural Network. I'm finding that the convergence of the Neural Network is highly dependent on the problem parameters and the initialization of the weights. I'm minimizing the physics based residual, which which the deri... |
I have a quintic Hermite basis functions [-1,1] for FEM applications, I wanted to check if it's nodal functionals are proper. Could someone explain nodal functionals in details and give an example of how to check them. By nodal functionals, I meant N_i[phi_j] = delta_ij, where phi_j are my basis functions on [-1,1]. No... |
I'm new to OpenModelica.
My problem is equivalent, to take an example from the physical world, to filling or emptying a tank between two limits of min and max height that I can determine (parameters). Filling or emptying is linear.
I want to develop a dedicated block in OMEdit to do that, with the following specificati... |
This is a repost from another community, I think the question would be better here.
This bug has been haunting me for a while and would love new pair of eyes to help, not sure if this is the right place for such a question so please let me know.
I am solving a nonlinear Poisson's equation numerically using a mixed Cheb... |
Suppose I have a positive semidefinite matrix $M = \sum_i^N A_i^T A_i$ where each $A_i$ is a fat matrix of shape (m,n) and $m << n$, we can also assume that $A_i$ is full rank(but the stacked matrix might not be). I can compute the projection onto the kernel of $M$ by computing the individual projections onto the kerne... |
How is the Petrov-Galerkin FEM different from more common FEMs? Could anyone give a layman description? What's the advantages of using the Petrov-Galerkin FEM?
|
Is there any mesh size restriction of spatial discretization in FEMs and FDMs (finite difference)?
If a mesh is very coarse there is still perhaps nothing to stop the program from running and cause reporting errors, making me conclude that there is no such requirement on the spatial mesh size as that on the time step l... |
Which of ode23, 45, 15s, 15i in matlab are dissipative or anti-dissipative for conservative ODEs?
Do they STAY dissipative or anti-dissipative for ALL conservative ODEs nor not? If not, what about for a simple harmonic oscillator?
|
I wanna use matlab live scripts to run a loop updating an animation because this will allow to playback the animation. In the normal command window or m files one can use uicontrol to stop loops or close figures. But this doesn't seem to work for live scripts because whenever 'figure' is called, a figure will pop up, t... |
I have read that the upwind scheme is flux conservative. Then by my understanding, in the absence of sinks/sources and with absorbing boundaries, the amount of the quantity leaving through the boundaries should be equal to the total initial amount of the quantity. However in practice this is not the result I'm getting ... |
Non-dimensionalization is a really frustrating topic for me, and I imagine many others, because in school it was glossed over while being really important to implementing a simulation.
I'm writing a CUDA C/C++ project on a single GPU in order to solve the Ideal MHD equations, but have run into a barrier where I need to... |
I am solving a nonlinear dynamical system given by a nonlinear elastic problem which takes the following form:
$$ \boldsymbol{M} \ddot{u} + \boldsymbol{K}_{\textrm{NL}}u = 0 ,$$
here $u \in \mathbb{R}^N$ is the displacement and $\ddot{u}$ is the second time derivative of the displacement or the acceleration, $\boldsym... |
I'm looking for pointers/examples of solving system of equations $y_i=f_W(f_U(x_i))$ for $W,U$ where
$f_M(x) \approx M x$
$U,W$ are updated simultaneously
$i\in (0, 10^{12})$
Simplest example is learning $Tx=W_{10} W_9 \ldots W_1 x$ where $T$ is some matrix and $x$ is random normal vector. One can do it by computing ... |
In my code I am able to implement zero Dirichlet boundary conditions, however, in my opinion my method does not seem to be as smooth and effective as possible. I am solving a Poisson's equation with two different boundary conditions, periodic along x and non-periodic (zero Dirichlet) along y. Therefore, my I have to be... |
I am working on an interpolation problem with a domain in R^2 and values in R. Essentially, I have a rectilinear grid with target values for each point. I have fitted a function against these values, the function being a polynomial of a fixed degree on each subdomain between grid points.
I would like to visualize the r... |
I am solving the advection problem with high order numerical methods, using the method of lines. The boundary conditions and initial condition are selected in a way where I know that the exact solution should obey $0\le u \le 1$.
$$ \frac{\partial u}{\partial t} + \nabla \cdot (u \textbf{v}) = 0.$$
One popular way to d... |
I am completely stunned how numerical errors can diverge for so innocent programs.
In Python 3.11.7 the program
import math
u = 5.0
for i in range(73):
u = 6*math.cos(u)
print(u)
displays $-3.8591995867613633$.
In Julia 1.9.2, the program
u = 5.0
for i=0:72
u = 6.0*cos(u)
end
print(u)
displays $-3.770177449898713$... |
Where can one find Prof Lawrence Shampine's hpde matlab code?
Is it well received? It's not commonly talked about.
|
The graph plots the X coordinate of the synchronized Lorenz chaotic system. I am self learning by reading research articles on how to synchronize identical chaotic systems. But as seen from the figure, synchronization does not happen. I used two Lorenz systems with slightly different initial conditions and played arou... |
Lanczos algorithm can be used to find the largest/smallest eigenvalues of matrices. I am trying to find a good library in C/C++/Rust for finding the smallest singular value (or eigenvalue). I have attempted several open-source implementations of the Lanczos algorithms. I benchmarked them against the svds function in MA... |
[Also posted here: https://mathoverflow.net/q/464433/]
Many good algorithms are out there computing truncated SVD: https://mathoverflow.net/q/161252.
I am trying to implement some codes to find the smallest singular value of a big matrix $A$. ARPACK can do that via eigenvalues of $M = A^\ast A,$ using Arnoldi methods. ... |
I'm trying to obtain the graph of x(y) from the following system :
Therefore I tried to solve this system using an Euler Method :
def euler_method(v0, j0, phi0, dt):
v_values = [v0]
j_values = [j0]
phi_values = [phi0]
vx_values = np.multiply(v_values, np.sin(phi_values)).tolist()
vy_values = np.multiply(v_values, np.c... |
In the literature, I've seen the lasso problem phrased as the minimization of: $$\frac12x^tAx-x^tb+\lambda||x||_1$$
or of:
$$\frac12||Ax-b||_2^2+\lambda'||x||_1=\frac12x^tA^tAx-x^tA^tb+b^tb+\lambda'||x||_1$$
If $\lambda=\lambda'=0$, then the second problem minimizes the norm of the gradient of the first, and the two pr... |
I have written the following code in MATLAB. I also observe the same effect in Arnoldi iteration in ARPACK in C.
N = 4000;
A = rand(N); % Random entries in Uniform[0,1]
tic
AstarA = A.' * A + 5*eye(N);
toc
AstarAinv = inv(AstarA); % Inverse
tic
eigs(AstarA, 1, "smallestreal") % Eigenvalue with smallest real part
toc
ti... |
I'm trying to learn how to compute accurate derivatives using the FFT. In the code at the end of this question I'm trying to compute derivatives of
$$
f(x) = \exp(-10(x-1)^2) ,\, \, x \in [0,2]
$$
This works out because the function is infinitely differentiable, decays smoothly towards the end of the interval and can b... |
Below are two ways of writing what is seemingly (to me at least) exactly the same thing:
void do_some_work(MPI_Request* send_reqs, int* send_counter) {
for (int i = 0; i < someNumber; ++i) {
// working version
MPI_Request req = send_reqs[*send_counter];
MPI_Isend(ptr, n_elem, M_MPI_REAL, trg... |
I'm trying to understand how BLAS libraries implement fast GEMM with support for transposed matrices. Say, I'm only operating on square matrixes (with dimensions n by n) and I update a submatrix of c in the following manner c[x:x+6][y:y+16] += a[x:x+6][slice_start:slice_end] * b[slice_start:slice_end][y:y+16] with the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.