instruction stringlengths 43 28.1k |
|---|
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 difference method $\big(\text{derivative of f w.r.t. x}\sim\frac {f(x+\epsilon)-f(x)}{\epsilon}\big)$ using the $O( \ )$-... |
I am trying to perform the following integral
$$\int_{0}^{2\pi}\int_{0}^{+\infty} \frac{r'\left(e^{-r'^2/2\sigma^2}\right)\left(r-r'\cos(\theta-\theta')\right)}{r^2+r'^2-2rr'\cos(\theta-\theta')}dr'dθ'$$
Using Gauss-Hermite for $r$ and Simpson 1/3 rule for $\theta$ with no success. I can't find my mistake but the outpu... |
I have a function $f(x)$ defined on a domain $D$, but such that the image $f(D)$ may contain extra regions not included in its domain. I am interested in solving the fixed-point equation $x=f(x)$. If I do a fixed-point iteration:
$$x_{n+1} = f(x_n)$$
starting from a point $x_0\in D$, I risk that some point $x_n\notin D... |
I have a system of equations that I am trying to solve. In matrix form, it's written as
$$x(I - S) = b.$$
I am solving for $x$, where $I$ is the identity matrix and $S$ is a matrix where each column sums up to one. $b$ is strictly positive.
Now, unfortunately, the determinant of $I - S$ is very small. Inverting it lead... |
In a dusty plasma system there are more than one component with different masses, i.e, electrons, ions,neutrals and dust grains. Accordingly, there are more than one temporal and spatial scales involved. I am aware that such a system is difficult to simulate, because, due to very different scales involved it may requir... |
This is my attempt to find the approximate solution of the folowing transport equation $$\left\{\begin{array}{ll}
\partial_{t} u+\partial_{x} u= (x^2-x)t+x^3/3-x^2/2, & t \in(0,0.4), x \in(0,1) \\
u(0, x)=2, & x \in(0, 1) \\
\frac{\partial u}{\partial n}=0 & t \in(0,0.4), x=0\quad or \quad1
\end{array}\right.$$
by usi... |
This is a followup to my previous question here
I have the following dynamical system,
$\frac{d \phi}{dt} = -M^TDM\phi \tag{1}\label{1}$
$\frac{d \hat\phi}{dt} = -M^T\tilde{D}M\hat \phi \tag{2} \label{2}$
$\eqref{1}$ represents the exact dynamics of a system and $\eqref{2}$ is the approximate dynamics that should give... |
I have a program where I need to solve a linear programming problem in a fast loop. The language I'm using is Java and any kind of bindings to other languages are not acceptable. Libraries might be acceptable, given permissive license, but I generally prefer own code to libraries.
The problem is very simple. It has fiv... |
The coarse grid matrix is calculated via RAP where R,P are the restriction and interpolation matrix,respectively.By checking a typical MG algorithm
I want to ask how to calculate efficiently coarse grid matrix in each MG iteration?Isn't it a computational cost to calulate RAP every time until you reach the coarsest le... |
I'm solving a PDE in matlab using ode15s, and since the spatial dimension is 2, and number of variables grow large very quickly, I need to supply the structure of the jacobian (called JPattern in Matlab) by indicating the position of nonzero elements of the jacobian. The jacobian 'pattern' for each point in 2D (indicat... |
I have a basic question to ask:
Let's say I am reading a paper which gives a good model that consists of a set of ordinary differential equations, with first and second derivatives. Continuity is a requirement for differentiability, as we learned in an Analysis course.
Now, I simulate this model, writing code in Matl... |
I am trying to look at how different floating points are stored in memory.
Firstly I looked at the System.Double (accessible by keyword Double in vb.net) which I think I understand. It is stored as follows:
$\pm (I+a)\times 2^b$
where
$\pm$ requires one bit.
$a \in [0,\sum_{k=1}^{52}2^{-k}]$ and consumes $52$ bits.
$b... |
I've recently learned about using weighted residuals with the Galerkin method to numerically approximate even-order differential equations (for linear elements, I'm still a beginner). It seems for odd-order differential equations you cannot use integration by parts to reduce the order of the third-order differential op... |
Consider the system of linear equations:
$$
Ax=b
\tag{1}
\label{eq1}
$$
where
$A\in\mathbb F^{n\times n}$, diagonalizable dense matrix, over the field $\mathbb F$ of real or complex numbers,
$x\in \mathbb F^{n\times 1}$ is a vector of unknowns
$b\in \mathbb F^{n\times 1}$ is a known right-hand side vector
$n$ is in ... |
I want to do a huge simulation that requires ~ 1 TB of data to describe a bunch of interacting particles (each has different interactions). Is it possible to store this data in an array in C++, so that I can access it during the simulation?
I have access to a 60 node cluster. Each node has 2 CPUs with 48x16GB DDR4. So ... |
I have an X value that can go from 0.0000001 to infinite.
I want, if this value is less than 0.8, get 0.8
And if that value is equal to or more than 0.8, get 0
How would you do that using only min and max functions (and of course basic +-/x operations) ?
I ask this because I have to calculate this inside a custom pie... |
I am trying to simulate pressure waves crossing a boundary from one medium to another (e.g., water to air) in Matlab. The code that I have got so far, which is largely taken from Wikipedia on Partial Transmission only changes the speed as the wave crosses the boundary. The code works using a recursive form or the wave ... |
I've tinkered with Matlab's PDE toolbox for a while but was wondering whether anyone here has used Julia to build a PDE solver. If so, what are the advantages and limitations of Julia for PDEs? I'm mostly interested in simple PDEs with constant coefficients but am also thinking of variable coefficients for modeling pur... |
If I were to have a data for a one-dimensional system evolving in time, essentially a two-dimensional array, and the array at each point in time is of the same size, how would I produce something like this:
(Taken from Turing’s model for biological pattern formation and the robustness problem by Maini et al., 2012)
I ... |
In this command:
[US,TS] = ordschur(U,T,select)
what should replace the select to rearrange the eigenvalues in descending order (maximum value starts at the upper leftmost cell) as per ordschur Matlab documentation?
Say,
H=[-149 -50 -154; 537 180 546; -27 -9 -25];
[U,T]=schur(H);
[US,TS]=ordschur(U, T, select);
An e... |
When a mesh partitioning takes place and every process works on a part of the mesh is any way to rename the global numbering of nodes(on each process) into a local numbering?Is there any software that can do it?
|
I'd like to know if SNOPT solver is available free of cost for academic research in any of the optimization software packages.
I came across a few softwares that have SNOPT, but those require a commercial license.
|
I am a beginning graduate student in the field of continuum mechanics. It is my understanding that most problems in this field are numerically solved via finite element methods (FEM). However, I have also seen papers where people are using lattice spring models (LSM) as their chosen numerical method.
I am not able to... |
I have to simulate the following differential equation:
$$\dot{x}=p$$
$$\dot{p}=-x-x^3-\gamma p+F\cos\omega t+ \delta F(t)$$
where
$$\langle F(t)F(t')\rangle=2\gamma k_BT\delta(t-t')$$
$$\langle F(t)\rangle=0$$
$F=0.006$, $\omega=1.016$, $k_BT=0.008$, $\gamma=0.001$
I want to simulate for a long time of $T=800$ and... |
Suppose we need to compare
$\left \lfloor{a / b}\right \rfloor $
and
$\left \lfloor{c / d}\right \rfloor $
.
One way would of course be to calculate $a/b$ and $c/d$ by division. Is their a faster way?
|
In an arbitrarily unstructured mesh, shown in the figure below, in the context of finite volume method, I want to obtain an approximation of $\phi_f$, where $N$ and $P$ are cell centers of adjacent cells and $f$ is the face center- $N$,$P$ and $f$ are not aligned. CFD textbooks say:
$$ \phi_f=g\phi_P+(1-g) \phi_N$$
whe... |
Is there a difference between phenomenological modeling and mathematical modeling? When reading a few journal papers, I often see the former being used -- is it just fancier wording? If it's relevant, the papers I'm reading have both modeling and lab experimental studies, and both the simulations and lab measurements ... |
I was searching around here for a while but I didn't find any discussion on this topic. We know that a problem is well-posed when
There is a solution (existence),
There is only one solution (uniqueness),
The solution depends continuously on the data for the problem (stability).
I suppose that as soon as either one of... |
I am trying to solve Maxwell Stefan's equation over a membrane to get the transient mole fraction distribution over the membrane thickness 'z'. But somehow I am not able to code it using ODE45, more likely I am not able to write the system to solve using ODE45. It will be really great if someone can help me with the pr... |
My professor taught us to always use the Matlab command axis equal for our simulation data plots - for all of our homework assignments.
However, in studying the SIR infectious disease model, I'm studying a scaled version, so instead of using population counts I am more conveniently using fractions of populations, so th... |
Are there any ODE solver packages that use coroutines and yield their results instead of functions and returning?
Briefly, a subroutine in a programming language does some computations, returns a result to whoever called it, and then it's done. A coroutine does some computations, yields a result to whoever called it, a... |
How can I write down two-dimensional Navier-Stokes equations for a simple rigid object immersed in a flow and freely falling due to gravity? I'm trying to view the vorticity that's induced by the fluid-solid interaction.
I'm using Matlab for the simulations.
|
If I'm given some sort of shape and there is a displacement given but there are no external forces acting on the body, do I still need to write down the traction free boundary conditions or will there only be displacement boundary conditions?
|
I need to find the displacement field for this sphere shape in terms of $\delta$. So far, by applying boundary conditions, I know $u_r = u_\theta = u_\phi = 0$ at $r = a$ and $u_r = \delta, u_\theta = u_\phi = 0$ at $x = b$.
I am confused on how to go from here, can anyone explain?
|
The element stiffness matrix in 3D FEM problems is build as follows:
$$ K = \int\limits_{[-1,1]^3} B^T C B\, |J| \mathrm{d}r\, \mathrm{d}s\, \mathrm{d}t$$
The integral can be solved using e.g. Gauss quadrature method.
But for me it seems to computational expensive if you perform the above equation for, e.g., 500.000 he... |
What is the cost in terms of flops for the computation of $A$ to the power of $p$, where $p$ is a positive integer and $A \in \mathbb R^{n\times n}$ is a symmetric matrix?
|
I am implementing on Matlab a high-order finite differences scheme to approximate the first derivative of $f(x_i)$ given $x = [x(1), x(2),..., x(i),..., x(n)]$ and $f = [f(x(1)),..,f(x(n))]$ with $x$ a non-uniform grid from $x(1)$ to $x(n)$ (in fact they are Legendre-Gauss-Lobatto nodes in $[-1,1]$).
Right now I use th... |
If I have a symbolic matrix defined as T below, is there any way to lambdify this as function of variables, say σ..., and return a matrix in a way that does not allocate (besides the allocation for the matrix that is returned)?
using SymPy, BenchmarkTools
σ = [symbols("σ_$i$j") for i in 1:4, j in 1:4];
T = Array{Sym}(... |
In this question I adress the stability property of a numerical scheme (a FDM described below) to the problem
$$
\begin{align}
u_{t} &= \alpha u_{xx}+\beta u_{xxxx}, & &x\in\mathbb{R},\;t>0, \\[3mm]
u(x,0) &= \sin x, & &x\in\mathbb{R}, \\[3mm]
u(x+2\pi,t)&=u(x,t), & &x\in\mathbb{R},\;t>0.
\end{align}
$$
where $\beta \l... |
I'm a little at loss as to what my supervisor meant by the "hierarchical block decomposition" of a matrix, but the goal is to put a sparse symmetric adjacency matrix into a block diagonal structure to highlight the structure of the clusters present in the data.
(The data captures whether the two proteins are adjacent i... |
I start by saying that I do not have a strong background in numerical analysis, so I may miss some basic things or make trivial mistakes.
Motivated by some problems in digital signal processing, I would like to solve numerically a linear ODE of order $m$ of the form:
\begin{equation*}
y(t)+ a_1(t) y'(t) + \dots + a_m(t... |
I'm looking for a grid-based numerical method that allows simulating water over a grid-based terrain, presumably something like shallow water equations. I have a square grid of terrain elevation values, and I want a numerical method that evolves water level (values of height of water layer on the same grid) in real-tim... |
In Jasak's Ph.D. thesis (2000), a notion is given about discretization of a transport equation:
For good accuracy, it is necessary for the order of the discretization to
be equal to or higher than the order of the equation that is being discretized.
Question:
Why?
|
I am having a dataset and trying to plot a 3-d plot between the independent and dependent variables.but, I am getting this error whenever I am trying to plot
here is my code:
temp1 = reshape(data(:,1),m,1);
temp2 = reshape(data(:,2),m,1);
temp3 = reshape(data(:,3),m,1);
mesh(temp1,temp2,temp3);
hold... |
I am trying to distribute power across different devices, so that the sum is as equal as possible to the power setpoint. At the same time, the sum of power per phase must not exceed the power of the fuse and must also be between min and max power (depending on the device). So far I have reduce the problem to the follow... |
Given $z_t=\sum_{i=1}^t \theta_iz_{t-i}+v_t $, where $t=1,...,N$ where $N=1024$. I need to write this in matrix form (a system of linear equations) as $\mathsf{A}\mathsf{z} = \mathsf{z} - \mathsf{v}$. In this case we have that $\mathsf{z}$ and $\mathsf{v}$ are column vectors with 1024 members and the $\mathsf{A}$ matri... |
Which is the best approach to solve a PDE in parallel:
1.To split the mesh the mesh in N parts and every processor works on its own part or
2.To take the global linear system Ax=b and solve it in parallel
|
Can anyone explain how does the bdschur command of Matlab works? And how should the CONDMAX and BLKS be specified? It would be better if there is an associated example.
Source: https://www.mathworks.com/help/control/ref/bdschur.html
|
I'm trying to understand how to solve Poisson equation with FFT. Say, if we have the simplest periodic example
$$u_{xx}=-4\pi\cos(x)$$
The solution then should be
$$u=4\pi\cos(x)$$
I really get the cosine, but with a different magnitude. So what I`m missing, and how to normalize solution with FFT properly?
My code ... |
MPI is an interface which enables us to create multiple processes to be run on a single machine or on a cluster of machines, and enables message passing or in short sorts of communication between processes.
I am sure they are other lots of specifications which enables multi processing to execute one bigger task. Howeve... |
Is there an area of computational science research that can be done on pencil and paper (with results written up for a journal format later on)?
I'm wondering if there is abstract proof-based linear algebra or abstract algebraic objects being developed for computational science. Seems like it would be really fun if su... |
Let $k_1 \neq k_2$ be positive reals, $t_0 > 0$ and consider the following Cauchy problem in $[0,+\infty)$:
\begin{cases}
y(t) + k(t)y''(t) = 0 \newline
y(0) = 1/\sqrt{k_1} \newline
y'(0) = 0,
\end{cases}
where
\begin{equation}
k(t) =
\begin{cases}
k_1 \hspace{1 cm} 0 \leq t \leq t_0 \newline
k_2 \hspace{1 cm} t > t_0
... |
Given a system of equations:
\begin{align}
&f''(x) = -a \cdot \sin(f(x))\\
&f(0) = b\\
&f'(0) = c
\end{align}
$a, b, c, dt, N$ are arbitrary parameters.
How to get a values of $f(0), f(dt), f(2dt) ... f(N)$. I am stuck with the non-linearity of the right part of the first equation.
I will be very glad, if someone will ... |
I'm looking to solve this boundary value question using the shooting method!
$$\frac{d^2y}{dx^2}=y\cos(x)+\frac{\sin(x)}{x^2+2}$$ given the initial values:
$$y'(x=-1)=-1\\y'(x=5)=0$$
I'm aware of the steps I should follow
Guess unknown initial values $v_i$
Solve ODE with these values: $f (x|v_i)$ → final values
Find... |
I have a fortran 90 code and I want to solve a dense linear system with GMRES. I would prefer the restarted GMRES with preconditioning. Is there some library that you know of that I could use? Now I am solving the system with LU using dgetrf and dgetrs from LAPACK.
I want to add also that the matrix is square, with di... |
I am trying to implement an algorithm that finds (possibly) all solutions of a system of nonlinear polynomial equations $$F(X) = 0$$ I thought about using the (convex) homotopy $$H(X,T) = TF(X) + (1-T)G(X_0)$$ with $X_0$ a known solution to $G(X_0)=0$. By increasing $T$ iteratively from $0$ to $1$, the sought solution ... |
This post is inspired by N. Higham post "What is Random Orthogonal matrix?".
In this post, N. Higham links to the two papers:
G. W. Stewart, The efficient generation of random orthogonal matrices with an application to condition estimators, SIAM J. Numer. Anal. 17(3), 403–409, 1980.
T. W. Anderson, I. Olkin and L. G. ... |
I have a rigid body that moves according to a set of governing ODEs, and I'd like to numerically visualize the vortices that are shed by this object. How could I proceed?
I've been reading up on the Navier-Stokes equation and have a better grasp of it now, and I've watched some tutorials on implementing a 2D solver. ... |
I am trying to write a python program that simulates the motion of a large number of particles by numerically integrating a second order ordinary differential equation. I first split the ODE into two coupled first order ODEs and solve using scipy.integrate.solve_ivp following a similar method to what is described in th... |
I'm trying to perform convolutions as defined mathematically $f \star g (\tau)= \int_{\mathcal{R}}f(t-\tau)g(t) dt$ in a numerical simulation. Hence, my signal is a sampling of points $f(x_i)$.
I need the computation to be precise, unbiased. Indeed, the simulation is there to show very refined effects, so I cannot disc... |
I am refactoring an existing algorithm where where a RQ decomposition (as opposed to the more common QR) would be rather useful.
Most common books on the subject (e.g. Golub and Van Loan) discuss QR extensively and provide algorithms for common implementations (e.g. Algorithm 5.2.1 for Householder or Algorithm 5.2.5 fo... |
I was working on an Android app that requires some linear algebra with matrices. The matrices will be somewhat medium-sized as they are not too small or too big. I was originally using jBlas because of the benchmarks I have seen online but after visiting multiple forums, they have all said that jBlas would be nowhere n... |
Currently, I am working on a remeshing routine for my simulations (Abaqus 6.14-1) using python scripts. The simulation deals with the Brinell indentation test and as the remeshing software I use Gmsh 4.5.2 (although the newest probably also works fine).
The main script is given by
main.py:
createIndentationTest.py
runJ... |
I have a $100$x$100$ covariance matrix that looks like this.
Some rows/cols are all-zero because those corresponding elements are not present in the sample from which covariance is calculated. I'm doing it this way:
...
adjmats = [get_adjmat(graph) for graph in samples] # array of adjacency m... |
The discrete exterior calculus is defined first using circumcentric dual cells, because the primal and dual edges are orthogonal and thus the dual cells are convex. This leads to a diagonal hodge star for 1-forms that is defined as $\star_1 = \frac{|\star\sigma^1|}{|\sigma^1|}$ for a primal edge $\sigma^1$ and a dual e... |
I'm trying to solve the linear non-paraxial pulse propagation equation
$$\partial_z\hat{E}=ik_z\hat{E}$$
for a field defined as $$E=E(r, t, z)$$
The equation given above uses $$\hat{E}=\hat{E}(k_\perp, \omega, z)$$. Therefore, I have to use a FFT twice, once, for going from $r$ to $k_\perp$, and once for going from $t$... |
The "Stable Fluids" paper (*) by Jos Stam starts by acknowledging that "Our method cannot be found in the computational fluids literature, since it is custom made for computer graphics applications. The model would not be accurate enough for most engineering applications."
Nonetheless, it is based on the Navier-Stokes ... |
I'm looking at scattering of waves in a symmetrical potential as part of a research project.
If a plane wave $e^{(ikr)}$ is incident on a spherically symmetric potential $V(r)$ the scattered wave is given by $S(r,\theta) = \frac{f(\theta)e^{(ikr)}}{ r}$
My understanding is that $f(\theta)=\frac{1}{k}\sum_{\ell=0}^{\inf... |
With regards to protein-ligand interactions, we talk about two concepts, docking and scoring. I understand that docking means to find the best orientation of a ligand at the active site of a protein, and scoring is to compare several docked ligands to see which ligand best binds to the protein.
To quote this paper,
... |
I have arrived at an equation in the similarity transformation -
$M_r$ = $T. M_{r-1}. T^t$ ,where $T$ is the rotation matrix and $M_r$ ,$M_{r-1}$ are similar matrices. My aim is to find the rotation matrix $T$ with a pivot element $(a,b)$ such that all elements $m_{ij} \in M$ will be as follows :
$m_{ij} \neq 0$ , if $... |
While implementing the Multipole-to-Multipole translation (M2M) with the following equation,
$$\phi(P) = \sum_{j=0}^\infty \sum_{k=-j}^j \frac{M_j^k}{r^{j+1}} Y_j^k(\theta,\phi)$$
where,
$$M_j^k=\sum_{n=0}^j \sum_{m=-n}^n \frac{O_{j-n}^{k-m} i^{|k|-|m|-|k-m|} A_n^m A_{j-n}^{k-m} \rho^n Y_n^{-m}(\alpha,\beta) }{A_j^k}$$... |
Does anyone know of any published study that talks about the practical aspects of running Adaptive Lagrangian-Eulerian techniques for solid and/or fluid mechanics problems?
I'm looking for things like benchmark results when doing a run weighted towards a more Eulerian grid than a Lagrangian grid or vice versa, mesh re... |
I am working out some optical lattice band structures (example here). I have no issue with setting up the eigenvalue equation:
$$
H_{jj'}c_{j'}=Ec_{j'}
$$
Where $H$ is the tri-diagonal matrix that equations the different Fourier components. The Bloch wave is given by
$$\psi =e^{iqx} u_n^q = e^{iqx} \sum_j a_c e^{2ikx... |
Method of Moments and Finite Element Methods are two of the most used methods in computational electromagnetics to solve electromagnetic equations.
As it is known, in FEM sparse matrixes are used while MoM uses the full-matrixes.
My question is, why MoM uses full-matrix while a sparse matrix is obtained in FEM? Is ther... |
I have two dimensional equation and I want to solve it using Finite Element Methods.
$$ \nabla . (\alpha(x,y)\nabla u(x,y)) + \dfrac{\partial u(x,y)}{\partial x}+\dfrac{\partial u(x,y)}{\partial y}+u(x,y)=f(x,y)$$
$$\alpha(x,y)\dfrac{\partial u(x,y)}{\partial n}=g(x,y), for (x,y)\in \partial\Omega$$
To obtain its weak... |
I am trying to solve nonlinear pendulum using 4th order Runge-Kutta method for limits between a=0.0 to b=110 seconds and simulated the results to observe the pendulum movement. But when I increase the number of steps N in RK4 method, the pendulum isn't decaying, it is oscillating forever, but for smaller value of N, I ... |
I am a mechanical engineer, intermediated/advanced level in MATLAB and MATHEMATICA, and beginner in Python. I intend to get a PhD in aeroelasticity (FEM + CFD) and coding my own program.
I intend to do that because I really like to code and it is a skill that I would want to have. Due to large mesh, these computationa... |
May question is about possible approaches to solve the following system
$$
\begin{array}{rcl}
\nabla{n}&=&n\,\mathbf{E},\\
\nabla\cdot\mathbf{E}&=&1-n,
\end{array}
$$
in general with some boundary conditions (BC). In particular, I'm interested to solve it in the polar coordinates
$$
\begin{array}{rcl}
\partial_rn&=&nE_... |
I am solving the heat equation discretized spatially via FEM and temporally via backward Euler.
I get the system
$$M \dot{u} = K u +f$$ where $u$ is a vector representing the solution at spatial locations.
For piecewise linear basis functions, the mass matrix is defined as
while the stiffness matrix $K$ is
By discre... |
The section 4.2 "Poor Conditioning" in the book Deep Learning defines the condition number of the function $f(x) = A^{-1}x$ as
\begin{align} \underset{i,j}{\max}~ \Bigg| \frac{\lambda_i}{
\lambda_j} \Bigg|. \end{align}
which is the ratio of the magnitude of the largest and smallest eigenvalue.
and says
When
thi... |
I am not sure if this is on-topic here, but I am trying.
Let $x,y$ be positive real numbers. I am trying to find
$$ \min_{\sqrt{a}+\sqrt{b}=\sqrt{2}}(x-a)^2+(y-b)^2$$
I tried using Mathematica for this, by running
Minimize[{(x - a)^2 + (y - b)^2, Sqrt[a] + Sqrt[b] == Sqrt[2]}, {a,
b}]
but the computation didn't te... |
I'm struggling to understand a line of FORTRAN code and was hoping someone on here would be able to help me out. These lines of code are meant to generate a flat distribution - I understand that GRNDM(RDUMMY,1) is using FORTRAN's random number generator creating a vector called RDUMMY with an array with length of 1, so... |
My code is based on the similarity transformation X=VZ.I simulate the model for transformed equations involving Z by replacing the state space modelAX+BU and RX+SU with transformed equations where X is replaced with VZ and WZ resp then I apply transformation again to obtain X back. I want to execute the following Euler... |
I'm working out the Galerkin method for the heat equation $$\frac{\partial u}{\partial t} - \frac{\partial^2 u}{\partial x^2} = 0$$ subject to $u(0,t)=0,u_x(1,t)=v(t)$.
I want to use a Fourier basis to represent the solution, i.e. $u(x,t) = \sum_{j=1}^n c_j(t) \phi_j(x)$ where $\phi_j(x) = \sin j\pi x$.
If I try to for... |
I am trying to minimize a 2d function using scipy.optimize. Specifically I want to plot the minimum value of the function fun as a function of the parameter wjk. The problem is that I cannot pass wjk as a function argument as I am not optimizing over it. How to obtain the optimized value as a function of a parameter in... |
In some areas of physics, for example radiation transport in plasmas, it is beneficial to re-express the convection equation in terms of a Legendre polynomial expansion. This results in a set of coupled equations for the expansion coefficients.
So, if the standard convection equation for a function f is:
$\partial f/\p... |
My question relates to using spherical Bessel functions in Python.
If my ODE contains a spherical Bessel function of the form $$j_\ell(tx)$$ and similarly $$y_\ell(tx)$$
for given values of $t$ and $x$.
I used the following:
from scipy.special import spherical_jn(n, z, derivative)
from scipy.special import spherical_yn... |
When one gives a computational methods talk, what's the right way to pronounce "Eulerian"?
Is it like
oiler-ree-in, 5 syllables, or
oh-lure-ree-in, 4 syllables?
Langrangian is simple:
Langrange-Ian
I live in the United States, will attend an American PhD program, and English is my first language.
For Guassian, I h... |
I know for large amounts of data there are online computation services or supercomputers or Beowulf cluster. For a small quantity of data, a good computer is enough.
But sometimes, for medium qty of data it would be very nice to be able to use resources from the computers of my colleagues in displacement for example, o... |
I'm looking to code the following function:
$$|g(\theta)=\frac{1}{2k}\sum_{\ell=0}^{\infty} (2\ell +1)\sin(2\delta_{\ell})P_{\ell}\cos(\theta)|^2$$
import numpy as np
import scipy.special as sp
def Legendre(n,x):
x=np.array(x)
if (n==0):`
return x*0+1.0
elif (n==1):
return x
else:
return ((2.0*n-1.0)*... |
I am trying to compute the continuant of a list of numbers $a_0, a_1,...,a_n$, defined by the recursion relation: $K_{n+1} = a_{n+1} K_n + K_{n-1}$ and $K_0 = 1$ (see Wikipedia).
I am trying to use divide-and-conquer as suggested by Knuth, 1971, Page 271-272.
However, my implementation:
mpz_class continuant(size_t s, s... |
I have a partial differential equatons as shown below.
$$\dfrac{d}{dx}((1+x)\dfrac{du(x)}{dx})=0$$
With the following boundary conditions.
$$u(0)=0, u(3)=10$$
To solve it using FEM, I multiplied the PDE with residual function then converted it to its weak form.
Then constructed to global matrices using three elements ... |
I am trying to solve the ODE for a harmonic oscillator using Scipy's odeint solver for different dampening factors.
I'm using the following code, based off of this example:
from scipy.integrate import odeint
m = 1 # kg
k = 10 # N/m
omega = np.sqrt(k / m)
def eps(c):
return (c / (2 * mass * np.sqrt(kspring/mass)... |
I want to use Simpson's rule to evaluate the following double integral:
$$\int_{a}^{b}\left|\int_{0}^{z}x\cdot \mathrm{erf}(x-10)\cdot J_{0}(x) \mathrm{dx}\right|^{2}\exp(-0.5*(z-40)^2)\mathrm{dz} $$
Usually, if both the limits were numeric I would get away with just applying simps from scipy.integrate twice, but here ... |
Suppose I have these two $N\times N$ lower triangular banded matrices:
$A = \begin{bmatrix}
a_0 & & \\
a_1 & a_0 & \\
a_2 & a_1 & a_0 \\
a_3 & a_2 & a_1 & a_0 \\
& \ddots & \ddots & \ddots & \ddots \\
& & a_3 & a_2 & a_1 & a_0
\end{bmatrix}$
$B = \begin{bmatrix}
1 & & \\
b_1 & 1 & \\
b_2 & b_1 & 1 \\
b_3 & b_2 & b_1 ... |
I just came upon this paper, which details the implementation of a fast method to get eigenvalues of tridiagonal symmetric matrices :
Coakley, Ed S.; Rokhlin, Vladimir, A fast divide-and-conquer algorithm for computing the spectra of real symmetric tridiagonal matrices
This method relies on a divide and conquer algori... |
I've been reading multiple papers and related posts for a while now, but I can't seem to find a specific answer to the issues I'm having so I hope someone can clarify things here.
I'll provide some background first before diving into the issues at hand.
Background
Basically, I'm developing a 1D finite element code whic... |
I am trying to generate random chi-squared numbers in C++, according to some degree of freedom (which can be a float). Several libraries can be used for that purpose, among which the C++11 Standard Library with the header <random>, or two Boost libraries, boost::mathor boost::random.
These libraries don't exactly have ... |
I'm modeling an electron that orbits the nucleus. Of course, charged particles radiate away there energy so it'll crash into the nucleus. My approach has been to to evaluate the coulomb force and add the reaction force (given by the Abraham-Lorentz formula). The equation of motion would be
$F = ma = \frac{1}{r^2} - \be... |
Define variables $p_i,u_i\in\{0,1\}^G$, for $i=1,\ldots,8$ and $G=30000$.
Let $v$ be a constant vector also in $\{0,1\}^G$, with approximately 25% of its entries equal to $1$ (randomly located).
Let $c$ be the vector $c=[1,2,3,\ldots,G]$.
Let $A$ be the matrix with $1$'s along its diagonal and $-1$'s along its subdiago... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.