#numerical-analysis

1 messages · Page 7 of 1

dusk meadow
#

Ah I see. Technically what im doing is changing the basis of a vector. I'm basically solving for z in Gz = x, where G(x) is a pos-def matrix and a function of x, and I know x. Though, I believe this implies I must invert G, no?

#

It is not sparse. I haven't heard of a dense matrix before though.

plucky kayak
#

you would be already doing one more unnecessary matrix-vector multiplication by computing G^{-1} * x, which could've been avoided by solving for z in Gz=x

#

plus spend more memory on storing the inverted matrix

#

all of this could've been avoided by solving Gz=x and only storing z

cosmic karma
dusk meadow
#

Ill look into them. Thank you.

fathom rain
#

\

silk drum
# dusk meadow It is not sparse. I haven't heard of a dense matrix before though.

If you want to process a high number of these efficiently on a computer, the LAPACK and PLASMA libraries are worth looking into for implementations of the algorithms you've been pointed to. If you are just looking to solve these one-off, MATLAB or Octave might be more user-friendly. Many of the dense algorithms factor the matrix G and allow G to be inverted without the trouble of actually finding the explicit inverse of G and applying the explicit inverse of G.

dusk meadow
silk drum
uneven thicket
#

numpy is backended by LAPACK

dusk meadow
#

@silk drum @uneven thicket Thank you, I'll check these out 🙂

heady mesa
silent moat
#

Today i had my exam at uni

#

Passed numerical analysis with 10

#

Thanks guys

heady mesa
#

👑

jaunty saddle
#

copy and pasted from dynamical systems

#

any help is appreciated

worn creek
#

Hello, could you please tell me what this symbol is called and how it is used

plucky kayak
#

contour/line integral

errant wagon
cinder sandal
#

I am having trouble implementing Simpson's rule. Can anyone help?

 simpsons <- function(f, partitions) {
  # Calculate the width of each subinterval (assumes equal width)
  a <- partitions[[1]][[1]]
  b <- partitions[[length(partitions)]][[2]]
  n <- length(partitions)
  h <- (b - a) / n
  
  # Adding initial endpoints f(x_0) and f(x_n)
  total <- f(a) + f(b)
  
  for (i in 2:(length(partitions) - 1)) {
    x_mid <- (partitions[[i]][[1]] + partitions[[i]][[2]]) / 2
    if (i %% 2 == 0) {
      # Even index: 2 * f(x_i)
      total <- total + 2 * f(x_mid)
    } else {
      # Odd index: 4 * f(x_i)
      total <- total + 4 * f(x_mid)
    }
  }
  
  # Multiply by h/3 and return the result
  total * h / 3
}
fathom rain
cinder sandal
# fathom rain is that R? they do not have slicing/views? this is an example in python ```def s...

Yeah it’s R. Here is an update to my code.

latest code. I'll figure this out later.

simpsons <- function(f, partitions) {
  endpoints <- sort(unique(unlist(partitions)))
  
  # Calculate the width of each subinterval (assumes equal width)
  a <- min(endpoints)
  b <- max(endpoints)
  n <- length(endpoints) - 1
  h <- (b - a) / n
  
  # Adding initial endpoints f(x_0) and f(x_n)
  total <- f(a) + f(b)
  
  for (i in 2:n) {
    if (endpoints[i] != a & endpoints[i] != b) {
      if (i %% 2 == 0) {
        total <- total + 2 * f(endpoints[i])
      } else {
        total <- total + 4 * f(endpoints[i])
      }
    }
  }
  
  total * h/3
}
cinder sandal
cinder sandal
vapid plume
#

Hello. Is anyone here familiar with discrete-time waveform relaxation for parabolic PDEs? Trying to implement this method in MATLAB using red-black Gauss-Seidel but my results aren't correct. After discretizing in space, we use the trapezoidal rule to discretize in time, so we just get the Crank-Nicolson scheme. As far as I know, this is supposed to be different from the standard time-marching schemes is by first looping over iterates, then over time-steps. If this is correct, then I just have questions about the initial guesses for the iterates.

Currently, for the first iteration for the first time-step, I am using the initial condition as the initial guess and then for the remaining time-steps, I am using the previous time-step iterations as the initial guesses. For the remaining iterations, I am using the previous time-step iteration for the first time-step and then for the remaining time steps, I have tried two approaches: Use the previous time-step iterations as the initial guesses or the previous corresponding time-step iterations as the initial guesses.

If this is how it is supposed to be, then there is something else I am doing wrong. Convergence is quick with these approaches and I am expecting slower convergence.

raw sand
#

Hi, I'm hoping I'm in the correct channel. I'm writing a video game that resembles a simulation of particles(Discrete Element Method) interacting with themselves and some physical/rigid boundaries. I'm using a physics engine that can model gravity/collisions pretty well, but it doesn't do anything like fluid dynamics or electromagnetics/electrostatic modeling. I'm able to apply external forces to the particles(angular and linear). So I was thinking I could model charged particle interactions by overlaying a mesh over the volume containing the particles and applying the particle charges as (I think) boundary conditions.

However, I'm not able to find examples of multiple charges. Scikit-fem has an example that models one charge using greens theorem: https://github.com/kinnala/scikit-fem/blob/9.0.1/docs/examples/ex38.py

The problem I'm having with sklearn-fem is the models are too abstracted and the effort to understand the math from reading the code is going to take me a long time.

I'm wanting to adapt this to use fenris (Rust based FEM), multiple point charges and a generalized mesh. Fenris has a poisson example, but it's the standard non-point source textbook example: https://github.com/InteractiveComputerGraphics/fenris/blob/master/examples/poisson2d.rs

GitHub

Simple finite element assemblers. Contribute to kinnala/scikit-fem development by creating an account on GitHub.

GitHub

A library for advanced finite element computations in Rust - InteractiveComputerGraphics/fenris

#

My gut instinct is that the setup for this would be really easy if I knew what the heck I was doing 😄

raw sand
#

That definitely looks useful

#

I think I'm still going to have a difficult time implementing this for my game 😄

#

I took multiple differential equations and linear algebra classes 20 years ago, but everything I'm reading on FEM or now in FMM is making me feel really dumb

fathom rain
#

using fem for a game seems like overkill 🙂

#

i just has to look good, not be accurate

#

or maybe you want it accurate

raw sand
#

It could be. I decided to spend 1 day looking into it, since I thought applying forces to particles might be simpler for coding

#

For example, I'm considering modeling some fluid flow through the volume that interacts with the particles

#

My thought was that if I can get a handle on defining the problem I could just swap out the linear system for different layers of interaction

#

Then, since it's a game, set loose tolerances for convergence and not have too fine of a mesh, etc.

fathom rain
#

no idea how to do that for that setting (I have only developed DG codes for airplane design...no interaction)

raw sand
#

What's DG code?

fathom rain
#

discontinuous galerkin, higher order finite volume

#

so it is fem but with discontinuous elements

raw sand
#

My eyes are clouding over from the greek letters omelette 😵‍💫 I'm seriously doubting I'm gonna be able to figure this out without taking some courses

hoary light
#

And keep in mind the XY problem as you pose your questions.

wooden kiln
#

I'm a little confused about the following problem:

#

I numerically integrated the function from a), but got a convergence rate of roughly order 2.5, which doesn't make sense

vapid plume
#

@wooden kiln Fourth derivative of the function is causing problems

#

Not continuous over [0,1]

wooden kiln
vapid plume
#

First derivative is bounded

#

second derivative isnt though

#

@wooden kiln I'm looking at an example, integral of sqrt(x) over [0,1]. Even the first derivative isn't bounded but simpson's rule is O(h^1.5).

vapid plume
raw sand
#

I thought it'd be cool if, for example with the fluid flow, there is turbulence, etc. Writing code to "pretend" I'm doing fluid dynamics would be more complicated. Or, for example, with electrostatics, coding the effect of a wall as an insulator or a conductor wouldn't be trivial.

So, I thought if I can incorporate FEM modeling, even if inaccurate, I could get a lot by using pre-existing FEM libraries.

hoary light
#

What is interacting with the particles? Usually modeling fluids with particles is the opposite of modeling fluids with finite elements

wooden kiln
#

I’m just going to say this right now, as someone that spends 8 hrs a day on fluid flow simulations, that if you try adding particles to fluids, your game will not run

#

Unless you completely cheat and fake it

silk drum
lavish stratus
#

I'm doing an image compression project using matlab I've done the code how I'm pretty sure he wants it but 10% relative error is looking horrible like here's my plot but here's the image at k=11 and the original

native atlas
#

@neon herald

#

<@&268886789983436800>

raven dew
#

Don't ping moderators for maths help

#

And this is not numerical analysis

native atlas
#

Okay, sorry.

#

Have a good one

brave saddle
#

is the order always contained in the set of all natural numbers?

knotty cloud
# brave saddle

the order α does not need to be contained in the set of natural numbers, as i see, well, i have seen this problem tho, it must here be a non-negative real number

#

hope that helps

primal matrix
#

how can i do this process of checking stability with a system of ODEs?

#

i can translate it if needed

quiet crystal
#

good reccs for books delving into numerical methods/numerical analysis for PDES?

fathom rain
brave crypt
#

When do you ever prefer polynomial interpolation over spline interpolation?

#

And when Lagrange over newton?

#

Why do we learn all if apparently some are worse than others

primal matrix
primal matrix
#

their construction is usually something very simple compared to some other methods, thats why its good to learn them first

brave crypt
#

or does spline have any negative sides too

plucky kayak
#

i think you derive finite difference approximations to derivatives from newton's interpolation?

#

which you can then use to solve (partial) differential equations

#

I think splines have the issue that you need to choose somewhat arbitrarily boundary conditions on the polynomials or their derivatives at the edges of your entire interpolation interval because the linear system ends up underdetermined

#

not sure if it's addressed in the literature

#

oh and also I'm pretty sure you can compute newton's interpolation polynomial in O(N^2) operations if you're clever, but blindly solving the linear system for splines has O(N^3) complexity

brave crypt
#

I see

#

thanks guys

primal matrix
next garden
#

Does anyone knoe of a simple to follow proof, either in writing or video, that explains how and why the fourier basis spans L2 ?

grave spoke
# brave crypt And when Lagrange over newton?

There is also something called barycentric Lagrange interpolation, which is more efficient than Newton interpolation if the distribution of nodes is well-known, e.g. equidistant nodes or Chebyshev nodes.

wild lily
#

Hello, is this the right place to ask about BFGS?

wild lily
# errant wagon yep

Could I ask about the textbook then? Jorge and Nocedal numerical optimization. Or is it too simple for this channel?

wild lily
#

I'm having trouble figuring out why the first tangent is (0,-1)

#

Why the image doesn't seem to match the sequence of vectors

#

Or rather, I can't see the sequence

#

And why the second tangent is (0,\alpha)

#

I'm assuming the second tangent is actually (0,1) and he's replacing the sequence t_k with t_k/\alpha to get that.

#

It is not obvious to me at this point.

errant wagon
wild lily
#

@team132 here it is.

eternal drift
eternal drift
#

So the tangents from below are actually (0, -alpha) for alpha in R+

#

The tangent cone is union of these two sets leading to the (0, d) with d in R

wild lily
eternal drift
#

Look at the definition of the tangent, it's z - x divided by some positive value

#

So suppose z is just below x, for example (-sqrt(2), -eps), then the tangent value is (-sqrt(2), -eps) - (-sqrt(2), 0) = (0, -eps)

wary oriole
#

hey guys

#

i have a question regarding finite difference for laplace

#

for four interior points it's easy to drive the system

#

but for 50*50 points, what's the system looks like? I have trouble to get A and b

#

please help. i got all iterative algos ready to go but i cannot drive the system. The due date is coming :opencry: Please Please

fathom rain
#

the look of it depends on what n1 and n2 are

#

(and you can use kron for b too)

wary oriole
#

what's n1, n2?

wary oriole
#

array([[100., -1., 0., ..., -0., 0., -0.],
[ 0., 50., 50., ..., -0., 0., -0.],
[ 0., 0., 50., ..., -0., 0., -0.],
...,
[ 0., 0., 0., ..., -1., 0., -0.],
[ 0., 0., 0., ..., -1., -1., -0.],
[ 0., 0., 0., ..., -0., 50., -2.]])

#

A = np.kron(toeplitz(N, [2,-1]), np.identity(N)) + np.kron(np.identity(N),toeplitz(N, [2,-1]))
in python

#

this has dimension 50*100

woeful jetty
#

so someone told me to ask this here. is Lax Wendroff supposed to look this weird? the problem is to solve burger's eq with u(x,0)=exp(-16x^2) and periodic boundary conditions

fathom rain
#

I don't use python, the above was just pseudo code. what i wrote is correct except i left a comma in the end, soo here is correct version in julia with n1=n2=3: kron(toeplitz(n1,[2,-1],[2,-1]),I(n2))+kron(I(n1),toeplitz(n2,[2,-1],[2,-1])) 9×9 Matrix{Int64}: 4 -1 0 -1 0 0 0 0 0 -1 4 -1 0 -1 0 0 0 0 0 -1 4 0 0 -1 0 0 0 -1 0 0 4 -1 0 -1 0 0 0 -1 0 -1 4 -1 0 -1 0 0 0 -1 0 -1 4 0 0 -1 0 0 0 -1 0 0 4 -1 0 0 0 0 0 -1 0 -1 4 -1 0 0 0 0 0 -1 0 -1 4

#

(I have my own toeplitz generator)

#

and this would ne for n1=3 n2=4

12×12 Matrix{Int64}:
  4  -1   0   0  -1   0   0   0   0   0   0   0
 -1   4  -1   0   0  -1   0   0   0   0   0   0
  0  -1   4  -1   0   0  -1   0   0   0   0   0
  0   0  -1   4   0   0   0  -1   0   0   0   0
 -1   0   0   0   4  -1   0   0  -1   0   0   0
  0  -1   0   0  -1   4  -1   0   0  -1   0   0
  0   0  -1   0   0  -1   4  -1   0   0  -1   0
  0   0   0  -1   0   0  -1   4   0   0   0  -1
  0   0   0   0  -1   0   0   0   4  -1   0   0
  0   0   0   0   0  -1   0   0  -1   4  -1   0
  0   0   0   0   0   0  -1   0   0  -1   4  -1
  0   0   0   0   0   0   0  -1   0   0  -1   4```
#

i guess you might see the pattern

#

(block sizes are determined by n2 in this setting and n1 determines number of blocks)

fathom rain
# wary oriole A = np.kron(toeplitz(N, [2,-1]), np.identity(N)) + np.kron(np.identity(N),toepli...

this is using scipy toeplitz with N=3 >>> np.kron(sp.linalg.toeplitz([2,-1,0],[2,-1,0]), np.identity(N)) + np.kron(np.identity(N),sp.linalg.toeplitz([2,-1,0],[2,-1,0])) array([[ 4., -1., 0., -1., -0., 0., 0., 0., 0.], [-1., 4., -1., -0., -1., -0., 0., 0., 0.], [ 0., -1., 4., 0., -0., -1., 0., 0., 0.], [-1., -0., 0., 4., -1., 0., -1., -0., 0.], [-0., -1., -0., -1., 4., -1., -0., -1., -0.], [ 0., -0., -1., 0., -1., 4., 0., -0., -1.], [ 0., 0., 0., -1., -0., 0., 4., -1., 0.], [ 0., 0., 0., -0., -1., -0., -1., 4., -1.], [ 0., 0., 0., 0., -0., -1., 0., -1., 4.]])

wary oriole
#

this doesn't look like matrix in the book tho. should it be producing
array([[ 4., -1., -1., 0.],
[-1., 4., 0., -1.],
[-1., 0., 4., -1.],
[ 0., -1., -1., 4.]
])

#

like the book

#

also N=50 you way will product 150150. not 5050

wary oriole
#

the dimension doesn't match. so N=50 in my problem means each axes has 50 point including boundary

#

so i guess 48*48 equations?

#

"Next the spatial and temporal domain are discretized. The x- and y-axes are divided
in intervals with length δx. Assuming that we have N interval in the x- and y-
directions, we have δx = 1/N , and x = iδx, y = jδx where i, j ∈ (0, 1, 2, . . .N ).
Furthermore we assume a small time interval δt, so that t = kδt where k ∈ N"

fathom rain
#

that is for N=2

#

you have to manually modify the arguments of toeplitz function to match your N add as many 0s as you need

#

there is probably some convenience function in numpy to do that

#

if you want a 48x48 system you can do n1=8 and n2=6 for example

fathom rain
#

You can for example do

n1=2
n2=2
v1=np.zeros(n1)
v2=np.zeros(n2)
v1[0:2]=[2,-1]
v2[0:2]=[2,-1]
np.kron(sp.linalg.toeplitz(v1,v1), np.identity(n2)) + np.kron(np.identity(n1),sp.linalg.toeplitz(v2,v2))```
wary oriole
#

👍

fathom rain
wary oriole
fathom rain
#

should say n1=3 and n2=4 on top right 😛

fathom rain
sudden adder
#

anyone using wavelets methods to solve ODEs, PDEs, Integral equations, Integro-Differential Equations numerically. I would really like to talk. Please response.

wary oriole
ruby pike
#

Numerical LA question: Is there an algorithm that takes an upper triangular matrix over the complex numbers as input, and spits out a bidiagonal matrix which it's similar to?
Don't misunderstand my question: The usual "bidiagonalisation" algorithms (which occur in the context of computing SVD for instance) don't output a similar matrix. They only preserve the singular values, which is not what I want.

fathom rain
#

and if you want the specific tranformation you can compute it using the eigenvector matrices for the matrix you desire

#

is there a reason to have it bidiagonal?

rich flax
#

Given SVD of A
Find SVD of matrix
( I A)
(A^T 0)
where 0 and I are all zero and identity matrix

Can anyone give me hint on how to find singular values of above matrix?

ruby pike
#

Permute the rows and columns so that you have a direct sum of 2x2 matrices of the form:

⎡1   sᵢ⎤
⎢      ⎥
⎣sᵢ  0 ⎦

The singular value set that is sought is precisely the union (with possible repetition) of the singular values of the above 2x2 matrices.

#

The singular values of those 2x2 matrices happen to be:

⎡      __________________________        __________________________⎤
⎢     ╱          ___________            ╱          ___________     ⎥
⎢    ╱          ╱     2                ╱          ╱     2          ⎥
⎢   ╱     2   ╲╱  4⋅sᵢ  + 1    1      ╱     2   ╲╱  4⋅sᵢ  + 1    1 ⎥
⎢  ╱    sᵢ  + ────────────── + ─ ,   ╱    sᵢ  - ────────────── + ─ ⎥
⎣╲╱                 2          2   ╲╱                 2          2 ⎦

#

I think that's the answer to your question/

#

That's more complicated than you'd think given the form of the matrix.

fathom rain
#

more readable form (4*s^2 + 1)^(1/2)/2 \pm 1/2

#
6-element Vector{Float64}:
 2.3355261064228325
 1.3355261064228316
 1.1429783479872964
 1.0825415690164035
 0.14297834798729703
 0.08254156901640394

julia> sqrt.(4*svd(A).S.^2 .+1)/2 .-1/2
3-element Vector{Float64}:
 1.335526106422832
 0.14297834798729703
 0.08254156901640397

julia> sqrt.(4*svd(A).S.^2 .+1)/2 .+1/2
3-element Vector{Float64}:
 2.335526106422832
 1.142978347987297
 1.082541569016404```
ruby pike
# rich flax Given SVD of A Find SVD of matrix ( I A) (A^T 0) where 0 and I are all zero and ...

An even slicker solution. The reduction to the matrix:

⎡I  S⎤
⎢    ⎥
⎣S  0⎦

uses only orthogonal similarities, so preserves both eigenvalues and singular values simultaneously.
It's also worth noting that that matrix is equal to $I \otimes diag(1,0) + S \otimes \begin{pmatrix} 0 & 1 \ 1 & 0\end{pmatrix}.$
The tensor product operation is commutative up to matrix similarity. Thus my reduction to a direct sum of 2x2 matrices follows. Take their eigenvalues, and (as @fathom rain pointed out) the absolute values of these are the singular values.

#

The "tensor product" here is really the Kronecker product: https://en.wikipedia.org/wiki/Kronecker_product

In mathematics, the Kronecker product, sometimes denoted by ⊗, is an operation on two matrices of arbitrary size resulting in a block matrix. It is a specialization of the tensor product (which is denoted by the same symbol) from vectors to matrices and gives the matrix of the tensor product linear map with respect to a standard choice of basis....

hoary light
ruby pike
#

I don't care about "almost" getting the Jordan form. Give me the Jordan form if you think it's possible.

ruby pike
#

I'm aware of links to the Jordan Normal Form. That's why I think it's an interesting question.

#

I don't see how to find the JNF of a bidiagonal matrix in a computable/well-conditioned manner.

ruby pike
#

I think that the set-valued function
Upper triangular -> Bidiagonal matrix
is lower hemicontinuous. This is not true for the Jordan Form. If that's true, they are not at all equivalent problems.

#

Not upper hemicontinuous though.

lilac crane
#

since in that case a bidiagonal is similar either to the jordan block (a 1; 0 a) or to a diagonal

#

anyway

pine jettyBOT
#

memorylessfunctor

lilac crane
#

the jordan condition number is max(delta, 1/delta)

#

well ok like this is already bidiagonal

#

but i think you can modify this

pine jettyBOT
#

memorylessfunctor

lilac crane
#

@ruby pike

lilac crane
#

if im not mistaken

#

intuitively it should

ruby pike
#

No it doesn't. Like any non-scalar matrix, it has infinitely many bidiagonal forms

ruby pike
#

I think this is wrong

#

What's a "bidiagonalisation condition number"?

hoary light
still forum
#

Suppose I'm solving a Laplace/poisson equation on a square domain. When considering Neumann boundary conditions (like on the left edge of a square, $\frac{\partial u}{\partial x} = 0$), should I use $O(h^2)$ order accurate approximation on the boundary if everywhere on the interior I have $O(h^2)$ order accurate approximation of $u_{xx} + u_{yy}$?

pine jettyBOT
#

jamiecjx

still forum
#

or is it ok to use first order forward difference

#

how does it affect the overall accuracy of the solution?

pine jettyBOT
#

nicholas zero nine eight

#

nicholas zero nine eight

still forum
#

makes sense

#

thanks a lot

lilac crane
#

i guess you are worried this wouldnt be well defined?

next garden
#

Why does this imply non continuity?

plucky kayak
#

the vector approaches zero, but it's image under L approaches some non-zero vector with norm 1

wary oriole
#

guys

#

for iterative methods of anything really. For example jacobi method for solving linear system

#

how do you log your iterations? in python i print them like this
print('iteration: ' + str(k) + '\t' + 'error norm: ' + str(error))

#

is there a better way? i mean not just log in a file, but use logging in python?

#

in a production environment

fathom rain
fathom rain
wary oriole
#

three sinks solution, the matrix is annoying to drive. i put specific zeroes in regular matrix you gave me

next garden
#

I am not following

lilac crane
#

but L(vn) does not converge to 0

next garden
#

Ahhhh that makes sense

#

Ty

wooden kiln
#

In my graduate CFD course, we are talking about Von Neumman Stability Analysis. From my professor's notes, he has the following:

#

My question is, where did the i (index, not imaginary unit) terms go on the left hand side, and where did the k (wavenumbers) terms go on the right hand side?

fathom rain
pine jettyBOT
#

sverek

fathom rain
#

your k=i

#

quite sloppy notation overall 😛

#

so just replace i with k in the Stability of:... equation (and add subscript k on the time derivative part )

inland owl
#

Hi I study English language at uni but I’m doing truth tables and really struggling can someone PLEASE help me with them ?

still forum
#

I've been using SOR on a large linear system (from an elliptic pde) and I'm interested in finding the optimal parameter. However afaik the matrix, while sparse, doesn't have nice structure (not symmetric, tridiagonal, block tridiagonal) as the domain I took it from is a weird polygon shape and has a mixture of boundary conditions. How does one then minimise the spectral radius of the iteration matrix?

#

I believe the matrix is positive definite (it's pretty diagonally dominant) so my thought was to do a bunch of power iterations or something

#

but theres presumably too many clustered eigenvalues for that to work well

hoary light
#

If you have an idea of the (numerical) multiplicity of the max absolute value eigenvalues, you can try using a block power method

#

There are many randomized methods, often variations on "multiply the matrix with a random set of vectors to learn properties of the matrix" that can work

#

Do you need to use SOR? It is not normally used for very large systems

still forum
#

it was about$ 10^4$ unknowns from like a 100x100 grid roughly, and it was a coursework exercise so yeah I had to lol

I did some asymptotics and assumed the spectral radius of the matrix was $\rho \approx 1 - \frac{\pi^2}{N^2}$ and got something that sped up convergence by a rough factor of $N$ which was good enough for me

pine jettyBOT
#

jamiecjx

still forum
#

back to this problem

I want to see how big I need to make my grid until the solution I obtain is grid independent (up to some tolerance), and I don't have access to the analytic solution.

My thought was to take a sequence of increasing grids which have some shared coarse grid $C$ and interpolate the values onto $C$, whilst measuring the difference between successive grid sizes (in L2 norm). But I'm having trouble finding a sort of standard test for this (Leveque doesn't seem to have anything on this)

pine jettyBOT
#

jamiecjx

pure lake
#

hello

#

i need some views on this series

#

[1, 3, 7, 11, 15, 23, 27, 31, 39, 47, 59, 63, 71, 79, 91, 95, 103, 111, 123, 127, 155, 159, 167, 175, 191, 199, 207, 219, 223, 231, 239, 251, 255, 283, 287, 303, 319, 327, 347, 359, 367, 383, 411, 415, 423, 447, 463, 479, 487, 495, 507, 511, 539, 543, 559, 575, 583, 603, 615, 623, 639, 667, 671, 679, 703, 719, 735, 743, 751, 763, 767, 795, 799, 815, 831, 839, 859, 871, 879, 895, 923, 927, 935, 959, 975, 991, 999, 1007, 1019, 1023, 1051, 1055, 1071, 1087, 1095, 1115, 1127, 1135, 1151, 1179, 1183, 1191, 1215, 1231, 1247, 1255, 1263, 1275, 1279, 1307, 1327, 1343, 1351, 1383, 1407, 1435, 1439, 1471, 1487, 1503, 1511, 1519, 1535, 1563, 1567, 1583, 1627, 1639, 1647, 1663, 1691, 1695, 1703, 1727, 1743, 1767, 1775, 1787, 1791, 1819, 1823, 1855, 1863, 1883, 1895, 1903, 1919, 1951, 1959, 1983, 2015, 2031, 2043, 2047]

#

i dont want to induce any confirmation bias

#

i need blind views

fathom rain
pine jettyBOT
#

sverek

slate sinew
#

does anyone have notes or resources that can help me understand the finite precision system? i'm kind of getting lost as to when i need truncate/round when solving lineal systems with the Gauss elimination method.

#

Example of an exercise:

Consider the finite precision system F (10, 4, −∞, ∞).

Solve the linear system by the Gaussian elimination method using rounding as the method
approximation in the finite precision system.

minor tree
#

Hi Hi
does anybody of yall know about good sources for the Fourier spectral method.
Most of the ones i find only consider certain PDEs as examples. For context i am trying to implement that method in Python for general PDEs with periodic BC and am unsure as to what is a good approach for implementation.

minor tree
#

thank you that looks promising :)

heady mesa
#

Spectral Methods by Boyd is the Bible of Spectral Methods

wild lily
#

Does anyone know how I should interpret Jorge and Nocedal's algorithm 16.5? I've been trying to implement this but I can't seem to understand it. I'm completely unsure as to what I'm getting wrong

wild lily
#

I'm trying to use algo 16.5 for section 18.6, for algo 17.4.

#

i wanted to do with just the cauchy point first. it's much slower, but i want to get the inner loop right first before i try something else

#

but it seems like the penalty instantly forces my iterate to 0

dull wraith
#

Hey i am new to numerical analysis.can anyone suggest from which book should i start

silk drum
#

Numerical analysis is a pretty wide field and you'll want a text which covers the particular subject matter of interest to avoid wasting motivation on interesting but less useful areas. In particular, you may have applications in mind and want a text targeted towards getting you up and running as soon as possible. Other people will want a theoretical and foundational text if applications are not immediately relevant.

silk drum
#

Although the main aim is to address floating precision, from memory, it helped me to grasp fixed precision by way of comparison and analogy. Off the top of my head, it would be truncate/round after each discrete/atomic instruction or operation, so usually a floating point operation such as +, -, ×, ÷. Actual computers have FMA and GPU DMMA so multiple operands and less rounding. An important detail is that libraries can carry out algorithms to minimise loss of precision and accuracy, a simple example is to accumulate from lowest magnitude first to avoid overflow or high magnitude values impacting the contributions from low magnitude values.

untold crag
#

Hi guys!

#

Let’s assume that I have a given time series with equally spaced observations. I want to fit an Ornstein Uhlenbeck process on it (i.e. estimate the three parameters). How to proceed? I know Maximum Likelihood Estimation is a good option but if any of you has some ressources for me to learn about how this procedure works, I’d be more than happy. My second question is, let’s assume now that we have a more “ugly” time series, non equally spaced observations, how does it change the procedure?
In the end, I would implement everything using Python which seems ok for this.
Let me know guys!
Thank you

pulsar cipher
#

Hi, I'm reading into numerics and I dont understand this part:

pine jettyBOT
#

Sciencenjoyer

pulsar cipher
#

First I'm not sure which $x_ {n+1}$ is used in the lower condition and why did they define $\tilde{f}(x,x_{n+1}) := x_{n+1}$ ?

pine jettyBOT
#

Sciencenjoyer

pulsar cipher
plucky kayak
#

"lower condition"?

pulsar cipher
#

what comes after "subject to"

plucky kayak
#

there's only one x_{n+1}

#

you had a problem in n variables and you added another one

pulsar cipher
plucky kayak
#

the defined a function of variables x and x_{n+1} which is equal to x_{n+1}

#

this isn't the definition of x_{n+1}

#

x_{n+1} is just a new arbitrary scalar variable

pulsar cipher
#

oh ok, I get that now, thanks

#

But I don't see why both problems are equivalent

plucky kayak
#

well suppose you want to minimize $f(x)$ with respect to $x$ and $x^\star \in \mathbb{R}^n$ is the minimizer and also consider another problem $t \to \underset{x\in \mathbb{R}^n, t \in \mathbb{R}}{\min}$ subject to $f(x) \leq t$ and $t^\star$ is the optimal value of that problem, then I claim that the pair $(x,t) = (x^\star,f(x^\star))$ is a solution of the second problem

pine jettyBOT
#

Transparent Elemental

plucky kayak
#

if that wasn't the case, then I could decrease value of t, but that's not possible because we assumed that f(x^star) is the minimum possible value

#

on the other hand if you consider second problem and it's solution (x^star, t^star), then x^star is a solution of the problem of minimizing f(x) because we found such (x,t) that ensure that f(x) is as small as possible from the constraint that we had

pulsar cipher
#

Sorry but what is "the minimizer"?

plucky kayak
#

the point at which the function achieves it's lowest value

pulsar cipher
#

ohhh. This should have been super obvious

#

At least I can see that now. Thank you very much

brave crypt
#

I need some help regarding (PINN-Physics Informed Neural Network) to make an AI that solves a non linear differential equation. Someone with enough knowledge about this please DM.

atomic meadow
#

how can i help?

brave crypt
#

do u know what PINN is

#

have u studied enough ML and its application in Physics

#

@atomic meadow

atomic meadow
#

take help of chatgpt

brave crypt
#

thanks for nothing,. Chat gpt is lame, good for kids only

atomic meadow
brave crypt
atomic meadow
brave crypt
#

it's a college porject

#

not commercial or anything

#

also, I will make it for myself ofc

#

maybe use it as a general tool

atomic meadow
#

which programming language your using?

#

ig, Python

#

@brave crypt

brave crypt
#

yes

#

python

pale gazelle
#

The probability density function of the chi-square distribution involves the gamma function (Γ). From what I've researched so far, it seems that in order to understand what the gamma function is and how it works, I need to have a thorough understanding of how complex numbers work (which unfortunately, I don't). Unlike functions defined for real numbers where you simply input a value x and get a corresponding output that depends on the function definition, it's rather unclear what actually happens when you input an x to the gamma function. I have a good understanding of derivatives, partial derivatives, integration, and some intermediate-level calculus topics. If someone were to ask me, "What does the function f(x) = 2x do?", I would answer, "It takes in a real number x and returns a value that's twice the value of x". Similarly, could anyone explain what the gamma function does? For context, I only want to understand the gamma function to get an intuitive understanding of the PDF of the chi-square distribution.

plucky kayak
#

in order to understand what the gamma function is and how it works, I need to have a thorough understanding of how complex numbers work
no you don't

pale gazelle
plucky kayak
#

this is what the gamma function does to a number z, whether it's real or complex

plucky kayak
#

well it's the same purpose as with any other function

pale gazelle
#

Also, what are t and z?

plucky kayak
#

this integral comes up a lot so they gave it a name

plucky kayak
pale gazelle
plucky kayak
#

this is just what the PDF works out to be, if you want a proof for why the PDF is this and not something else then you can search for the proof

#

there isn't always a specific purpose like you might think

#

it's not like somebody thought about it for a long time and suddenly he "understood" that there must be a gamma function involved, no

#

chi squared is not unique in using gamma function either

pale gazelle
hollow perch
#

Does anyone have an intuitive understanding why many problems on 2d arrays can be solved in polynomial time, but generalizing to nd arrays is np conplete? E.g. the linear sum assignment problem, or decomposition into a sum of rank 1 matrices/tensors

hoary light
# hollow perch Does anyone have an intuitive understanding why many problems on 2d arrays can b...

To my understanding the main issue is that several concepts concerning matrices do not have a nice generalization for multilinear maps. In particular, in your aforementioned example of decomposition into lower-order tensors, since a matrix can be viewed as both a representation of a bilinear form and a linear map on a vector space, all the notions of rank coincide, namely with the SVD. In higher dimensions, more than one concept of rank exists and these extra degrees of freedom makes computing any such notion of rank very difficult.

#

Perhaps one fuzzy intuition to use is that in the case of a matrix (bilinear form), computing something like rank amounts to some kind of linear or quadratic problem, which is convex. However, at higher orders, problems such as approximating one tensor by another is no longer convex because it's like a higher order polynomial.

hollow perch
hoary light
#

The rank function is not convex, but instead think of the problem of approximating a matrix by a sum of rank 1 operators

#

In particular, think of how maximizing and minimizing the Rayleigh quotient gives you certain eigenvalues (which are of course nearly like the singular values in the hermitian case)

#

This doesn't really explain why the multilinear case is hard, but it does explain why the matrix case is easy

hollow perch
hoary light
#

The SVD map is not really the correct way to think of it, but rather the problem of minimizing |A - A_k | where A is the matrix in question and A_k is a rank-k matrix.

#

When treated as a rank-revealing problem then each step is quadratic via the Rayleigh quotient.

#

In contrast, for higher order tensors, we don't quite have the same formulation. Tensor rank doesn't quite line with the generalization of SVD that we might want. At least that is my impression.

plucky kayak
#

Hillar, Lim, "Most Tensor Problems are NP-Hard" from 2013 might be of interest

#

the more I learn about tensors the more I'm disappointedsadcat

hoary light
#

from seminars I've been to, they still play a useful role in applications. It's just that generically you can't solve a lot of tensor-related problems easily. But for tensors that arise in applications there may still be additional structure, empirically

knotty shadow
# brave crypt thanks for nothing,. Chat gpt is lame, good for kids only

Ja, check, I'm $\textit{not}$ trying to make shit here, but you were not the greatest person in that. You can give me trouble, I don't care, but I don't think that you were a nice person there. Anyway, what you're asking belongs almost entirely (I always take liberties with my ability to claim almost-$something$), within computer science. I'm aware of the connections between neural networks, genetic algorithms, etc. and numerical analysis, but I don't think that you're question belongs in numerical analysis.

Look, I'm not trying to be an arsehole to you. I just had some words to type and now that they're typed we move on with life, in my opinion.

I cannot guarantee that anything will come of this, but I'll ask some colleagues on Monday about PINN. Otherwise, there are good libraries for Python which can deal with DEs and, at the worst, you can use numerical techniques (there are good libraries for that, too).

pine jettyBOT
#

Saurus

knotty shadow
# pale gazelle The probability density function of the chi-square distribution involves the gam...

The Gamma Function is the function which results as the analytic continuation of the factorial. For natural numbers (I don't include 0, so $\mathbb{N} = \left{ 1, 2, 3, ... \right}$), the Gamma Function (here, denoted $\Gamma \left( \cdot \right)$), satisfies $\Gamma \left( n \right) = \left( n - 1 \right) !$. This clearly gives that the Gamma Function applied to a natural number is, approximately, the factorial of the number (there's that $-1$ which appears, but it's close enough). This then allows for a meaningful definition (and understanding), of the factorial of a real number and, by the analytic continuation, a "factorial" of (almost) any complex number.

Are you good to go with that explanation?

pine jettyBOT
#

Saurus

knotty shadow
# hoary light To my understanding the main issue is that several concepts concerning matrices ...

The story with tensors is, currently (by currently, I mean for the last two years), the bane of my existence. There are many definitions of the tensor product. Some are constructive (as in, it gives a way to do a tensor product), but many are simply existence results. Now, the tensor product of two vector spaces over the same field exists and it is unique (this is from the universal property, but there is nothing which shows how to construct the tensor product). The tensor product which features in, let me claim it to be, useful places, is, in fact, the Kronecker product.

Importantly, matrices describe linear operators of one finite dimensional vector space into another finite dimensional vector space (same fields). In fact, each linear operator (between finite dimensional vector spaces over the same field), has a matrix representation and the converse is true. This, very importantly, shows no relation between matrices and multi-linear maps (multi-linear of order strictly more than one), unless you do those funny things that the physicists do (for example, the vec function - then matrices have meaning as multi-linear maps).

The best seen use of tensors is in general relativity (actually, the way things are done there is the use of the Kronecker product, but the Kronecker product is a fantastic representation of the tensor product for finite dimensional spaces), but this, the way that it is treated (and, hence, the fantastic use of the Kronecker product), boils down to a bunch of index notation and multiplication of members of specific multi-dimensional arrays.

#

I'm pretty drunk and I forgot what the purpose was of why I started typing a response, so I'll just stop here before I move to the abstract (algebraic) tensor product and then the Fremlin tensor product (that guy is what I used in a paper a year or two ago). There's also the story about the tensor product being used in pseudo-Riemannian geometry not actually being a tensor product (welome the Kronecker product), because the product used isn't a true tensor product (it isn't complete, etc.).

stoic sun
#

This question has to do with pade approximations, and using them in software. I'm am unsure if its better to ask my question in here, #geometry-and-trigonometry or elsewhere, so if there is a better channel for this question, please let me know.

Before asking, let me just say: Im really only going to be using the Pade approximations for approximating the function arctan. I might talk about the process for making a pade approximation from a general taylor series, but in practice I only really need to apply it to the taylor series for arctan. I mention this because maybe this simplifies things, or is possible where the general case is not.

#

In essence, my question is this:

Can the conversion of a taylor series to a pade approximation be made iterative. By iterative, I mean taking it one term at a time.
Looking at a few videos that shows the process, it would appear that: No, you'll have to know how many terms you are going to use up front before beginning to work out the pade equation.

#

Some background: I have written and maintain an arbitrary precision, base-10 floating point number type library in C#. A while back, I added trigonometric functions to the library, which sets it apart from other arbitrary floating point libraries in the same language. I implemented this by using the taylor series. It takes as a parameter, the desired level of precision specified as the n in the expression 10^-n, so basically n is the number of zeros past the decimal point you want the result to be good to. It takes the Taylor series term by term, calculates the numeric result, subtracts that result from the numeric result from the prior iteration, and if the difference is less than 10^-n, it returns the result.
This is an iterative process, each iteration further refines the running total, and calculating the next term in the series does not require recalculating the terms up to that point.
I implement many trig functions through this function. Yes, i take care to restrict the inputs, wrapping the inputs at pi or pi/2 or whatever the range of the function in question happens to be.

Well as some of you already know, for certain trig functions at certain inputs, the taylor series is VERY slow to converge. In particular, I am getting very long evaluation times for arctan (and arcsin and arccos, which use arctan under the hood). As you know, the domain of arctan is All real numbers.

#

What id like to do it replace using the taylor series for arctan with something else with better convergence, and is more consistant with how long it will take to converge for any input.
Looking into this problem, I find suggestions of the following possible solutions:

  • chebyshev polynomials
  • pade approximations
  • continued fractions
#

chebyshev polynomials use integrals, and i looked into them a little bit, but the algorithm wasn't immediately understood by me, but i didnt put a lot of effort into understanding them. if you feel like chebyshev polynomials are absolutely what I need, then Im sure i can figure it out, i just need to apply more effort. considering what i found when i looked into pade approximations, maybe this warrants another look.

#

...

Looking into pade approximations, first of all, the only reason I am able to consider doing this algorighm is due to the fact that I have written a symbolic multivariate polynomial library which can be leveraged to do the multplying of the arbitrary polynomials with different coefficients. BUT, it appears i will not be able to work out each A/B term from the associated taylor polynomial term, without first deciding how many terms I am going to need. In particular, one of the steps involve taking the A/B = (taylor series) equations, setting B₀ = 1, multiplying each side by the denominator and arriving at an equation like:
A₀ + A₁x + A₂x² + ... = (1 + B₁X + B₂X² + ...)(taylor series terms)
and from this figuring out what all the A and B coefficients are.
Formulated this way, although I could take the taylor series one by one, id still need to know how many B terms to multiply it by. Perhaps this is not strictly true, but at each iteration i would be essentially adding another A term, B term and taylor term and then perform all the 'missing' calculations that are entailed by the presence of the new terms. I guess this is possible, since, for the right hand side, we are essentially taking a cartesian product of the B terms and taylor terms and adding their products, because that is the case, adding another B term and T(aylor) term doesnt change any of the products we already calculated, we just need to add some more: the new B term times all of the prior T terms, all of the prior B terms times the new T terms and then the new T term times the new B term. So I guess this is possible. I dont know how it will affect the linear algebra problems that follow, but i do not foresee any fundamental problems. Is this right? Is there any barriers to this that im not seeing?

#

The continued fraction approach. I've written a library that does continued fractions, so this is no challenge. I think this would be my preferred approach if I could wing it. It certainly seems the most straightforward.
...
Actually, I think my main issue here was I was searching for the continued fraction of arcsin or arccos, which I couldnt find.
But thats stupid. Since both arcsin and arccos use arctan under the hood, a continued fraction for arctan would serve me just fine, and I think that was the only example I could find when searching for arcsin and arccos. But duh, I should just use that, the arctan one.

#

Yeah, this might just work for me instead.

Rubber duck moment.

cosmic karma
#

Hello folks! I’m trying to formulate a discontinuous Galerkin FEM for a linear coupled system with one dependent variable having a non-homogeneous Dirichlet BC. I read that the treatment of this boundary comes as a numerical flux. Is that correct and if so, how do I do it? Do I introduce a new parameter, like the flux would be an artificial viscosity or something to the system? Thank you!
What about the variable with a homogeneous dirichlet BC? Does this one need a numerical flux?

fathom rain
cosmic karma
pale gazelle
#

@knotty shadow

dark pumice
#

Hi

upbeat eagle
#

help

pine jettyBOT
#

jacobjivanov
Compile Error! Click the errors reaction for more information.
(You may edit your message to recompile.)

still forum
#

Suppose I'm solving a wave equation (with constant c^2 = 1 for simplicity) but the initial condition u(x,0) = 4x^2 (-0.5<x<0.5), and u(x,0) = 0 everywhere else. (ut(x,0) = 0 as well).

I used 2nd order finite differences everywhere (leapfrog) but oscillations get introduced which is bad. If my initial condition is continuous, the code I wrote works fine. How does one deal with discontinuous wave conditions in finite difference methods?

#

Or even, if my initial condition is u(x,0) = 1 for (-0.5<x<0.5), i still get random oscillations

#

despite the wave moving roughly in the right direction

#

cranking up the resolution of the grid seems to make the oscillations smaller, but is not ideal because I need quite a fine grid

#

Ok, I thought a bit about the physics

the grid ratio really matters. Since the wave speed is 1, we kinda need the ratio of h and k to be 1

#

otherwise, the solution doesn't match the grid

#

so I think I'm good for now

hoary light
still forum
#

I was already considering the cfl condition before, I was using something like k/h = 0.25 in the above gif

#

so i don't think the oscillations are because of that, though if I set k/h > 1 i get blowup

still forum
#

I guess that matches what's going on pretty well

#

because im trying to approximate a discontinuous initial condition with something continuous?

#

I'm wondering if theres any trick to reduce/avoid the oscillations near the discontinuities without going out of finite differences

fathom rain
#

artificial viscocity, shock detection, hp-methods

#

refine the grid close to discontnuity for example

still forum
#

im interested in refining the grid, but the discontinuity is travelling around, so does this require refining the grid in different regions as time evolves?

fathom rain
#

but that can be automated

still forum
#

Do you have a good place to read about adaptive mesh refinement?

fathom rain
#

(just the one i know on the top of my mind since i know all the authors 😛 i can probably find others if you want)

still forum
#

What is a generally good way to plot solutions of a wave equation that are static (so no gifs) in the 1D case?

hard escarp
#

Hi. I'm a phd student in numerical analysis, just getting into the field. Are there good resources on current open problems and research directions within numerical analysis? Specifically numerical analysis for PDE's.

fathom rain
cosmic karma
hoary light
# hard escarp Hi. I'm a phd student in numerical analysis, just getting into the field. Are th...

This is a broad question. What aspects of numerical analysis for PDEs are you interested in? For example there are things like accelerating solvers via GPU or parallel computing, focusing on structured linear algebra, linear or nonlinear optimization for implicit solvers, determining good meshing schemes, machine-learning and other data-driven methods for accelerating solutions, regularization of ill-posed problems, developing numerical methods for new kinds of PDE (this is more about modeling than numerical analysis typically), and so much more

heady mesa
#

If you're looking at the algorithms then Spectral Methods is a nice area with lots of new research coming out all of the time.

shadow spoke
#

anyone has this book in pdf form? im looking for 1st edition but all i find is 3rd edition and i dun need that .-.

shadow spoke
#

i want free pdf TwT

raven dew
#

This server isn't an appropriate place to share pirated material or anything

shadow spoke
#

ok

hardy oar
#

hello anyone has pdf for this book: Epperson: “An introduction to numerical methods and analysis”. Wiley. Third edition, 2021

digital cape
hardy oar
#

more like ultimate beta

brave crypt
fathom rain
brave crypt
#

Well if i say more i prob gonna doxx myself XD

#

But i know Nordström too

fathom rain
#

i sit a few offices from Ken Matsson

#

😄

brave crypt
#

I visited uppsala at some point so we prob alr met during fika

#

😉

fathom rain
#

i am the wheelchair guy 🙂

brave crypt
#

Will say hi if i have the chance to visit uppsala again

still forum
#

when solving wave equations numerically, I find often that behind/in front of the actual waves, theres some small oscillations. What I want to know is if this is a physical thing that happens or a numerical artifact

and if it's a numerical thing, what are the most common ways to reduce the spurious waves?

brave crypt
still forum
#

2d spatial wave equation, which was transformed to polar coordinates

brave crypt
#

Then its a numerical artifact

still forum
#

I suspected that was the case

#

I had some waves that were travelling faster than the allowed speed

brave crypt
#

What is the numerical scheme you used

still forum
#

2nd order central differences for everything

brave crypt
#

I see

#

Try using upwind schemes

hard escarp
#

@fathom rain @cosmic karma @hoary light Thank you for your responses. Sorry for the delay. I was looking for some less specific strategies for finding those things, actually. For example, one thing I do is I follow arxiv rss feeds. Another thing is I get emails about news SIAM papers.

#

But, @hoary light according to your list, I'd be more interesting in the last item -> proposing numerical methods for new kinds of PDEs (and studying convergence, stability, etc... )

hoary light
# hard escarp But, <@224645070907899925> according to your list, I'd be more interesting in th...

I think for looking at new PDEs one is generally approaching the problem as less mathematical and more about engineering and science. In particular, first one needs to ask questions like 'why is this PDE important?' and 'what kind of dynamics are we trying to model?' Once you know what PDE you want to solve then you can think about how to solve it numerically. Otherwise you might get into the situation where you spend a lot of time developing analysis for some PDE that is ultimately not of interest to anybody.

hard escarp
#

So maybe pay attention to engineering journals, maybe? See what kind of equations they're dealing with...

fathom rain
hard escarp
#

Right. And that is happening. I just wanted to see alternatives that could be interesting.

fathom rain
#

then probably pick somehing adjacent to that project

hard escarp
#

That is actually a good point.

fathom rain
#

your thesis needs to convey a story and should not be about very differemnt things

hard escarp
#

I actually hadn't thought of that.

#

And it seems obvious once said explicitly hahaha

#

Thank you.

#

Thank you very much. I think I'll start doing study sessions focused on that, actually. It's a really good point.

#

I don't think I'd be able to think that unless someone told me, to be honest

cosmic karma
brave crypt
#

There are various approaches to develop good numerics for PDEs, and I am on the side that believes good numerics require a solid understanding of the theory, in particular well-posedness and energy estimates.

gaunt crag
brave crypt
# gaunt crag or pdf:

It seems that the numerical part is only solving the ODEs obtained from the linear analysis

#

So maybe what you need to find out more is linear stability analysis for PDEs

gaunt crag
ruby pike
#

What's the easiest way to prove that every complex-symmetric is similar to a complex-symmetric tridiagonal matrix?
(Note: NOT Hermitian matrix!!!)

hoary light
#

What's the not-easy proof?

gaunt crag
#

is there a python or matlab alternative of mathematicas ndsolve

gaunt crag
#

i see

#

im supposed to write code to get Table 1 on the right but dont know where to start

#

is the first step to get R? I dont get how they did this

cosmic karma
#

have you looked at what solve_ivp can do to help you?

brave crypt
#

What are the applications of numerical analysis to pure math?

tiny lake
#

Do people do numerical analysis with finite fields (among others, the field F_2^n) or R-modules? Or is it pretty much always R^n or C^n?

cosmic karma
#

Maybe computational group theory? I have a friend who does algebraic coding theory which he uses Magma to either confirm results or even generate them. Basically solving algebraic problems using a computer.

tiny lake
hollow perch
brave crypt
#

But since mostly ppl design and analyze numerical schemes for applied problems, it is perceived as applied maths

uncut shuttle
#

Holomorphic (complex-valued) dynamics, including the Julia and Fatou sets can also be seen as a subset of numerical analysis

#

So that's where pure maths comes in

full eagle
#

anyone familiar with the Fixed-point iteration method?

heady mesa
#

Yes

full eagle
#

can you explain to me what are the conditions to choose the right g(x)=x?

heady mesa
#

You need a contraction mapping.

warped fiber
#

Could I have help with this please?

brave crypt
#

Hi, its been a while sense i did much linear algebra outside of this class and im having trouble proving or disproving if this second matrix converges or not for Jacobi / gaus seidel methods.
im beginning with jacobi and tried looking at the spectral radius but unsure how to actually compute it

#

can i get some advice on relevant theorems or ways i should approach this question?

mighty lotus
#

numeric,. idioms.. not cority

brave crypt
#

thanks I think I got it now

wary oriole
#

guys. i have an exam coming up but instructor does not give solution to the practice problem. Here is the problem

Consider the two-dimensional Laplace equation where u is a function u(x,y)
a) Explain how the Jacobi update procedure can be derived from this equation (explain
how the equation is discretized, how are the derivatives discretized?
b) How can you improve convergence of this scheme (describe update scheme, stencil,
memory requirements) ?

#

i know part (a) is

#

but how can you answer part (b)? I would like a precise answer to get full points if it appear on the actually exam

#

oh i think i get it. "improve convergence of this scheme" is wrong wording i think/ just stencil and how to storage solution u

vapid plume
#

@wary oriole Do you know about the gauss seidel method?

still forum
#

since they asked about memory requirements, think about which one is better of gauss seidel and jacobi

brave crypt
#

any textbook recommendations on the topic For beginners ? c_DUNDUNDUNNN

vapid plume
#

Numerical methods and analysis? James F. Epperson

gaunt crag
#

I don't know how to solve for eta when I dont know RF

#

44-47, 48 is my problem

#

first step is solve for eta and RF with shooting method and then runge kutta the rest

dusk meadow
#

If I have a pair of intersecting k-dim planes in n-dim space, represented as y = Ai@x = bi, where each Ai is a full-rank n-by-k matrix, what is a way I can find a representation for their intersection? That is, y = C@x + d.

#

I came across the Zassenhaus algorithm, however this is for subspaces.

plucky kayak
#

your set of equations is equivalent to one large system where matrix was obtained by stacking A_i on top of each other

#

so you just need to pick any particular solution of that system and add any element of null space of the stacked matrix to that, that describes the entire intersection

opal mason
plucky kayak
#

the solution set to Ax=b is x_0 + z, where x_0 has the property that Ax_0 = b and z is in the null space, i. e. Az=0

opal mason
#

ohoh ok I see TacoNod

opal ocean
#

sup, is anyone well versed in the finite element method? I'm working on an implementation for a project but so far it hasn't been going so well, so it would be nice to find someone who knows the stuff

opal ocean
#

so rn just finding eigenfunctions for the Laplacian

brave crypt
grave spoke
opal ocean
opal ocean
#

well, so far I have code to generate meshes of the shapes I want, and code to compute the stiffness and mass matrix

#

the data structure for the meshes is kinda dumb, but the code has to be read by people who aren't into programming

grave spoke
#

so, what's left to do? and what hasn't been going well?

opal ocean
#

if you have any questions regarding the code, please ask!

opal ocean
#

but all my eigenvectors give me nonsensical solutions

opal ocean
#

so

#

to be more precise

#

I'm unsure of how I should deal with the edge condition (i.e., making the edge test functions zero)

#

what ive done is make the corresponding rows zero and the diagonal values on these rows 1

#

and I get solutions that are zero on every node, but have a huge singularity on one node

#

kinda like a dirac

#

like that

#

keep in mind that the solution I'm looking for is some kind of trigonometric polynomial

opal ocean
#

oh also im sorry, this is old code, there are a couple of coefficient mistakes there that i've fixed, however, I still get the same spiky function problem

grave spoke
opal ocean
#

wait what?

#

did you run my code?

grave spoke
#

yes

#

well

#

modified

opal ocean
#

also its very strange that the mass matrix isnt symmetrical

#

since I only fill the upper triangular half, then make it symmetrical

grave spoke
opal ocean
#

only the diagonal coefficients

#
M = M + np.transpose(M)```
#

line 153

#

also I can't thank you enough for giving me some of your time

grave spoke
opal ocean
#

it's incredibly kind of you

opal ocean
#

since it has null rows (if null is the right word)

grave spoke
#

and use np.linalg.eigh (for Hermitian matrices) to get eigenvectors ordered by the magnitude of eigenvalues (np.linalg.eig will not necessarily order the eigenvalues and eigenvectors as they may be complex-valued)

opal ocean
#

oh you mean remove them remove them

grave spoke
opal ocean
#

but if I remove them, isnt it the same as considering the problem on a smaller inner square?

opal ocean
#

so did you mean

#

something like that?

#
#   find edge nodes
    to_remove = []
    for i, node in enumerate(list(test.keys())):
        if node[0] == 0 or node[1] == 0: # check edge nodes
            to_remove.append(i)
    #remove corresponding rows and columns
    K = np.delete(K, to_remove, 0)
    K = np.delete(K, to_remove, 1)
    M = np.delete(M, to_remove, 0)
    M = np.delete(M, to_remove, 1)
    P = np.linalg.inv(M)*K
    eigenvalues = np.linalg.eigh(P)
    # fill back the vectors by adding zeroes to edge values
    eigenfunctions = []
    for i in range(len(eigenvalues[1])):
        vect = list(eigenvalues[1][i])
        for j in to_remove:
            vect.insert(j, 0)
        eigenfunctions.append(np.array(vect))```
grave spoke
#

sorry, i had other things to tend to

grave spoke
#
\[K = \arr{1 & -1 & 0 & 0 \\ -1 & 2 & -1 & 0 \\ 0 & -1 & 2 & -1 \\ 0 & 0 & -1 & 1}\]
pine jettyBOT
#

戯言 MSC2020 49M41

grave spoke
#

the above matrix is singular

#

but if we remove the rows and columns corresponding to the boundary nodes, we get an invertible matrix

#
\[\tilde{K} = \arr{2 & -1 \\ -1 & 2}\]
pine jettyBOT
#

戯言 MSC2020 49M41

grave spoke
#

what you can do to reduce the generalized symmetric eigenvalue problem to an ordinary symmetric one is to consider the Cholesky decomposition of M

#
\begin{gather*}
M = L L^* \\
K \psi = E M \psi \Leftrightarrow L^{-1} K (L^*)^{-1} \psi = E \psi
\end{gather*}
pine jettyBOT
#

戯言 MSC2020 49M41

grave spoke
#

so, you define (P = L^{-1} K (L^*)^{-1}) instead of (P = M^{-1} K) to retain the symmetry

pine jettyBOT
#

戯言 MSC2020 49M41

grave spoke
fathom rain
#

eigenvalues of K is just $f(\theta_j)=2-2\cos(\theta_j), \theta_j=(j-1)\pi/n$

pine jettyBOT
#

sverek

fathom rain
#

eigenvectors also known in closed form

grave spoke
#

we're talking about a general finite element mesh

grave spoke
grave spoke
#
    test = meshes.general_mesh(meshes.cube_nodes(1, 1, N=16))
    matrices = browse_mesh(test)
    K = matrices[0]
    M = matrices[1]
    n = np.size(K, 0)

    bnd = []
    for i, node in enumerate(list(test.keys())):
        if node[0] == 0 or node[1] == 0 or node[0] == 1 or node[1] == 1: # check edge nodes
            bnd.append(i)
    K = np.delete(K, bnd, 0)
    K = np.delete(K, bnd, 1)
    M = np.delete(M, bnd, 0)
    M = np.delete(M, bnd, 1)
    L = np.linalg.cholesky(M)
    Linv = np.linalg.inv(L)
    P = Linv @ K @ np.transpose(Linv)
    eigenvalues, eigenvectors = np.linalg.eigh(P)

    dof = [i for i in range(n) if i not in bnd]
    for i in range(4):
        sol = np.transpose(Linv) @ eigenvectors[:, i]
        vec = np.zeros(n)
        vec[dof] = sol / np.linalg.norm(sol)
        display_vector(test, vec)
#

this seems to work well using the fixed version @opal ocean

#

for the mixed zero Dirichlet and Neumann boundary conditions, you get the following discrete eigenfunctions

opal ocean
#

thank you so much, that's very kind of you, ive been stuck on this for a while

#

Im unsure of why P should be symmetrical, is that a thing about generalised eigenvalue problems?

#

I havent come across that idea anywhere, so if you had resources you could point me to that would be great

grave spoke
opal ocean
#

wait so they were the right eigenvalues, just not in the right order?

opal ocean
#

okay so what i did was right, I just had the vectors in a random order, and probably fucked up the reconsitution of the vector with value 0 on the boundary

#

I really can't thank you enough, you've been very patient and nice to me

grave spoke
#

In numpy, * is elementwise multiplication, while @ is matrix multiplication

grave spoke
valid iron
#

Yo, my teacher gave us this homework to prepare our exam but i don t understand what he is asking. He gave us a code we have to complete the iterative refinement but i don t understand how, and what we need to use. why factorisation LU ? how to prevent cancellation error for the line r = b - Ax ?

Here’s the task
The project file Lefichierprojet2024INFOF205.m contains a simulation of a linear system A⃗x=⃗b, where the matrix A is ill-conditioned. The simulation first generates a diagonal matrix Σ with a specified condition number and two arbitrary orthogonal matrices U and V, to construct A = UΣVT. Then, the theoretical solution of the system is generated as a vector of integers. The values of ⃗b are found by executing the operation ⃗b=A⃗x. You are asked to complete the routine by recalculating ⃗x from A and ⃗b, and adding a number of iterations nit = 20; of iterative refinement (using a for loop i=1:nit instead of while norm(e)/norm(x) > tol). Use explicit LU factorization in your implementation (command [L,U] = lu(A);). Avoid the implementation from slides that suffers from cancellation errors in the line r = b - A*x. After each refinement, store the values of the residual and the error ehat (i.e., the solution of the system, not the exact error). Default values for n and condA can be used (n=10 and condA=1.e14). Include the completed routine in your folder.

wooden kiln
#

Is it possible to prescribe a Neumman Boundary Condition for a variable, if you have their discrete values in Spectral Space?

dawn wadi
#

Hey, I’m having trouble finding resources on the appropriate definition for a stable algorithm, the course book “scientific computing” by Michael T. Heath gives vague supposedly equivalent definitions using casual wording without definition, like “nearby problem” etc.
Without any examples too, all of this is just a small paragraph btw.

This is troublesome to me because one of the exercises asks to give a proof for why addition is a stable algorithm under the IEEE standard’s machine epsilon.

Thanks!

next garden
worn pivot
#

oh

brave crypt
dawn wadi
pine jettyBOT
dawn wadi
#

Here F is meant to represent the set of floating point numbers

dawn wadi
#

So since fl(x+y) = (x+y)(1+eps) = x(1+eps) + y(1+eps).

Can I just pick x^ = x(1+eps), y^ = y(1+eps) and we’re done?

next garden
#

There's something I don;t understand with the FEM.

say our equation is u'' = f

We do the weak formulation and get

$\int u'' w dx = \int f w dx$ And from here use integration by parts to get something in terms of just u'w'

Then we replace u by a piecewise linear approximation $u \approx \sum u_i v_i$

However, the second you make that approximation, u'' would yield 0 as a function. So the equation:

$\int u'' w dx = -\int u' w' dx$

That you get from itnegration by parts should be false. So how come the equality holds? The left hand side and the RHS should evaluate to different things in my head.

pine jettyBOT
#

Makogan

grave spoke
#

Oh, you mean piecewise in the interior of each subinterval, yeah

next garden
#

so my head doesn;t understand how the equality holds under the approximation

grave spoke
#

It doesn't. The piecewise linear approximation is not twice differentiable at the breakpoints in the classical sense (the integral of u'' over the whole domain is not defined).

next garden
#

That doesn;t really remove my confusion though. Before the approximation we have an integral equation.

Then we make the assumption that $u$ admits a given approximation, but the approximation we got breaks the analytic equation. And yet we proceed to integrate the RHS as if all was fine.

pine jettyBOT
#

Makogan

next garden
#

Why does this work in practice?

#

My head keeps telling me it shouldn;t because the fundamental assumption you made through the integration by aprts doesn;t hold

grave spoke
# next garden Why does this work in practice?

Well, that's the idea, the analytic equation only holds for functions that are twice differentiable in the classical sense, so you weaken it by considering the weak formulation instead, which is still defined for H^1 functions.

next garden
#

But how does the solution you find manage to approximate the problem

#

When it won;t have a "correct" second derivative?

#

basically I don;t understand how breaking the fundamental constraint from your equation allows you to nonetheless find something useful

brave crypt
silk drum
# next garden There's something I don;t understand with the FEM. say our equation is u'' = f ...

It's a valid conceptual question. $u''v = (u'v)'-u' v'$ so, by the equality, we can claim a lot of the meaning and information on the LHS is completely (in the sense of equality) captured by the RHS. But obviously we see here the LHS has a second derivative whereas the RHS does not.

FEM doesn't know or care that you started with an equation with a second derivative so it would be a dig into the convergence theorems and error estimates of how well FEM would approximate the true solution with different error estimates. I would guess any error estimate including second derivatives would be tragically bad, as pointed out.

Ultimately, the equality holds by the product rule for the derivative as used in integration by parts and zero is a perfectly valid second derivative in the interior. It's actually on the element boundaries that you have a problem of non-existence of some derivatives, if you only enforce continuity.

To work through the conceptual hurdles, one could apply FEM first to $u=f$ (you just get a mass matrix) and use higher order elements with non-zero interior second derivatives to get a feel for things.

pine jettyBOT
#

mikeliuk

next garden
dawn wadi
pine jettyBOT
dawn wadi
#

Or am I missing something?

dawn wadi
brave crypt
#

Since x and y are real numbers, to do a floating point addition we need to convert it to floating point numbers first

#

So, when you say x^, thats already fl(x) since x^ = x(1 + eps) = fl(x)

#

And then one needs to take into account the fact that adding two floating point numbers may not result in a floating point number (since the number of bits required may be increased)

#

So its fl(fl(x) + fl(y))

dawn wadi
dawn wadi
#

Here’s the definition I’m using for backwards stability btw

dawn wadi
# brave crypt So its fl(fl(x) + fl(y))

But say we use this, what would I exactly be investigating as you suggested?

That is, what is enough to show that the addition algorithm is stable using that expression?

brave crypt
#

,tex so $ (1 + \delta)(x + y) = (x(1 + \varepsilon_1) + y(1 + \varepsilon_2))(1 + \varepsilon_3) $

pine jettyBOT
#

Kamiya

brave crypt
dawn wadi
#

I'm not really following, what does this exactly say?

#

Like so what? Why does this imply backward stability?

dawn wadi
brave crypt
#

,tex the $ |\delta| $ is what you want to bound to get backward stability

pine jettyBOT
#

Kamiya

dawn wadi
#

So long as its bounded the algo. is stable?

brave crypt
brave crypt
pine jettyBOT
#

Kamiya

dawn wadi
brave crypt
pine jettyBOT
dawn wadi
#

My point is, even if x, y are not already that, can't we just rewrite it as such?

#

So it seems reasonable why we dont bother with that (in this case)

dawn wadi
brave crypt
pine jettyBOT
#

Kamiya

dawn wadi
#

Yeah i was sorta half joking but realized now that it doesnt even matter it seems, since we can just rewrite (up to error below machine eps.) in the same form anyways

dawn wadi
#

Like in our case since we're still below any machine eps. error, isnt it fine to write fl(x+y) = (x+y)(1 + eps) even if x,y are real?

dawn wadi
# pine jetty **Kamiya**

Since we can always just rewrite that error in terms of some other error say eps, and have it in a form like this ?

#

Im sorry if im being annoying lmao

brave crypt
# pine jetty **Aslan**

,tex so we have $\delta = \varepsilon_3 + \frac{\varepsilon_1 x + \varepsilon_2 y}{x + y} + O(\varepsilon^2) $, yes in this case it will lead to the same conclusion

pine jettyBOT
#

Kamiya

brave crypt
#

but if the question is x - y, you will find that the longer method leads to a different conclusion

dawn wadi
#

Thats true

brave crypt
#

,tex since its not stable when $ x \approx y $

pine jettyBOT
#

Kamiya

dawn wadi
#

Thats intersting, for some reason our textbook says it fine to write it for minus the same way

#

Im only in undegrad so maybe this is something subtle they dont think was important in general?

brave crypt
#

its actually a well-known phenomenon

#

In numerical analysis, catastrophic cancellation is the phenomenon that subtracting good approximations to two nearby numbers may yield a very bad approximation to the difference of the original numbers.
For example, if there are two studs, one L1=253.51cm{\displaystyle L_{1}=253.51,{\text{cm}}} long and the other L2=252.49cm{\displaystyle L_{2...

dawn wadi
#

Yeah was about to say that they instead talk about this separately but without any "rigor", but before this they just say yeah you can write fl(x-y) = (x-y)(1 + eps)

#

Let me double check

brave crypt
#

yea if they are exactly representable, nothing bad will happen for sure

dawn wadi
#

Okay i was just dumb, it seems its implied that x and y are floating point numbers already

brave crypt
#

but we do need to care about it when it comes to linear systems (especially the ill-conditioned ones)

dawn wadi
#

I see

#

I think i also realized that in the exercise x and y are not real numbers but also just floating point numbers 💀

#

I should of just written it down, never ever making this mistake again

dawn wadi
#

thank you for wasting your time. I learnt alot from this

wicked pecan
#

Are there any coefficients for 8th (or higher) order RK methods (for stiff or non-stiff) that are generally considered good?
I want to try out some higher order methods for a project of mine and whenever you look for them online you find research papers with large butcher tableaus that require that you choose certain parameters yourself, and I neither know why I'd use certian coefficients over other coefficients (assuming both of them were published in research papers), or how I'd choose the variable parameters for those butcher tableaus where you need to choose certain paramaters yourself...

grave spoke
opal ocean
#

not the solve one

#

just multiplication

#

now i'm trying to implement a 3d version but jesus christ the coefficients are a nightmare

hybrid mulch
#

Hello, I have an assignment that I need help with , I posted it in help 5. This is really important for me passing the class. If there is someone who is good with analysis and has some extra time i would pay you to help me out.

fathom rain
hybrid mulch
#

Not to do my homework

#

To tutor me

#

and teach me how to do it

wicked pecan
grave spoke
#

And the coefficients:

wicked pecan
#

Oooh

#

Thank you so much

#

That’s exactly what I needed

gaunt crag
#

F(y,h), h, and a are specified. R is unknown eigenvalue. how do i find eta via shooting method without knowing R?

golden wolf
#

Hi! Is anyone familiar with 'prolate spheroidal wave functions' or 'Slepian functions'? I am mainly looking for a use case for them and to understand their real applications. It seems like a niche topic in that I can't find any applications for it, but it also seems highly theoretically useful.

heady mesa
#

Spectral Methods or Finite Difference methods? Which are more powerful?

#

So far I've only studied Spectral Methods and I mean they are really OP but was wondering if it's worth looking into Finite Difference methods as well.

brave crypt
heady mesa
#

Non linear ODEs

brave crypt
#

For PDEs, spectral methods are really bad for nonlinear conservation laws.

#

This is due to the Gibbs phenomenon.

heady mesa
#

Interesting

#

I have been using them to solve Non-linear ODEs such as the Lane-Emden equation

#

I'll look into this stuff more, cheers

brave crypt
#

My gut feeling says that the weak solution is in H^2 (or maybe H^1).

brave crypt
#

So its not surprising if you find spectral methods powerful for this problem.

heady mesa
#

Nice, yeah I mean it's defined the semi infinite domain and hence I've been truncating the domain when solving using a computer

#

Combined it with the quaslinearization method

heady mesa
brave crypt
heady mesa
#

Yeah exactly

#

That's cool, really helpful, I don't think I'll be solving any stiff ODEs as part of this project.

brave crypt
#

My research is computational but we develop numerical methods by starting from the mathematical theory of PDEs

#

So I always try to understand the problem im trying to solve at the continuous level first.

brave crypt
heady mesa
heady mesa
#

My supervisor had never heard of it...

molten knot
#

anyone have any ideas for a good 45 minute numerical linear algebra/optimization presentation topic? we’ve gone over all the basic factorizations and descent methods in the course but can pretty much choose any related topic for our project

odd minnow
#

Does anyone have learning resources in the form of videos that use the Advanced Engineering Mathematics book as a reference? Can you share the channel?

#

or Do you have a answer key with the the solution of Advance engineering mathematic? i want to do some exercise

heady mesa
#

Basically you turn a polynomial into a matrix (called a companion matrix)
where the eigenvalues of this matrix are the roots of the polynomial. Then you use QR factorisation to approximate the eigenvalues (which are the roots of the polynomial)

molten knot
#

this topic sounds cool though i’ll check it out thanks!

brave crypt
#

Because its too expensive.

brave crypt
#

Something like total variation denoising, it involves both linear algebra and optimization.

errant wagon
heady mesa
brave crypt
#

Its very time consuming for PDEs.

heady mesa
#

Ah okay, makes sense 😂

molten knot
shut vine
#

Hi, does anyone have any idea of deriving the explicit formula of X{k+1} for the classiscal Kaczmarz alg? Thanks!

rancid light
#

x^(k+1) = x^k + (b_i - ⟨a_i, x^k⟩) / ∥a_i∥^2 * a_i

where i = (k mod m) + 1, a_i is the i-th row of matrix A, b_i is the i-th element of vector b, and ∥a_i∥ denotes the Euclidean norm of a_i

#

you can expand that

boreal glade
#

Now that is weird

heady mesa
#

What is weird about it?

tiny lake
#

What does the current research in numerical analysis focus on?

#

Fine-tuning Krylov subspace methods? Less precise, small-width floating-point algorithms for machine learning? Something else?

heady mesa
#

Lots of areas in numerical analysis

#

Better algorithms for solving ODEs and PDEs. Better algorithms for approximating eigenvalues of certain matrices ext.

fathom rain
random plume
#

parallel, streaming and distributed methods, adapting some methods to real-time applications, numerical approximations of various infinite-dimensional operators (using pseudospectrum to verify calculations)

#

anything that has to do with tensor decomposition

#

And I second the part about better eigenvalue decomposition. The singular value decomposition is heavily used, and I don't know (yet) of a good numerical algorithm to obtain the jacobian normal form decomposition in a way that's not known to be numerically very unstable

#

even though there's a lot of cases where applying the singular value decomposition will make you loose information about generalized eigenvalues/vectors (there's cases where the singular value decomposition is not the decomposition you'd want to have)

cursive yew
#

This is from "What every computer scientist should know about floating-point arithmetic" by Goldberg. Can someone explain how the β' is the digit β/2

#

how did he get the error in the next line

north marlin
spark falcon
#

What would you consider the best algorithm to calculate SVD? The best in terms of how good it is in image compression compared to standard library implementation or something simple like power method

plucky kayak
#

analytical continuation is a complex analysis topic

#

then you should fully explain your problem and what you want to do

#

because under certain conditions there's only one analytic continuation so it doesn't make sense to talk about having multiple of them

#

ah I guess you're talking about analytic continuation of f_e, which is determined for each set of data

#

well the answers to first and second question is "it depends on the problem"

#

choice of norm would be different and sometimes greatly affects the solution, which may or may not be beneficial in a particular problem

#

you may also find f_e(x) that equals f_t(x) for every x in the data set, yet it's way off from true function at other x's

#

I think uniform convergence should take care of this problem, but it's probably very hard to justify it outside of special cases

#

I guess gradient boosting could be the closest thing to what you're looking for that actually works

#

it also produces a sequence of approximating functions that are chosen in some optimal sense

coarse field
#

Hello guys!!! I have a question , how can i aproximate the solution of an equation like h(x) = 0

#

and lets say that h(x) has one zero in a closed interval [a,b] , h(c) = 0

#

and h'(c) also equals zero

cosmic karma
#

if you don’t need a really fast one, maybe bisection method? haha

#

or secant method is probably so much better

coarse field
#

lets suposse the h(x) is something like this

heady mesa
#

Yea secant and bisection wouldn't work, Newton Raphson would have floating point problems but other than that is should work?

heady mesa
heady mesa
pine jettyBOT
coarse field
#

ahhh no it cant

#

yeah!!!! good idea

#

tysm!!!

coarse field
#

how can i implement sympson rule ?

#

where the function recieves the error the user wants , and the function ?

fathom rain
coarse field
#

I didnt learn "Richardson" can you try to explain me what is that ?

#

My issue with this is that to find the number of sub-intervals, it's necessary to bound the 4th derivative of the function. I don't think there's a general formula to do this for an arbitrary function, so I'm not sure how to proceed. Does this 'Richardson' you mentioned have anything to do with this?

fathom rain
#

Error approximation will be $(S(h)-S(2h))/15$ since it is a 4th order method ($(S(h)-S(2h))/(2^p-1)$). Then you have that that error is a[proximately $Ch^4$ compute $C$ and pick an $h$ so error is smaller than your tolerance

pine jettyBOT
#

sverek

fathom rain
#

where $S(h)$ is simpson of ypur function for some $h$

pine jettyBOT
#

sverek

dapper crystal
#

$\int_{0}^{1}e^{-x^2}dx$

pine jettyBOT
#

Ångst

dapper crystal
#

i'm trying to calculate this integration with simpson rule and i got stuck

cursive yew
#

does anyone know any good resources to study about rounding error analysis ?

#

I have this book called Rounding error in algebraic process by Wilkinson. The book discusses the errors in arithmetic operations, computations involving polynomial and matrix operation in great detail. But it was published in the 60s. So i am not sure if it is updated enough for one to study. I write my codes in C

dapper crystal
# fathom rain what was the problem

thank you for the response, problem was related to my basic integration knowledge, after reviewing some notes I've succesfully calculated that integration

heady mesa
cursive yew
#

which i haven't found as now

#

good examples

heady mesa
#

The quadratic formula is the classic example

#

$\frac{-b\pm\sqrt{b^2-4ac}}{2a}$
\
\
If $a\approx0$ we have problems

pine jettyBOT
heady mesa
#

So times top and bottom by the conjugate of the top

#

And you get $=\frac{2c}{-b\pm\sqrt{b^2-4ac}}$ which no longer has that problem

pine jettyBOT
cursive yew
heady mesa
#

I mean, personally I used this rounding stuff to improve my differential equation solving

#

essentially you can solve differential equations using polynomials, higher power the polynomials often the better the solutiopn

#

but higher the power polynomial, more opportunity for floating point errors (especially for large x)

#

So I would "patch" the domain and use lots of low order polynomials

cursive yew
#

I see

#

I am just trying to learn a more general "hand-written" approach for finding bounds for rounding error since I am planning to make available "unified" notes, codes and demonstrations. "Unified" as in that I have found that many resources in numerical analysis skip over things (like a proper rigorous error analysis, ofc they mention it once in the beginning of the course, but later seem to forget it) and i wish to make a website (completely free and codes under GNU general public license, meaning that they can run, study, share and modify the codes) where anyone can come and not only start from the very basics, but also learn the subject in more depth for a better understanding of ideas. Standard books or courses are nice but I think all of them have some gaps needed to be filled. I will try to fill them as best as I can

heady mesa
#

That's pretty cool

heady mesa
#

Like if I feel the result is wrong I just make the precision insanely big

cursive yew
heady mesa
#

There will be an equivalent library for C

cursive yew
#

Going to write everything from scratch

fathom rain
#

what do you mean "standard"?

#

mpfr and arb are very standard

cursive yew
fathom rain
#

preinstalled in what?

#

most machines have no compilers installed...

cursive yew
#

linux usually has gcc and some libraries installed

#

Idk about windows

fathom rain
#

so "standard" for you is whatever linux distribution you chose for the moment. ok. that is quite non-standard definition...good luck

cursive yew
#

Well, wouldn't be using anything other than stdio, stdlib, math i think

autumn sphinx
#

chants cuda cuda cuda cuda

tiny lake
heady mesa
#

@fathom rain do you use C alot?

#

I use mainly python, but are there advantages to the other languages like C in numerical analysis?

cursive yew
fathom rain
fathom rain
cursive yew
#

C can take some time for people to get comfortable with but I think once you get used to it, your code can do stuff really faster. Take this example (taken from mit 6.172 lecture 1): Matrix multiplication. Two NxN matrices, whose elements you generate randomly, and then multiply the two matrices using $c_{ij} = \sum_{k=1}^Na_{ik}b_{kj}$.
For N=4096:
Python takes about 6 hours.
Java takes 46 minutes
C takes 19 minutes

cursive yew
#

C is more like a personal preference for me

#

C can be intimidating at first tho. It lacks several features that python does, like garbage collection. But again, once you get used to C, it should be easy

pine jettyBOT
#

notssoshocking

brave crypt
#

Otherwise it is an unfair comparison, since Java and C are compiled.

cursive yew
#

Only these 3

heady mesa
heady mesa
#

Yeah I may have to learn a bit of C then

cursive yew
#

C is more like a personal preference for me

#

People have been using C for decades but nowadays you have languages like Julia if you want code simplicity and speed both

#

If all you wish to do is numerical analysis without caring much about the code part, go with julia

brave crypt
#

Since numba makes your code compiled

#

If they just used standard python, the result would be obvious without even testing it

#

There is no way an interpreted language can run faster than a compiled language

cursive yew
#

This page uses LU decomposition as a test case. I didn't look at the codes in detail but skimmed through the page for now.

#

C seems to have performed well as compared to Numba for higher N. Numba performs really well as compared to C till around N=15. After that C catches up and becomes faster. Similar case for C vs cython, though cython couldn't outperform Numba. Somehow scipy and lapack did better than C for higher N.

#

Julia performed really well as compared to C for lower N. Even for higher N, they were comparable

#

I haven't yet looked into the validity of this page though

tiny lake
#

But I've heard Fortran can be pretty good even these days because of its very aggressive optimisations

cursive yew
brave crypt
wet magnet
#

hi, I'm wondering if anyone can give me some suggestion on how to get started on modeling pdes. Especially I'm reading this paper https://arxiv.org/pdf/1802.06089 and it has a lot of plots, and I'm not sure how to get those. How do you get a numerical simulation of a equilibrium solution? They just generated some point particles randomly but the PDE only involves the population density, how does the population density affect a single particle? I guess I'm not sure how to model that

#

sorry if I phrased my question poorly, I'm just really confused about how to get started. If anyone could point me to useful resources so I could learn similar things I would be very grateful

heady mesa
#

Depends what method you want to use to solve PDEs, do you know what type of PDE you want to solve? @wet magnet

wet magnet
#

im just looking at the one in this paper

wet magnet
heady mesa
#

(I can't suggest a good method as I don't do PDEs)

Id suggest looking up this PDE and high precision solution or "solving ..."

Then read some papers around this area to find out the state of the art methods.

Then try to learn them methods first from a textbook or thesis

wet magnet
heady mesa
#

Some methods will be quick to learn, like basic finite difference schemes or basic spectral methods

#

But if you want high precision then that will take some time to learn about

wet magnet
#

i see, ill look it up

grave spoke
grave spoke
wet magnet
grave spoke
#

and Runge-Kutta methods for the integration of the resulting system of ODEs

grave spoke
wet magnet
#

lol i only saw familiar words and got excited

#

didnt really find anything on numerical results of this pde on general manifolds

grave spoke
#

numerical analysis on manifolds is still a relatively new field

grave spoke
#

i skimmed the document and i don't think it's a good introduction to it

wet magnet
#

what would be a good intro

#

like a youtube video?

grave spoke
#

or pick up a book about meshfree and particle methods rather than a dissertation

manic pollen
#

hey there, does anyone know the difference between numerical analysis and numerical methods? are both of them the same? or if there is a slight difference, what would that be?

heady mesa
#

The key difference is the word "methods" and "analysis"

In numerical analysis we study the analysis behind the methods. Ie. their rate of convergence, the conditions for convergence, the theory behind optimally using these methods ext.

Numerical methods are just the methods we use to solve stuff numerically.

#

For instance the Newton Raphson method is a method for finding roots to equations. In numerical analysis we study when this method will find a root, show that it has quadratic convergence, find conditions for when we would expect the converge to be even faster than quadratic ext.

indigo fox
#

at the bottom of the image where it mentions theorem 18, I don't quite understand the wording. What does it mean for it to interpolate f(x) at the gaussian quadrature points?

heady mesa
#

It means the interpolating polynomial = the function you are interpolating at those points

wary oriole
cursive yew
# wary oriole I asked this question but would like to hear your opinion. Why always C instead ...

Well honestly I'm somewhat new to the field. Just to give you context: completed my bachelor's level of physics major a couple of days ago. Not a computer science guy either, only know some basic stuff. My professor advised me C or FORTRAN over c++ and Julia when I was in my 2nd year. Back then I chose Fortran. Recently i developed a taste for C. For some reason it feels a lot more intuitive to me than OOP. Maybe it is compatible with the way I think of algorithms in my head. Not entirely sure.

#

Now coming back to your question on why the scientific community prefers C. I'm not sure of this but back when I saw this online archive of open source scientific computing codes, I found that c, c++, Fortran were very common. So not just c, c++ is used a lot as well

#

One of my friends, who works in fluids, had to use some fluid dynamics code (I forgot the name, something along the lines of "basilisk" i think). As far as I remember, she had to learn c++ instead, since the code is in c++. My supervisor advised C for my many body simulations project

wary oriole
cursive yew
wary oriole
#

oh some people mentioned C has much better API compatibility with other languages, so a library written in C is much easier to use in projects written in other languages.

cursive yew
# wary oriole oh some people mentioned C has much better API compatibility with other language...

Oh yeah that. The starting of this video: https://youtu.be/443UNeGrFoM?si=x7cbQdsN98f3hSvw shares why the person uploading the video prefers C

This is a talk I (@eskilsteenberg) gave in Seattle in October of 2016. I cover my way of programing C, the style and structure I use and some tips and tricks. Fair warning: There is a fair bit of Programming religion in this talk.

My projects can be found at http://www.quelsolaar.com
My source can be found at: http://www.gamepipeline.org
On twi...

▶ Play video
#

I somewhat agree with him

cursive yew
wary oriole
#

i think it's a just math thing. in other fields like game programming and likes C++ is a lot more

cursive yew
#

Yes I think for games, oop is a better option, though functional programming can work as well (not sure how better).
Roller coaster tycoon is written in assembly language

dense echo
#

The API compatibility thing is real, I'd say. If you take a random programming language, it will fall into one of two classes:

  1. It has reasonably good facilities for calling a C library.
  2. It doesn't let you easily call code written in any other language than itself.
    C is generally the lowest common denominator that all language implementors make interoperability for first.
#

Doesn't mean it is any easier to write a library in the first place (C has a wide selection of footguns to pick from), but once you manage to write it, you will have maximized the possible audience for it.

tropic garnet
#

just as a meet-and-greet, who around here is the person to ask for numerical verification in PDEs? as in, using numerical methods to establish rigorous theoretical results about existence, regularity, blowups etc. in PDEs?

#

some also call it computer-assisted proofs

plucky kayak
# wary oriole oh some people mentioned C has much better API compatibility with other language...

watch this if you want to learn how differently C++ compiler handles function names compared to C https://youtu.be/NeOTr0u7ALk?si=AZeosQJFpQ3YMsk9&t=263

Patreon ➤ https://www.patreon.com/jacobsorber
Courses ➤ https://jacobsorber.thinkific.com
Website ➤ https://www.jacobsorber.com

Header files often have things in them that confuse beginning programmers. This video explains two of them — ifdef guards and extern "C" blocks.

Objdump video: https://www.youtube.com/watch?v=bWMIpHVRFUo

*...

▶ Play video
fathom rain
tropic garnet
# fathom rain proof-assitants don't use any numerics

I am not referring to Lean or Coq
but rather, for instance, Galerkin numerical calculations with interval arithmetic for an approximation (with bounded errors) and then using fixed point theorems to obtain true solutions etc.

tropic garnet
#

people are really jumping on this trend of using the computer to discover and study specific PDE scenarios rigorously

fathom rain
tropic garnet
#

arturia well I don't want to name people directly but arxiv should tell you

fathom rain
tropic garnet
#

interesting. australia huh.
I'm thinking of some people from East Coast and Canada.

fathom rain
#

he was at cornell and uppsala before

tropic garnet
#

Mitsuhiro T. Nakao wrote a book about the subject in 2019 (Numerical verification)

fathom rain
#

good luck, seems nice

indigo fox
#

For this question, by definition the weights of the gauss quadrature is the sum of squares of the orthonormal polys at each point, however the solutions suggest that you can use lagrange's polys to find the weight. What does lagrange's poly have to do with the weights?

wary oriole
brave crypt
#

I am sure that the scientific computing community also prioritizes performance.

brave crypt
autumn sphinx
#

At least in my corner of structural biology

dense echo
#

"OOP or not" is a false dichotomy anyway. One often gets trade-offs between performance and maintainability, but nobody says you have to resolve them the same way everywhere in your project. Figure out where the performance-critical parts of the code are and make a deliberate decision to sacrifice readability there; that doesn't mean you can't still strive for a more straightforward style in the surrounding code.

random plume
# autumn sphinx Maintainability is becoming more of a concern in science community

I mean, to me there's a freaking ton of "one-commit" code. Put out for the paper in a github that will never be touched ever again but never iterated upon, even if it sometimes isn't fully working or contains egregious performance pitfalls (like calculating the n-1 smallest eigenvalues of a symmetric matrix when it's equivalent to first just the largest one)

tropic garnet
rain furnace
#

can anyone help with applying Gauss Legendre numerical integration to the elemental mass, advection and diffusion matrices?

brave crypt
#

Nakao is one of them, which you have mentioned before.

worthy geyser
#

When using 1d newton raphson, we terminate once you either reach N iterations or when something enters a threshold range. What is that something and what would it be for 2d?

plucky kayak
#

there are many criteria to choose from

#

the naive is $||x_{k+1}-x_k|| \leq \varepsilon$ for any dimension

pine jettyBOT
#

Transparent Elemental

wicked pecan
#

And what exactly is |||| doing

plucky kayak
#

for 1 dimensional variant you can use the geometric sequence-based approach $$\left|\frac{x_{k+1}-x_k}{1 - \frac{x_{k+1}-x_k}{x_k - x_{k-1}}}\right| \leq \varepsilon$$

pine jettyBOT
#

Transparent Elemental

plucky kayak
heady mesa
wicked pecan
#

Are most norms whose names also exist for metrics just equal to the distance to 0 (or the 0 vector)?

plucky kayak
#

every normed space is a metric space, so yes

grave spoke
# indigo fox bump

What's a sufficient and necessary condition for an n-point quadrature rule to integrate polynomial functions of maximum degree n - 1 exactly?

raven sequoia
#

I was trying to find the intersection of these curves

#

this is what wolfram showed me, are they real ?

#

it should be real as the graph clearly touches, but not sure why it shows up like this

plucky kayak
#

cardano's formula gives real roots even if you have to work with complex numbers along the way

raven sequoia
#

i mean, whether the solutions given real or complex?

#

I feel like all the 3 solutions should be real

plucky kayak
#

they are real

#

as you can see this one simplifies to 0.854 * e^(i * pi)

raven sequoia
#

I was trying to solve this in sage math

#

It's showing it as a complex number, but i notice the complex part is tiny tiny

plucky kayak
#

yes that's just an artifact of floating point operations

raven sequoia
#

any ideas how to get a decimal approximation for this?

#

using sage?

#

i can take the real part i suppose, but do you know any other ways to get it done

plucky kayak
#

well maybe the solve function has some parameter to specify real solution, I've never used sage

fathom rain
#
julia> using Roots
julia> @. f(x)=x^3 - x^2 - x + 1/2
julia> fzeros(f,-1,2)
3-element Vector{Float64}:
 -0.8546376797184614
  0.4030317167626848
  1.4516059629557767
wary oriole
#

hey guys im wondering why all these linear algebra library (scipy for example) doesn't have iterative solver for linear system? like jacobi, gauss-seidel, SOR, or efficient ones like Conjugate Gradient, multigrid?

#

it seems well studied, parallelized, easy to implement. wondering why that's the case

#

it has advantages compare to direct solvers. so i think it's legit to include in a library?

plucky kayak
#

at least according to scipy docs, they call LAPACK and as far as I can see LAPACK doesn't provide iterative solvers

wary oriole