#numerical-analysis

1 messages ยท Page 2 of 1

south badge
#

I get the math

minor osprey
#

To me, it feels weird why they have it written out as O(t^3), unless I'm missing something

#

Especially since they have O(h^4) written

south badge
minor osprey
#

Yes, that is correct

#

Say if you had O(t^4) terms that didn't vanish

south badge
#

since you leave O(t^4) since those term vanish, and then divide by t leaving O(t^3)?

minor osprey
#

I think I'm getting notation mixed up which is causing confusion to what I'm saying.
When I refer to O(t^4) terms, I am referring to after they are put into the numerical scheme (so they're actually the O(t^5) terms in the taylor expansion of u_j^{n\pm 1})

#

What I wrote is correct that it ended up with O(t^4)

south badge
#

Okay, so if I understood correctly, U=term1+0+0+O(t^4) you leave as U=term1+O(t^4) when placing it into the numerical scheme instead of what I was saying which is U=term1+O(t^2)?

south badge
south badge
minor osprey
south badge
minor osprey
#

Of course!

#

Although, saying O(t^3) isn't completely incorrect, but it implies that the numerical scheme is only 3rd order in time instead of 4th!

south badge
minor osprey
#

I haven't taken numerical analysis in over a year so I'm a little rusty, sorry about that.

pine jettyBOT
#

Crystalloid

bright palm
bright palm
#

are you having a hard time with the coding? it seems like you have what you need

#

idk how you could highlight the stats portion of the question, idk even what its like getting stats help here bearlain well at least advanced stats

#

but people get scared when they see code

#

i can suggest stuff but afaict it does what you think its doing

#

im maybe on the other side where ive done a handful of R stuff but not so much stats lol

neon snow
#

Hi! If I'm solving this PDE on this region:

#

And I'm using a finite difference method

#

The vertices are not included at all then?

#

So for example with this discretization:

#

(x0,y0), (x0, yM), (xN,y0) and (xN,yM) are simply never touched and should never be touched when I do my backward/forward differences?

hoary light
#

if you're using a 5-point stencil, then that sounds right

#

However, if you used a 9-point stencil to discretize the Laplacian, then you would need to include the "corner" points

fathom rain
# neon snow (x0,y0), (x0, yM), (xN,y0) and (xN,yM) are simply never touched and should never...

here is a code that should work fine if you define f (and scale h to your domain now assumed [0,1]x[0,1]) ```
using LinearAlgebra

function laplace2d(n1,n2)
L1=diagm(0=>2ones(n1),-1=>-ones(n1-1),1=>-ones(n1-1))
L1[1,1],L1[n1,n1]=1,1
L1=L1
(n1+1)^2
L2=diagm(0=>2ones(n2),-1=>-ones(n2-1),1=>-ones(n2-1))
L2[n2,n2]=1
L2=L2
(n2+1)^2
kron(L1,I(n2))+kron(I(n1),L2)
end

function main()
n1=20
n2=10
L=laplace2d(n1,n1)
#f=...
#L\f
end

tropic inlet
#

hi

if i have a floating point system with say a 5 bit mantissa and 3 bit exponent what would be the smallest representable positive value

im assuming the bias would be 3, meaning the exponent could range from -2 to 3

so the smallest positive value would just be 1.000x2^(-2)?

#

assuming a normalized (?) system so all numbers start with a 1 followed by a mantissa after the decimal

hoary light
#

Your floating point system represents numbers of the form (1+m) * 2^(e -3)

#

Where m is a 5 bit unsigned integer and e is a 3 bit unsigned integer

#

Is that correct?

#

Note that having a bias of 3 would be fairly unusual IMO

tropic inlet
#

for double precision the bias is 1023 which is 2^10 -1

so im assuming i just do 2^2 -1 (since e-1 is 2)

hoary light
#

I guess then it looks right, assuming e=0 is special

wide spear
#

Hello

#

I have a problem

#

I'm trying to determine if a point is in a spherical triangle sector thing

#

Nothing is working

#

I have a triangle defined by 3 points in R^3

#

v1 = [ 0. , 0.52573111, 0.85065081]
v2 = [ 0. , -0.52573111, 0.85065081]
v3 = [ 0.85065081, 0. , 0.52573111]

#

And a point

#

v = [0.11635811, 0.40254618, 0.90797432]

#

On a lat lon plot, it is clear that v is outside of this triangle

#

Exhibit A:

#

(here v is labeled as p_1)

#

Approaches I have tried:

#

Barycentric coordinates -- the idea is that you solve $\alpha v_1+\beta v_2+\gamma v_3=v$ and if $0\leq\alpha\leq1$ and $0\leq\beta\leq1$ and $0\leq\gamma\leq1$ and $\alpha+\beta+\gamma=1$ then the point is in the triangle

pine jettyBOT
#

Angetenar

wide spear
#

So it correctly determines that this point is not in the triangle

#

However, for the point p2, with coordinates [0.64121447, 0.11656148, 0.75845727], it also determines that it is not in the triangle

#

This is not correct

#

p2 is obviously in the triangle

#

I suspect that the problem is that p2 lies above the triangle because it is on the sphere and the triangle will lie under the surface of the sphere so problems arise

#

Ok next approach

chilly arch
#

Hello problem haver

wide spear
#

Using the fact that $<u,v>=\norm{u}\norm{v}\cos(\theta)$ where $\theta$ is the angle between $u$ and $v$, one can compute the sum of the angles

pine jettyBOT
#

Angetenar

wide spear
#

But this also doesn't work because the points don't lie in the triangle, they'd lie above it

#

So this also returns garbage

#

Ok next approach

#

I found some stack exchange post

#

It uses determinants

chilly arch
#

This sounds really awful

wide spear
#

Essentially compute the determinants of 3 matrices and if they all have the same sign then the point is in the triangle

#

But this also doesn't work

#

Because the signs of the determinants are the same for point p1

#

So it's garbage

#

Ok next approach

#

I found some other stack exchange post

chilly arch
#

Are they all in the same eighth of the sphere

wide spear
#

Where you do some cross products and stuff

#

This also doesn't work

#

It still says that the point is in the triangle

chilly arch
#

Who knows how to spell 8th

wide spear
#

The triangle is 1/20th of a sphere

chilly arch
#

Oh

#

Well

wide spear
#

It's the face of an icosahedron

#

You can see the plot I sent above

#

I guess it isn't very good

chilly arch
#

Yes

wide spear
#

But it's in lat lon coords

#

So like

chilly arch
#

Im trying to think about projecting onto the plane normal to the center of the triangle

#

But i don't think this works

wide spear
#

Converting to lat lon coords and then checking is an option but then you get poor behavior near the poles

chilly arch
#

Because the question is "which center"

wide spear
#

That's sort of what the MSE post is doing

#

The triangle is equilateral

chilly arch
#

Ah

wide spear
#

Well

#

Not all of my triangles will be equilateral

#

So yeah the center problem comes up

#

Anyways

#

This is ruining my life

#

Thank you for listening to my tedtalk

chilly arch
#

It's interesting

#

I will think about it a little more and then give up

wide spear
#

Is it nonsense that this should be so difficult

chilly arch
#

It feels like it

wide spear
#

Ok what if I did this in spherical coordinates instead

#

Would that help

#

No because you get problems when your angle goes from 2pi to 0 again

chilly arch
#

This might me your cross product technique

#

But this should work;

#

If u, v, w are the vertices of the triangle, in counterclockwise order

#

(facing the sphere, not facing out from the center)

#

Then dot x with u x v, with v x w, and with w x u

#

If all signs are positive, it's in the middle. If one is 0, it's on the boundary.

#

or, not quite

#

But if any are nonpositive it's not inside

#

The idea is that you're checking which side of the plane you're on spanned by each pair of vectors

wide spear
#

Ok I just did this but it says that the point p1 is in the triangle

#

The 3 values are 0.10407385458567238, 0.6651830214285624, and 0.0826127194246975

chilly arch
#

one second

wide spear
#

Well

#

The numbers don't lie

chilly arch
#

what are your p1 and p2

wide spear
#

Oh wait

chilly arch
#

i have been very confused for 5 minutes

wide spear
#

My bad

#

v3 is [ 0.85065081, 0. , 0.52573111]

chilly arch
#

@wide spear

#

D is p1 / v

#

A, B, C are v1, v2, v3

#

it's in the triangle

#

your lat long plot is centered in the wrong place

wide spear
#

Is it

chilly arch
#

actually, i don't know

#

but the point is that v is in the triangle

wide spear
#

All I did was convert to spherical coords

#

Hmmm ok

#

I'm pretty sure there is still an issue

#

I've randomly generated 200 points

#

And it's saying that 61 of them lie in that triangle

#

Obviously this is nonsense

chilly arch
#

I don't know

#

If you are randomly generating points with positive coordinates I would buy that

#

Can you plot where the hits are

#

I was trying to do that in matlab but it's annoying

#

scatter3 or something

wide spear
#

These are the points

#

In spherical coords

#

Oh I think I fixed it

#

Maybe

#

???

#

Spherical coordinates are stupid and dumb

#

Not really

wide spear
#

Ok new problem

#

4 ways of computing if a point is in a triangle

#

3 different results

#

So there's the method with the determinants

#

In essence compute the determinants of $\begin{bmatrix}v_1\v_2\v\end{bmatrix}$, $\begin{bmatrix}v_1\v\v_3\end{bmatrix}$, and $\begin{bmatrix}v\v_2\v_3\end{bmatrix}$ and if they are all the same sign, then in triangle

pine jettyBOT
#

Angetenar

wide spear
#

And then there's the two cross product methods

#

One as described by ryc

#

And the other which computes $u_1=v_2-v_1$ and $u_2=v_3-v_1$ and $n=u_1\cross u_2$ and $w=v-v_1$ and $\gamma=\frac{n\cdot(u_1\cross w)}{\norm{n}^2}$ and $\beta=\frac{n\cdot(w\cross u_2)}{\norm{n}^2}$ and $\alpha=1-\gamma-\beta$ and if all of alpha, beta, and gamma are between 0 and 1 then it is in the triangle

pine jettyBOT
#

Angetenar

wide spear
#

And then there is the barycentric coordinate approach, which solves $\alpha v_1+\beta v_2+\gamma v_3=v$ for $\alpha$ $\beta$ and $\gamma$ and if they are all positive then it is in the triangle

pine jettyBOT
#

Angetenar

wide spear
#

The determinant method gives 24 points in one triangle, ryc's cross product method gives 18 points, and the barycentric coordinate approach and cross product method 2 both give 12 points

#

Life is suffering

wide spear
#

Upon further investigation I believe that the barycentric coordinate approach and cross product method 2 are giving the correct answer

knotty snow
wide spear
#

No wrong channel

mortal cave
#

hey I was wondering if this is the right channel for numerical analysis ?

upper cape
#

yeah

mortal cave
#

awesome, thank you!

#

My question is about this statement: Given an M ร— N matrix A, the cross interpolation technique (CI) yields an approximate rank ฯ‡ factorization of A. what does "approximate rank chi factorization" actually mean?

solid oxide
#

Hey guys

#

Can i ask for a little code review help

#

Here

#

Im trying to implement a steepest descent function on a least squares problem

#

And my function wont converge

#

I would really appreciate any input as i am a huge noob

#

gradF is the gradient, gradit is the gradient iterator

#

what happens when i run it is that it just never stops

#

this is the least squares problem

wide spear
#

This is not really the place for code review

#

You're better off asking in the python server

plucky kayak
median musk
#

ive been having trouble with supply and demand quadratics

delicate elk
median musk
#

i got yelled at for posting in another channel

proper valve
plucky kayak
#

this is a perfectly valid channel for linear programming problems as a class of optimization problems

#

doesn't mean that any economics question should go here

minor osprey
#

https://arxiv.org/abs/1912.12777
I've started reading this, and it seems quite interesting so far so I thought I'd share it here if anyone else is interested in machine learning

wide spear
#

Does this build on the neural ode work from a few years ago

minor osprey
#

Yes it does

wide spear
#

This one

#

Anyways

#

One of my professors during undergrad who did ML things was unimpressed by the nerual ode hype

#

Like there was a lot of hype but then it never went anywhere

minor osprey
#

I haven't read that paper in any depth, but that's pretty reasonable. I guess I'm somewhat hopeful considering the paper I posted appears to bring at least a little bit more to the table with (Wasserstein) gradient flow perspectives

#

The comparison the paper draws is advances in early numerical methods for PDE to this issue of hyperparameter tuning in machine learning. I'm a little skeptical in the validity of that comparison, and if those problems can be remedied using these ideas, but I'm still relatively new to understanding them in the first place

fathom rain
minor osprey
#

That seems interesting, I'll definitely consider it if it's offered again in the future and after I've taken some more ML related courses

fathom rain
proper valve
wide spear
#

@manic star the standard book recommendation for numerical pdes is Iserles

#

It is very comprehensive

#

And is a good introduction

#

Of course, the finite element literature is very diverse and a lot of stuff is treated as "lore" for lack of a better word

#

As well as *The Mathematical Theory of Finite Element Methods * by Brenner and Scott

neon snow
#

For what type of functions are finite differences exact?

#

I got the exact solution when I solved Poissions equation with constant driving function

hoary light
#

When you derive a finite difference method, you'll obtain an error estimate for an nth order method that depends on the (n+1)th derivative, by expanding by Taylor series. Therefore it will be exact on functions that are polynomials lower than that order.

solid igloo
#

I want to be on the borderline of analysis and numerical applications, I'm very interested in harmonic analysis. Do you recommend I start at checking out the applications or I start somewhere with the theory? I don't know a good introduction to these topics I like. I hope I can find a good grad school for these things, I'm a late undergrad

sinful wave
#

Start with the theiry

#

I advise you the Rudin's

#

Especially functional analysis

wide spear
#

What background do you currently have?

#

What do you know about the borderline of harmonic and numerical analysis?

#

It's going to be a lot of signals stuff

solid igloo
#

I know the idea that functions with some conditions will be approximated by a "base" of functions like the trig polynomials. Some ideas of completeness, compactness and it's relation to spaces of functions, done a few exercises (baby rudin). The introductory ideas of measures, convexity, Lp spaces, but not details (Papa rudin first few chapters).

I like Rudin style because by not having the middle steps I can realize I lack preparation fast enough to review. Plus he seems to have done some harmonic analysis, in his YT lecture he mentions the vibrating string problem

wide spear
#

Ok I see

#

A lot of the ideas in Fourier analysis are incredibly exciting but in my opinion, modern harmonic analysis doesn't quite have that same wow factor

#

Not to discourage you or anything

#

Just keep on learning

solid igloo
# wide spear Not to discourage you or anything

I can see it, exactly those things I want to figure out. There's some parameters I'm looking for, I'm quite pragmatic. I love Math when it gives insight with simplicity to difficult topics in nature, or engineering, and when algorithms to solve the problem come as a result that's cool too

fathom rain
solid igloo
hoary light
frozen nest
#

can someone check my work for a linear programming problem using Big -M method?|
I need to fully solve the problem below

wide spear
#

(are you going to show your work)

frozen nest
#

It would be unbounded right? cause the column of x3 in tableau 2 doesnt have any valid options for the ratio

solid oxide
#

Hey guys, im trying to figure out an error in my bfgs function in python but ive tried a lot and im running out of ideas, any tips would be extremely helpful in debugging

wide spear
#

Do not post the same thing in multiple channels

solid oxide
#

for context i have two matrices A and b of size (2,2) and (2,1) respectively and an init x vector of zeros

#

I apologize for that but often I dont get a reply in the other channel, infact I never have

wide spear
solid oxide
#

alright

pine jettyBOT
#

squirtlespoof

wide spear
#

How does Z depend on s and t

bright palm
#

Hello, I'm being asked in an assignment to derive backwards Eulers method as an r-step method, and I'm having a hard time discerning the exact process.

#

I feel dumb since I'm given the step

#

I'm not sure I follow the second part of the process though

#

why are we using the derivative of the LIP?

#

and why r+1?

#

I believe r-step methods are Adams methods, if thats helpful to ring bells

bright palm
#

spend some more time on this problem and i think im now more confused

#

could really use some input or guidance

#

๐Ÿ™

solid oxide
#

Is this the correct place to ask optimization related questions?

wide spear
#

Conceptual questions about optimization, sure

#

Implementation questions, no

bright palm
#

but thanks to readers

wide spear
bright palm
#

I do have a more general question though ๐Ÿ˜„

#

Well i think I know the answer my teacher wants but it has me thinking

#

If you have the method $U^{n+2} = 3U^{n+1}-2U^n$ where $U^n$ is the numerical approximation at some time t_n

pine jettyBOT
#

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

bright palm
#

and given a couple of initial conditions

#

it doesnt seem like the method has dependence on step size? or maybe im just missing it

#

I'm prompted to comment on what this method says about convergence and consistency but i cant really determine what to say as I think both of those things are defined with relation to the step size

wide spear
#

Your method should depend on the step size

bright palm
#

here is the original linear multistep

#

were told to apply it to the trivial IVP $u'(t) = 0$ with $u(0) = 1$

pine jettyBOT
#

jan Niku

bright palm
#

i think this removes dependence on step size?

#

but i wouldnt be surprised if im misreading it

#

they propose this

#

idk sorry if this is a dumb question too

#

just struggling to wrap my brain around consistency and convergence in general, and this problem itself is really confusing

#

is the time step dependence hidden in the U^n?

wide spear
#

What is k

bright palm
#

step size

#

but f is just 0

#

so you dont pick up any k's

wide spear
#

Oh right

#

This makes sense

#

If u'(t)=0 then u(t)=u(0)

#

Which you can see this method does exactly

bright palm
#

but im not sure, are you just burying the time step inside of your approximations?

#

like, when you are making an approximation you still have a time for it, even if the method is independent

#

so here we'd actually do better if we took really big timesteps, if this interpretation makes sense

bright palm
#

theyre saying if c_2 isnt 0, what does this imply about consistency and convergence

#

thats where im sorta tripped up

#

it almost seems like backwards consistency

#

or maybe backwards convergence, as your step sizes grow to infinity your global error shrinks

wide spear
#

Wait they propose that form of U^n for what

bright palm
#

lemme just post the whole question

#

im getting to that, if c_2 isnt 0, then you have U^n = c_1 + 4nc_2

#

if the time step is buried in the U^n, like we are just deciding how far apart these things are because the method reports the same regardless, then we would want to just set step size as big as possible

wide spear
#

Ok so what if U^1 is not 1

bright palm
#

if c_2 isnt 0, it wont be, i think

wide spear
#

What if U^0=c_1 and U^1=c_0+c_1

#

Or whatever

#

What do you get for U^n

bright palm
#

right

wide spear
#

You should get that expression

bright palm
#

it depends on how many steps youve taken, and how big c_2 is

#

but youll begin to drift from 1

wide spear
#

Yes

#

You want to show that your recurrence relation gives that explicit form

bright palm
#

of U^n=c_1 + 4nc_2 you mean?

wide spear
#

Yes

bright palm
#

i have that in the write up

wide spear
#

Ok so if c_1=1 and c_2=0 then everything is good

#

What happens if they aren't

bright palm
#

what happens in the very first step is up to c_1

wide spear
#

What happens after

bright palm
#

sorry im not sure c_1 or c_0 in your set up

#

the problem uses c_1 and c_2

wide spear
#

Oh that should be a c_2

#

Anyways

#

The point is that the U^n will diverge from the correct solution

bright palm
#

right

wide spear
#

Is the method consistent

bright palm
#

yea

wide spear
#

What does consistency mean

bright palm
#

oh maybe its not any more once those terms fall away

#

consistency is that uhh

#

locally using an approximation wont pull you far away from the correct path

#

given that you take smaller and smaller step sizes

wide spear
#

Consistency means that local truncation error goes to 0 as step size goes to 0

#

Does the local truncation error go to 0

bright palm
#

sure

#

i guess i was trying to interpret the definition ๐Ÿ˜… lemme check

wide spear
#

||the method is not consistent||

#

Consistency + stability => convergence

#

Or something

bright palm
#

right

wide spear
#

Or you can argue that consistency is a necessary condition for convergence

bright palm
#

how are you reading off the lte?

wide spear
#

What is U^n+1 - U^n

bright palm
#

in terms of their proposed solution?

wide spear
#

In terms of the recurrence relation

#

Well

#

Really the point is that the local truncation error does not vary in the step size

#

Right

#

Because the numerical scheme does not vary based on the step size

#

So it cannot go to 0 as the step size goes to 0

bright palm
#

hmm okay

#

and its not convergent

#

this seems like a poor problem to demonstrate these concepts

bright palm
#

like your proposed relation either is just the exact actual solution, or its neither consistent or convergent, if u is a constant

#

maybe that makes it a good problem, idk

#

thank you for the help ๐Ÿ™‡โ€โ™‚๏ธ

solid oxide
#

Is this the correct answer for the convex conjugate of 1/2||y-b||^2

upper pecan
wide spear
#

What does a signed distance mean

warm otter
# upper pecan hey all, im trying to find any sort of resources on modifying this numerical app...

https://arxiv.org/abs/1403.1937 you can actually approximate the eikonal equation by solving a certain schrรถdinger equation which gives a fast algorithm

upper pecan
upper pecan
wide spear
#

So what do you want to change

#

The n(x) function?

#

The wikipedia article says in the "Physical interpretation" section that if f=1 then this already corresponds to the signed distance function

hoary light
#

Effectively you convert the problem into a nonlinear hyperbolic system where the characteristic curves of the PDE are the distance paths

#

There is no modification of the general Eikonal solver needed, as SDF is a special case as pointed out in the article

#

Because characteristics won't turn very much, fast sweeping method is often preferred

upper pecan
# hoary light There is no modification of the general Eikonal solver needed, as SDF is a speci...

interesting ok. im using the fast sweeping method i believe - yea the problem im having is right at the "zero crossing" (or "interface", as it is sometimes referred to in the literature), where a cell with a positive value might read from and take a value from a neighbor cell whose value is negative (or vice-versa). so there is this strange sign flipping behavior that is leading to artifacts that propagate after more iterations. ive seen this problem mentioned briefly in papers, but im not sure how to solve it. could definitely be something with my implementation i suppose

hoary light
#

Yes, this is a classic issue. The first thing to ensure is that your discretized derivatives always use upwinding; in other words, your finite difference should always point outwards from the surface. Second thing is that you have to have some pixels that are already initialized to the true distance, and you hold those constant. If you're given the surface that you're trying to find the signed distance, you want to first find all the pixels that the surface passes through, and compute a high-accuracy distance value for those pixels that touch the surface. Those pixel will be like your initial condition, and then you'll emanate outward from those pixels to find the distance further and further away.

upper pecan
#

so basically recompute the actual SDF for boundary pixels?

#

before running FMM?

upper pecan
hoary light
#

it's about looking at which direction the distance is increasing

#

so for each pixel you check whether the adjacent pixel values are larger or smaller than the middle pixel

#

it might be easier to look up upwinding and the references will explain it better

median musk
#

i was told to ask for help on this here

proper valve
#

Absolutely not the place for this

#

@median musk

median musk
#

since this is where i was told

#

i just want help

proper valve
faint ferry
#

Working on $(...(x_1 \oplus x_2)\oplus x_3) \oplus x_4)...\oplus x_n) = x_1(1+\epsilon_1)^{n-1}+x_2(1+\epsilon_2)^{n-1}+x_3(1+\epsilon_3)^{n-2}+...+x_n(1+\epsilon_n)$

pine jettyBOT
#

Maxerature

faint ferry
#

I'm stuck at one point:
$x_1(1+\epsilon1)(1+\epsilon{1,2})+x_2(1+\epsilon2)(1+\epsilon{1,2})$

pine jettyBOT
#

Maxerature

faint ferry
#

I'm trying to equate epsilon 1 and epsilon 2 to epsilon 1,2 so that I can have it simply raise (1+epsilon i) to the next power, but I'm not sure quite what to do
This comes from adding x_3
Where epsilon 1,2 is the error from rounding the sum of x_1 and x_2 to be a float

faint ferry
#

Why must Trefethen exist?

wide spear
#

Ummm

hoary light
#

I feel like there is something missing in your error analysis. Normally when you add x_1 and x_2, the model for floating pt error looks like fl(x_1 + x_2) = (x_1 + x_2) * (1 + eps_1)

proper valve
exotic pewter
#

Does anyone have good sources on error bounds when one tries to sample from a gaussian but only has limited precision, whether that be via rounding or just general pseudorandomness?

#

I have a markov chain with some stationary distribution, to have that stationary property it is quite important that I have the exact transition probabilities, but I can unfortunately just approximate those with limited precision, how do I guarantee that my chain doesn't drift away in distrubition too far from what I wanted it to be

#

(Well the stationary distribution is the gaussian distribution)

hoary light
#

This is a very interesting question, I have not considered this! In general it can be very difficult to study the actual error distribution due to floating point arithmetic. Of course one can use a worst-case bound (error increases by a factor of 1 + eps for every operation) but in practice error is neither monotonic nor random.

#

If you know the precise algorithms used to compute the quantities you're using, it may be possible to make some decent estimate, but I'm not sure.

exotic pewter
#

well the markov chain I have works in theory like this

Initialize w_0 to be standard gaussian

go to state w_0 + 1 with probability p1(w_0)
go to state w_0 + 0 with probability p2(w_0)
go to state w_0 - 1 with probability p3(w_0)

repeat from here

the distribution of the new state is also standard gaussian. the probabilities pi(w_0), are calculated with some infinite series whose result is most likely algebraically independent from w_0. you can efficiently approximate pi(w_0) in polynomial time with some epsilon error.

odd wave
#

Hello! I have been browsing the internet for a while for the answer for this question, but can't really get a satisfactory answer. It might have to do something with my limited background in stats + prob. But here goes:
How to you obtain samples from an n-dimensional distribution (like n-dimensional gaussian, or 3D gaussian + 2D exponential + 3D beta) of known form?

wide spear
#

Well maybe the people there would disagree with me, but sampling is explicitly mentioned in the channel description for it so

odd wave
#

Thank you!!

brave crypt
#

For the Euler method, how to determine the appropriate h size?

#

Suppose, I have this equation:

#

Then how I should determine, what will be the appropriate h size?

wide spear
#

Have you tried any h values?

brave crypt
#

Yes, I have.

#

h = 0.1

#

The value for that is 1.1.

wide spear
#

The value for what

#

x at t=1?

brave crypt
#

I apologize.

#

At t = 1.0 the value of x is 1.1.

wide spear
#

Is that approximately correct?

brave crypt
wide spear
#

What happens if you reduce the step size

#

Alternatively, can you solve the ODE analytically

brave crypt
#

The solution through wolfram I am getting is:

cold heath
#

is anyone here familiar with stochastic gradient descent

brave crypt
#

+ask

wide spear
#

I have a 6x6 matrix A and I solve Ax=b many many times for different b each time

#

Is it best to do LU for this

#

Or do the small problem size make things wonky

#

Like inverting A is optimal or something

#

Or should I do something where I precompute the L and U

#

Well that would be strictly better than doing LU each time

#

Actually

#

What happens if I am instead doing linear least squares on Ax-b

#

I guess precomputing the QR decomp is optimal

#

Or maybe SVD?

hoary light
#

For pure speed, probably just precompute and store LU, and then solve via applying lower and upper triangular. QR and SVD will be more numerically stable but can never be faster

wide spear
#

Sure but for such a small matrix

#

Like does the LU overhead outweigh inverting the matrix and doing the matrix-vector product

#

I agree that precompute L and U is optimal for large problem sizes

#

But it seems that mysterious things happen for small problems

#

I have some code where it is faster to compute the determinant of a 3x3 matrix 3 times than solve Ax=b for A a 3x3 matrix

hoary light
#

If you are concerned about it you can check the flop count. I know that both methods have a leading term of n^2 but I agree that for small n, the linear terms in the complexity come into play

#

In general, even for small matrices, instability can arise if you don't use the nice algorithms.

wide spear
#

Yes of course

#

I do not think the matrix in question is terribly ill conditioned though

hoary light
#

But the thing is, using two triangular solves really is nearly just the same cost as multiplying by a dense matrix.

wide spear
#

My matrix is well conditioned

#

The condition number is 30

cursive terrace
#

Hi, I am trying to solve an integral of the following type:

#

In general, this is a 4d integral. But I can use the delta function, and integrate along the curve e_k=mu to reduce it into a 2d integration. Right now, I am not sure about the limits. Any help is appreciated

hoary light
#

what is e_k?

drowsy flame
#

Is this the right channel to ask about bicubic interpolation? If not, what is?

wide spear
#

If it's a theory question, sure

drowsy flame
#

In that case, and to avoid reposting, I'd like to point to my questionion in #help-3, wether the outer points on cubic interpolations are suppose to be intersected by the graph

cursive terrace
wide spear
#

Does f have some decay that allows this integral to converge

jaunty mauve
#

can someone help me get started with this? I have to find the extremals of fixed end points. I have the euler-lagrange equations, now I dont know where to go from there

woven haven
#

Hey, quick question what precisely is so great about the sinc(x) function? It has a bunch of cool properties but I still can't exactly grasp why all the fuzz about it... I am learning it in the context of spectral methods for PDEs btw

wide spear
#

Do you have an example of where sinc is hyped up

grave spoke
#

It's the Fourier transform of the rect function.

wide spear
#

Itโ€™s also sine with decay

woven haven
#

Apparently it is quite useful in numerical methods for PDEs and signal analysis

wide spear
#

Yes it's useful in signal analysis

#

It is the ideal low pass filter

#

For example, one has the whittaker-shannon interpolation formula

#

I do not use any sincs in my numerical pdes, but I can see how it would come up

woven haven
hoary light
#

The sinc function is the simplest band limited function, meaning a function that has continuous Fourier modes that are at most some maximum value. In this sense, it is a natural basis for representing functions that have some known level of oscillatory behavior.

#

And indeed, the Whittaker interpolation formula gives the precise relationship by which a function can be represented in a basis of sinc functions.

#

One can also interpret the sinc function as the limiting case of the Lagrange interpolating polynomial when the number of samples goes to infinity.

#

Also note the sinc function approaches the Delta function in a distribution limit as the frequency band goes to zero, so once again it is consistent with the relevant theory.

#

The point of using a sinc filter is that it can be used with a finite, discrete set of function values that sample your actual function. If you convolve a function with an actual Gaussian (which is of course another type of approximate identity) then you have to actually do a continuous integral, or in the periodic case resort to using a discrete Fourier transform.

#

Of course there are well known ways to approximate Gaussian filter too; I actually wonder if those end up being nearly the same as some form of sinc filter

woven haven
#

Yeah, that is pretty nice indeed

#

By being a natural basis you mean every band-limited function can be written as a (possibly infinite?) linear combination of sinc functions?

hoary light
#

Yes, see Shannon-Whitaker interpolation theorem

uneven sand
#

Hi there, I'd like to see if anyone would be able to help me get my head around a specific application of maths for trilateration.

I have asked in the general channels as I believed it might be more general, but I have been advised to take it here, though please inform me if I am misdirected.

I am looking to get my head around a specific case of non-spherical volume based trilatation.

Standard trilateration from my research uses multiple beacons physically offset from each other, and the location of an object is determined by overlapping the volumes of the spheres (roughly assuming omnidirectional signal), the surface area where the 3+ volumes overlap is used to determine location.

I am helping make a trilateration system, and known solutions for this kind of system do not use 3+ beacons - they use one beacon, which has 3 orthogonal coils (x,y,z planes) that are all at the same origin - ie you have one beacon with 3 fields. These fields are typically dipolar in volumetric distribution.

To be honest, I've not even fully got my head around the mathematics for trilateration, but I am just looking for any help with philosophically understanding how such an orthogonal setup is able to trilaterate in this arrangement, to not only locate position but also rotation (the recievers have an identical set of orthogonal coils).

wide spear
#

(what is trilateration?)

#

(is it like triangulation?)

uneven sand
#

yes - triangulation uses measurement of angles. trilateration uses measurement of distance.

wide spear
#

Ok I will think about this in the morning

rich hemlock
#

Bit of a random question, but when a computer reads a binary number, do they read it from the lowest base unit first and then proceed and interpret the rest of the number successively? I.e. Do they read the "1's" column first, then the 2's then the 4's etc.? (In contrast to how humans read numbers from hundreds to tens to units etc...).
Wildy curious

hoary light
# rich hemlock Bit of a random question, but when a computer reads a binary number, do they rea...

Whether they start from the lowest bit or the highest bit first is hardware-dependent, and is called little endian and big endian, respectively. See https://en.wikipedia.org/wiki/Endianness

In computing, endianness is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most significant byte of a word at the smallest memory address and the least significant byte at the largest.
A little-endian system, ...

dense echo
#

And it's even worse than that, because when data are transmitted over a serial channel that can transmit only one bit of a time, the choices of bit endianness within one byte and byte endianness within larger integers are made independently of each other at completely different levels in the design, and end up being opposite in roughly half the cases.

dense echo
#

When Europeans took over the Arabic way of writing numbers, they couldn't preserve both "the ones are on the right" and "the ones come first" (which are both true in Arabic writing), and picked the former.

dense echo
#

(The Arabs had gotten the system from India several hundred years earlier, and the Indians may have learned them from even earlier use of a base-10 positional system in China -- but I don't know whether the scripts they were originally used with wrote words left-to-right or right-to-left, nor whether they also had the ones on the right in numbers).

rich hemlock
# dense echo By the way, it is not universal that human read the larger-value columns first. ...

Haha, I'm well aware of the arab way of reading numbers - I actually speak a little arabic myself :P
Actually, I have a theory that the reason we (the anglo speaking world) read numbers the way we do is because of the confusions that went on when numbers made their way from middle east to europe.
Consider this, arabs read from smallest base to larger base - BUT their numbers are written the same way as english speakers (for example) with the larger base on the left and smaller base on the right AND the arbic language is written right to left.
It makes sense for the arabs to read the numbers from smallest base then.
But when arabic numerals came over to Europe, we read the same numbers written down as the arabs did but we had the tendency to read from left to right, so we started reading numbers from the Highest base going smaller.
How can we prove this?
Well consider the english words for the numbers between 13-19
Quite literally we have:
Thir - Teen - "Three Ten"
Four - Teen - "Four Ten"
Fif(th) - Teen "Five Ten"
etc.
I posit, that a numerical system being read from smaller base going to larger base might actually be somehow more intuitive.
Ultimately, either way is equally as valid as the other, but I think if we read numbers in a smaller to larger base basis we might be better "linguistically" equipped to approach general arithmetic problems.
Imagine the following sum in (normal) large to small base writing:
456 + 789 =
On paper, you would instinctively have to add the last digits of the numbers first and work your way "upward" because of the rounding factors. Doing so on physical paper might sometimes lead you to have to estimate how far past the equals sign you can start writing as you'll have to start writing backwards as you make your calculation.
If however we used Small to Large basis, we could start with the first digits and start writing immedietly after the equals sign!

wide spear
#

(getting off topic)

rich hemlock
#

Hense, the reason I'm so interested in computational Endianess is because I'm wondering if there is some form of "natural"(natural in the sense of mathematical purity) for either small-large or large-small basis of writing numbers. If it is more intuitive for a computer to begin its own algorithm one way or the other, this might be an indication as to whether it really is more intuitive to have a number system that starts from a smaller basis...

dense echo
#

By the time the computer gets down to actual arithmetic, the numbers have already been read in full into RAM, from which they can be accessed in whichever order the algorithm needs them, independently on which order they got there in. If your number is so large that it's spread over several memory locations, little-endian tends to make the address calculations slightly easier for the programmer to keep track on, but compared to everything else you need to keep straight in your head it's a very minor factor.

#

An interesting case among early computers was the IBM 1401 series. It could only do arithmetic on one decimal digit at a time, but had hardware support for chaining several digits together into larger numbers without looping over them explicitly. Nevertheless it stored the numbers in English order, with the "ones" column at the highest memory address. This meant they wouldn't need to be reversed when printing human-readable output, and was no harder for the machine -- it would simply decrement the address counters between digits positions instead of incrementing them.

rich hemlock
#

@dense echo Thats really fascinating and interesting. Thankyou!
I figured as much when it came to the calculation side of things for large numbers (even if the effect is somewhat negligible).
My own area of concern is in the language we use to communicate mathematics. I've actually invented my own hexadecimal number system I consider to more intuitive than both the conventional Hexadecimal and Decimal number systems.
I have been biased to affirm the writing of this system (so far as human reading is concerned) as little endian. Knowing this helps confirm my bias (even if only by a very minor factor).
Thankyou for your help!

solid igloo
#

I'm very interested in Time-Frequency Analysis, someone knows about this?

wide spear
#

Better to ask a specific question

warm otter
solid igloo
small obsidian
#

Anyone knows how to solve a recurring equation such as this?

brave crypt
#

Will the order of Admas Bashforth's 3 order local truncation error be O(h^4)?

hoary light
#

Which definition of local truncation error are you using

pastel gust
#

I'm trying to read about Butcher series but I haven't found anything good on them, any suggestions?

zinc inlet
#

Otherwise, you can unroll the recurrence and find a general solution that way

steep spade
#

Is it possible to have a Universal Turing machine that terminates on any given machine and input?

wide spear
brittle atlas
#

Is there an efficient way to generate random samples of the eigenvalues from the circular random matrix ensembles? (CUE/COE/CSE) Other than creating the matrix and then solving for all the eigenvalues

fathom rain
wide spear
#

If you know what the distribution should be you can just sample right

brittle atlas
brittle atlas
#

it has a sparse matrix model for GOE/GUE which could be interesting for some other computations though

fathom rain
small obsidian
zinc inlet
#

T(n) = 5T(n/b) + f(n) implies that T(n/b) = 5T(n/b^2) + f(n/b) and T(n/b^2) = 5T(n/b^4) + f(n/b^2), etc

#

So T(n) = 5[5T(n/b^2) + f(n/b)] + f(n)
= 25T(n/b^2) + 5f(n/b) + f(n)
= 25[5T(n/b^4) + f(n/b^2)] + 5f(n/b) + f(n)
= 125T(n/b^4) + 25f(n/b^2) + 5f(n/b) + f(n)

brittle atlas
wide spear
#

And presumably randomly generating matrices and finding their eigenvalues is too slow right

brittle atlas
#

That's what I've been doing but it seemed really inefficient

wide spear
#

How are you finding the eigenvalues?

brittle atlas
#

np.linalg.eigvals

#

I wasn't sure if I was missing some standard faster way since making the matrix (which also takes a while) and then computing the evs seemed a bit roundabout

wide spear
#

Ok you can definitely compute eigenvalues faster than that

#

Maybe Sven-Erik knows, but surely there are unitary eigenvalue algorithms that are better than QR

warm otter
wide spear
#

This is probably a nice read

brittle atlas
#

(I am also not very familiar with numerical methods in general)

exotic pewter
#

is there some other way to compute the injective norm of a rank-p tensor other than taking this sup over p unit vectors?
I'm looking for something like in the matrix case, where I only need to use one unit vector to find its spectral norm

shadow sun
reef jacinth
#

Does anyone know/has implemented the pivot algorithm used to find the number of self avoiding walks?

wide spear
#

Do people still use lapack nowadays

hoary light
#

Yes

minor osprey
#

Yeah I think scipy is built on lapack for example

brittle atlas
#

I thought pretty much all matrix numerics is just a wrapper for lapack

#

a physics prof suggested we use fortran for a class assignment

#

so maybe people still use it there

wide spear
#

I was being lazy and trying to get around figuring out the lapack things in c++

wide spear
#

80 years of finite elements

hoary light
wide spear
#

Yeah but like

#

Does [X] supercomputer support this

#

Like they will all have lapack in some form or another

hoary light
#

If you are using a parallel computing platform then there are other options worth considering, but indeed as you say getting it installed could be an issue

wide spear
#

Yes this is for code that will be on some parallel device

#

Oh yeah related, how much does lapack work with openmp and mpi and the like

hoary light
#

Lapack is not designed for any parallel computing paradigms. So you'll have to manually design your parallel algorithm, and then each thread can call lapack routines

wide spear
#

I cry everytime

hoary light
#

With OpenMP this is straightforward, since it's all shared memory

wide spear
#

Oh openblas exists right

#

And cublas as well I guess

hoary light
#

You might want to search for parallel linear algebra libraries

wide spear
#

Life is suffering

#

Why can't scientific computing have any modicum of standardization

hoary light
#

Because the use cases are too varied

#

But libraries like Pardiso, Lapack, Arpack, those ARE quite standard

wide spear
#

Sure but there are a bunch of different lapack implementations floating around, no?

hoary light
#

There's only one original Lapack, but sure people make modifications precisely because they have different use cases

#

Also for different hardware you may need to alter your algorithm

wide spear
#

screams

hoary light
#

The reality is that algorithm and hardware are connected and we're blurring that boundary more as we push the limits of performance

#

Right now we've expanded to different kinds of cores on CPU and GPU, but even that dichotomy will eventually become muddied

wide spear
#

Also does openmp support gpu

hoary light
#

OpenMP is for shared memory CPU multi threading

wide spear
#

This chart seems to indicate that openmp works on gpu though

#
JSC Accelerating Devices Lab

For a recent talk at DKRZ in the scope of the natESM project, I created a table summarizing the current state of using a certain programming model on a GPU of a certain vendor, for C++ and Fortran. Since it lead to quite a discussion in the session, I made a standalone version of it with some updates and elaborations here and there.

hoary light
#

OK then it is my mistake

wide spear
#

Well ok another question

#

How do I pick the parallel framework to use

#

Openmp seems to have the best support for all the different gpus

#

But like you, I am familiar with openmp for shared memory cpu multi threading

#

MPI isn't on this chart so I guess it doesn't support gpu

hoary light
#

I can only suggest what I'm familiar with, which is that if you're using an Nvidia GPU, then I just use CUDA and Nvidia libraries

wide spear
#

My limited experience with cuda has been a nightmare

hoary light
#

The reason Nvidia has a stranglehold on GPU computing is that they provide the most support for their libraries

#

CUDA is very low level but I normally program in C or Fortran so then CUDA becomes very natural

#

I think what you need to decide is how low level you want to go

#

Are you designing low level algorithms in parallel? Or are the "inner" parts of your problem solvable with existing methods/libraries?

frozen nest
#

do linear programming questions go in this channel?
I need some help with part b. Is it safe to say that since x5 and x6 (slack/surplus variables) are not zero in the optimal solution that that are not binding constraints?

pine jettyBOT
#

Gabriel Yanci

wide spear
#

No this is not the correct channel, and do give #latex-help a look as well

plucky kayak
wide spear
#

Many people

#

Do you have a specific question?

random canopy
tame pivot
#

Hi! Got a question that I'm struggling with. I have managed to solve a) and b) but am stuck on c). Would anyone be so kind and help explain this to me? See question in image.

wide spear
#

Ok so why does this trick work

brave crypt
#

Hi

tame pivot
#

because in binary, the trick turns out in the value 00000000001, where last digit is one and number of zeros is depending on float point precision. Can't figure out the math for ternary base though

wide spear
#

And because 4/3 cannot be represented exactly right

tame pivot
#

Yes

wide spear
#

Can 4/3 be represented exactly in a ternary system

tame pivot
#

No

#

I am not too confident in ternary math. Not sure if it still turns out to be a 1 in the last digit or not though

wide spear
tame pivot
#

In ternary, I get that 4/3dec = 11/10tern = 1.1tern, and 1.1 is not exact

wide spear
#

Why isn't it exact

tame pivot
#

I guess I thought it couldn't have decimals, but then 4/3 in ternary is exactly represented, and thus the trick doesn't work for ternary?

wide spear
#

Is 3/2 represented exactly in binary

tame pivot
#

No

wide spear
#

(yes it is, 1.1)

tame pivot
#

Oh, okay.

#

Then I guess 4/3 in ternary is also exact and c) doesn't work.

wide spear
#

Yes

tame pivot
#

Okay, I think it was my understanding of exact representation that tricked me up. Thanks a lot ๐Ÿ™‚

tame pivot
#

Trying to figure out how many digits I need to know in PI in order to calculate sqrt(PI) with 4 correct decimals. Current thinking is I need 8 digits as I need 0.5*10^-t < 10^-5 where t is number of digits, and base is 10 for it to hold true. Am I correct here? As t=8 would make the expression less than 10^-5

fathom rain
tame pivot
#

Okay. So then 8 digits would be correct then? Just using a calculator, I get the same four decimals using less than 8 digits, however that wouldn't be guaranteed to hold true for any given value?

fathom rain
#

well if you have "round to even" and you want 3.1415 you would need to get one more digit correct to get the five so I assume 9 or 10 digits might be needed then (I have not looked at it, but it would be my intuition) (and since it is 3.14159 it might be rounded to 3.14160 and so on)

tame pivot
#

Okay. thanks! I think I got it

fathom rain
#

just think 0.999999999999999999999999999999999998 an get correct 4 digits, 0.9999 you would need a lot of digits of accury or it would just round to 1.0000

#

https://en.wikipedia.org/wiki/Unit_in_the_last_place might give something? I do not know much about this stuff

In computer science and numerical analysis, unit in the last place or unit of least precision (ulp) is the spacing between two consecutive floating-point numbers, i.e., the value the least significant digit (rightmost digit) represents if it is 1. It is used as a measure of accuracy in numeric calculations.

fresh oxide
#

unless the new intel ones use it

fresh oxide
fresh oxide
wide spear
#

I have received expert guidance that openmp out performs openacc and is competitive with cuda

#

For some problem that I care about

fresh oxide
#

for specific problems that may be the case

wide spear
#

Also better for portability

fresh oxide
#

hmm

fresh oxide
wide spear
forest musk
#

hey, any ideas on approximating the Riemann Zeta function in arbitrary precision arithmetic? I've considered using the Euler product, but it seems to converge very slowly arond s=1. I've been also considering various formulations of the Euler-Maclaurin formulae, but they seem to include terms that make it unfeasible to compute efficiently.
I tried to follow https://www.scirp.org/journal/paperinformation.aspx?paperid=24160, but the series they give requires 120 terms for 9 digits of accuracy, which frankly doesn't seem much better than just using the definition?
Then i looked at https://www.boost.org/doc/libs/1_65_0/libs/math/doc/html/math_toolkit/zetas/zeta.html and the error margin that they give - for 200 digits of accuracy you need around 240 terms of that e_j sequence they give, each of these involving the computation of factorials ~28680 times of numbers up to 250 making it completely infeasible.

wide spear
#

Do you care about riemann zeta for any z in C or just for 1/2+it

forest musk
#

any z where Re(z) > 1

#

the other cases are covered by the reflection formula which I have implemented already.

wide spear
forest musk
#

I will take a look at it in a second

fathom rain
amber briar
#

Is this the place for linear programming?

wide spear
#

Sure

amber briar
#

Ok it's a longish question but I have some linear programming on my algorithms HW and I am not sure how to formulate this LP

pine jettyBOT
#

Spamakin๐ŸŽท

wide spear
#

Do you have any ideas

#

Or completely lost

amber briar
#

Kinda completely lost since we haven't really covered LP in class

wide spear
#

Ok

proper valve
#

Well first what's an LP?

#

Write it in TeX if you can

amber briar
#

It's this

#

I mean I'd just end up typing that out

#

but basically you have some function you want to optimize

proper valve
#

I actually don't know how to write an inverted $\Pi$ o,o

amber briar
#

given a set of constraints

#

I don't either lol

pine jettyBOT
#

่‰w

wide spear
#

Ok

#

What are the constraints you have

amber briar
#

so I want to maximize a single value of a vector essentially

#

I think that's the hard part

wide spear
#

And what are you trying to maximize

proper valve
#

\begin{aligned}
\max \quad& c \cdot x \
\text{s.t.} \quad&\begin{aligned}[t]Ax &\leq b \ x &\geq 0\end{aligned}
\end{aligned}

pine jettyBOT
#

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

amber briar
#

Well one constraint is that since I'm trying to maximize the minimum value, call it x, of aM, x should be less than or equal to (aM)_j for all j

wide spear
#

No

amber briar
#

but that's very self referential

#

oh?

proper valve
amber briar
#

I guess yea but writing it more mathematically doesn't get rid of this self referential issue

proper valve
#

Self-reference isn't a problem in math

wide spear
#

That is not the constraint in this

amber briar
#

?

#

Well I guess another one is that all the values in a have to be non-negative and sum to 1

wide spear
#

Yes

#

That is the constraint

amber briar
#

Is that the only one?

wide spear
#

I mean

proper valve
#

Is there any other?

wide spear
#

That is actually n+1 constraints right

amber briar
#

Well yea but like

proper valve
#

I suppose your question might be, does every simplex define a probability?

amber briar
#

Cause I want to maximize the minimum of this vector

proper valve
amber briar
proper valve
#

\begin{aligned}
\max \quad& x \
\text{s.t.} \quad&\begin{aligned}[t]x &\leq (aM)_{j} &\forall j\ x &\geq 0\end{aligned}
\end{aligned}

#

So this is what you have now, yes?

amber briar
#

I'm not given a

#

I need to find a

pine jettyBOT
#

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

proper valve
amber briar
#

The values of a?

proper valve
#

That is not all the decisions

#

A decision variable is staring at you

#

So it's best if you see it soon

#

$$f(x) = \begin{aligned}[t]
\max_{a} \quad& x \
\text{s.t.} \quad&\begin{aligned}[t]x &\leq (aM)_{j} &\forall j\ x &\geq 0\end{aligned}
\end{aligned}$$

pine jettyBOT
#

่‰w

proper valve
#

I will change the writing as much as you can recognise what you need to do in the LP

amber briar
#

I don't see how a is a decision since that's what I'm trying to actually find

proper valve
#

Well seems like I stepped ahead without you noticing

proper valve
amber briar
#

also max isn't necessarily linear so I don't quite think that's valid?

proper valve
#

\begin{aligned}
\max \quad& c \cdot x \
\text{s.t.} \quad&\begin{aligned}[t]Ax &\leq b \ x &\geq 0\end{aligned}
\end{aligned}

pine jettyBOT
#

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

proper valve
#

Is it $c$? Is it $A$? Is it $b$? Is it $x$? If it is none of these, then what?

pine jettyBOT
#

่‰w

proper valve
amber briar
#

the output of the thing you wrote, assuming you're given c, is x such that c.x is maximized

proper valve
#

The output is an objective value, a single element of $\mathbb{R}$.

pine jettyBOT
#

่‰w

proper valve
#

We write the objective value as
$$Z = \begin{aligned}[t]
\max \quad& c \cdot x \
\text{s.t.} \quad&\begin{aligned}[t]Ax &\leq b \ x &\geq 0\end{aligned}
\end{aligned}$$
And its optimal solution as
$$x^{*} = \begin{aligned}[t]
\arg\max_{x} \quad& c \cdot x \
\text{s.t.} \quad&\begin{aligned}[t]Ax &\leq b \ x &\geq 0\end{aligned}
\end{aligned}$$

pine jettyBOT
#

่‰w

proper valve
amber briar
#

right

pine jettyBOT
#

่‰w

amber briar
# pine jetty **่‰w**

comparing it to this, I think the objective value is a real number, the minimum of a and the optimal solution is argmax over all a

#

Is that correct?

proper valve
proper valve
pine jettyBOT
#

่‰w

amber briar
#

The only other decision I guess is the minimum of a but that doesn't really sounds correct

proper valve
#

And the minimum of $a$ is ... ?

pine jettyBOT
#

่‰w

amber briar
#

min(a) idk?

proper valve
#

$$\begin{aligned}[t]
\max_{a} \quad& \min{a} \
\text{s.t.} \quad&\begin{aligned}[t]\min{a} &\leq (aM)_{j} &\forall j\end{aligned}
\end{aligned}$$

pine jettyBOT
#

่‰w

proper valve
#

??

amber briar
#

Is that not it? (other than the fact that all the values in a are non-negative and sum to 1)

proper valve
#

I suppose it is it, except that we have regressed

#

Rather than progressed

#

By Kolmogorov we have $0 \leq a \leq 1$ and $\sum_{i}a_{i} = 1$, then $\min a = Q$ for some $Q \in [0, 1]$, is this fine?

pine jettyBOT
#

่‰w

amber briar
#

yea that's fine

proper valve
amber briar
#

So my understanding of a linear program is that the function we are trying to optimize must be linear right?

proper valve
#

Linear in what

amber briar
#

i.e. f(x + y) = f(x) + f(y), f(cx) = cf(x)

#

the arguments?

proper valve
#

No, I'm not asking for the definition of linearity

#

Is $\min_{x} y^2x + yx + 1$ linear?

pine jettyBOT
#

่‰w

amber briar
#

yes

#

uh

#

Yea I think so

#

well the x that minimizes the first term may not be the x that minimizes the second term

proper valve
#

$$Z = \begin{aligned}[t]
\max \quad& x_{1} \
\text{s.t.} \quad&\begin{aligned}[t]Ix &\geq [1, 2] \ x &\geq 0\end{aligned}
\end{aligned}$$

pine jettyBOT
#

่‰w

proper valve
#

Is this linear?

#

I is identity matrix

#

[1,2] is a 2-member vector

amber briar
#

I think so?

#

with respect to scaling sure, with respect to addition not sure

proper valve
#

For $x\in\mathbb{R}^2, y\in\mathbb{R}$, $e = [1, 1]$,
$$Z = \begin{aligned}[t]
\max_{x,y} \quad& y \
\text{s.t.} \quad&\begin{aligned}[t]ye &\geq [1, 2] - Ix \ x &\geq 0\end{aligned}
\end{aligned}$$

pine jettyBOT
#

่‰w

proper valve
#

Is this linear?

proper valve
amber briar
#

I've got no idea

#

also I have to go,sorry. Agreed to meet up with a group for another class ๐Ÿ’€

#

I do appreciate the help, I'll try this on my own some more

proper valve
amber briar
#

and worst case, office hours are on Monday

proper valve
#

You already have the answers

amber briar
#

yea I'll try to figure it out later

proper valve
#

And the modelling required

amber briar
#

It doesn't feel like I do ๐Ÿ’€

proper valve
#

Just to check

#

What textbook are you using

proper valve
#

The book doesn't have LP

#

Wtf

amber briar
#

These are just my prof's notes

#

For the HW we don't necessarily have to know how to solve the LP

#

we just have to formulate it (and it's dual) and some easy interpretations

proper valve
amber briar
proper valve
#

I recommend finding a textbook on LPs, like Vanderbei, Matousek, Bertsimas or Luenberger

amber briar
#

I may take a full course on it in a future semester

proper valve
amber briar
#

Oh cool

#

Yea I'll look at all this again later

#

thanks for helping

neon snow
#

Is there a neat way to create this matrix in MATLAB?

#

I can create it with loops ofc but it's close to the Laplacian Operator Matrix

wide spear
#

Where do the ones switch to twos

neon snow
#

That you get with:

n = 5;
I = speye(n,n);
E = sparse(2:n,1:n-1,1,n,n);
D = E+E'-2*I;
A = kron(D,I)+kron(I,D);
neon snow
wide spear
#

If you can make the laplacian matrix, can't you just modify that to get what you need

neon snow
wide spear
#

There probably is a smart way, but it'll take more time to figure out than just working out the indices

neon snow
#

Haha ok :p

#

Thanks โค๏ธ

neon snow
#
n = 4;
I = speye(n,n);
D = spdiags([repelem([1;2],[n-2,2]), -2*ones(n,1),repelem([2;1],[2,n-2])], -1:1, n, n);
A = kron(D,I)+kron(I,D);
wide spear
neon snow
#

It looks correct I think

neon snow
#

The first upper diagonal is wrong

#

Big sad

neon snow
#

Solved it!

wide spear
wide spear
#

Is there a way to make openmp work correctly with function calls

#

Like I roughly have this code

#
function {
    stuff to do in parallel
}

main {
    function(stuff) // but only call the function once
}
#

If I just throw everything in a pragma omp parallel then each thread calls function independently

#

But if it is in a pragma omp serial section then the pragma omp parallel for inside function does not get parallelized

proper valve
#

Are the inner pragma omp parallels in function // stuff to do in parallel not being parallelized?

wide spear
#

They are not if it gets wrapped in a pragma omp single

#

They also arenโ€™t if it does not get wrapped in a single section because each thread calls the function independently and does itโ€™s own thing

fresh oxide
#

does anyone know how one could find the variance of convolution of f and g?

#

or just the variance of a DFT(f(x))also works

wide spear
#

Are you asking for specific code/libraries

fresh oxide
#
k_f = jnp.fft.rfft(self.kernel(seq_length), axis=-2)
u_f = jnp.fft.rfft(signal, axis=-2)
y_f = k_f * u_f

I have y_f and i need to find its mean and variance for layer norm

fresh oxide
wide spear
fresh oxide
#

any channel for fourier analysis stuff?

wide spear
#

What type of Fourier analysis

fresh oxide
wide spear
fresh oxide
#

so we need expectation and variance of the original signal (without inverse fft) and pooling methods, and adding bias term (bias is already done tbf)

fresh oxide
amber briar
#

has anyone here used Gurobi?

#

is there a way to do stuff symbolically?

exotic pewter
#

Does anyone know what nnz means here?

fathom rain
exotic pewter
#

thanks

untold shale
#

Hi, is anyone experienced in derivative pricing. I see a potential opportunity that but I find it hard to believe because its so trivial and Id like to get someones input on it

pine jettyBOT
#

h_vitalikkk

narrow sable
#

Hello, I have written my question ๐Ÿ™‚

wide spear
#

Consider latex-ing it instead

plucky kayak
#

anybody familiar with proximal gradient descent? having a bit of trouble understanding what's the iteration and why mine's diverging

hoary light
#

I'd like to hear if you eventually get any insight. Never got around to doing my "homework" learning about proximal methods.

sleek sundial
#

I dipped my toes into ILP yesterday, and Iโ€™ve got some questions.
I used python with ortools to solve instances of a combinatorial problem. ||Calculating terms of OEIS A357357, if youโ€™re curious.|| In the most obvious formulation (which I used), the problem has an nxn grid of binary variables, two very sparce constraints per each of them (comparing each to its neighbors), and four very dense symmetry breaking constraints for the whole problem. After finding the optimal solution of the ILP, I check whether it satisfies some global properties, and if it doesnโ€™t, I add more constraints and run the solver again. The case of n=12 took ~2.5 hours to run, and n=13 I have left overnight, it has been going for at least 9h already and itโ€™s still not finished. I wonder if there are tricks for making ILP go faster? Because I donโ€™t think 169 variables should stump it like that. A way to have the solver remember the previous, laxer versions of the problem, instead of having to resolve it from scratch after adding a couple new constraints?
Btw, what is better as a rule of thumb: lots of sparce constraints, or several very dense ones?

wide spear
#

You'd need to write your own solver if you want to start based on previous solves

sleek sundial
#

Ewwww

#

That would be a horrible idea lol

wide spear
#

Integer programming is NP complete so

#

Yikes ~~

sleek sundial
#

What abt the many small constraints vs few big ones?

#

Rn my added constraints tend to be huge (as in ~1/3 of the coefficients are nonzero). Iโ€™ve got a couple ideas how to do the same thing with a larger number of sparcer constraints, but have no idea if itโ€™ll help

wide spear
#

1/3rd of 12 is 4

sleek sundial
wide spear
#

Oh well that's larger I guess

#

I would not call that huge

sleek sundial
plucky kayak
#

the integer constraint flonshed

sleek sundial
#

๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚

plucky kayak
#

perhaps try some other solvers like cvxpy or others just in case

proper valve
sleek sundial
sleek sundial
proper valve
#

What's your formulation by the way, and the column generation rules? I'm not sure because it doesn't seem obvious to me

#

169 combinatorial variables might be an issue, though 169 linear variables definitely isn't

sleek sundial
# proper valve What's your formulation by the way, and the column generation rules? I'm not sur...

Sorry, I was in uni. Yeah, so, the objective is to find the largest induced cycle in a square grid graph. So I create a boolean variable for each vertex that signifies whether it is a part of the cycle or not. And the solver has to maximize their sum. Then I add two constraints for each of them. First constraint is 2*cell + sum of its neighbors <= 4, which ensures that no 1 neighbors more than two 1s, and the other is 2*cell - sum of its neighbors <= 0 which ensures that no 1 neighbors fewer that two 1s. This MIP also permits solutions in the form of multiple induced cycles. As I need only one, after getting a solution I find all the connected components and for each one add a constraint sum of its cells <= number of its cells to prohibit these small cycles.
Usually after 15-20 such iterations it converges to a single cycle. The issue is each iteration takes way too long.

#

On second thoughts, yeah, it might not have been so obvious after all ๐Ÿ˜‚

sleek sundial
#

Oh, yeah, I got back home, and a(13) has finally finished calculating. Took it only 16 hours ๐Ÿ˜ˆ

#

12 iterations

wide spear
wide spear
#

@fathom rain so on lagrangian discretizations

#

You know how for the euler equations you have $\pdv{\mathbf{u}}{t}+(\mathbf{u}\cdot\nabla)\mathbf{u}=-\nabla p$

pine jettyBOT
#

ๆขฆๅขƒๅ€’ๆต

wide spear
#

You can alternatively write this with the material derivative as $\frac{D\mathbf{u}}{Dt}=-\nabla p$

pine jettyBOT
#

ๆขฆๅขƒๅ€’ๆต

wide spear
#

And then the way you discretize this is by considering moving fluid elements

#

So instead of a fixed grid where you have the pressure and velocity at each grid cell, you consider a moving fluid "particle" where you keep track of its position and pressure

#

The advantage of this is that you don't have a CFL condition

#

You also get a lot of conservation properties for free

#

I am currently working on some fluid equations on a sphere for geophysical fluids

#

And in this case you can do some cool things with biot-savart integrals

fathom rain
#

any open source codes using this?

wide spear
#

No clue

#

I am not working with any existing codes

fathom rain
#

i just have never heard of this type of discretization (i have mostly worked with aerospace codes, and i know some geophysics stuff that people do)

wide spear
#

It's definitely less popular than grid based discretizations

#

And like for aerospace codes, you want a pre-determined grid because you are doing fluid structure interactions

fathom rain
#

is this related to particle in cell methods?

wide spear
#

Yeah it's sort of a similar idea to particle methods

#

One of my advisors has done a lot of work on fast summation techniques for things like n-body

#

So some current work is towards applying fast summation to these techniques

fathom rain
#

fast multipole?

wide spear
#

Yep FMM and tree codes

#

Of course we want a kernel independent method

fathom rain
#

sounds fun, good luck

grave spoke
#

Have you worked with Arbitrary Lagrangian-Eulerian discretizations?

wide spear
#

My advisor during undergrad worked with them for some FSI problems

#

I have not though

grave spoke
#

Ah, I see

minor osprey
#

Okay, complete shot in the dark here, but I'm writing on continuous models in machine learning right now, and I'm a bit puzzled how this loss functional is written because it's just missing the labels so I'm not sure where they should go. It should be f(y,x;\theta) where \theta is the parameters right?

#

If it's not, I am confused about where y should be

#

Some more context, this is modelling a loss functional for a supervised learning scheme

random canopy
#

given the usual risk formulation, I assume that f*(x) should be the y corresponding to x

minor osprey
#

Right because we have potentially noisy data we are approximating with f

random canopy
#

ye

minor osprey
#

Okay so this exactly like the continuous formulation of image processing problems ๐Ÿ™

#

This is from the paper I was telling you about a while back

#

Finally getting around to look through it more closely

random canopy
#

ye it's a general form for (parameterized) risk minimization which is used all throughout ml

#

I should read that now that I have more time on my hands lol

#

more-ish

minor osprey
#

Yeah, I don't have too much time, but I'm making do

spark trout
#

I would like to ask is there any connection between polynomial Newton iteration and Newton Raphson approximation

plucky kayak
#

you mean newton polynomial interpolation?

upper cape
#

is the Jacobi method convergent for all norms if the spectral radius is smaller then 1?

sleek sundial
#

Does anybody know what would be a good set of symmetry breaking constraints for a MIP on a torus square grid, and, more importantly, how many of them you can use? Right now Iโ€™m using the sum of values of the zeroth column and row is the smallest for the shifts, and left and top halves of the grid sum to a value less than their corresponding counterparts for the reflections. But itโ€™s still ridiculously long, and I can see that not nearly enough symmetry is broken. How can I do better?

grave spoke
sleek sundial
idle quartz
#

Can someone explain why solving the navier stokes equation numerically is complicated? (From an FEM pov) i understand the LBB condition but I was wondering if there is more to it

wide spear
#

Nonlinear, CFL condition, turbulence

idle quartz
wide spear
#

Do you mean the linearized ones?

idle quartz
wide spear
#

Well, people do finite volume methods for a reason

idle quartz
#

Why isn't that a problem in FVM?

hard escarp
#

Hi. I'm getting into numerical PDEs. Could anyone here recommend me some kind of text with an overall comparison between finite elements versus finite difference methods?

wide spear
sleek sundial
#

Say, I have a group, represented as a list of permutations. How can I find a minimal generating set for this group?

wide spear
#

Ummm

#

(even if you mean computationally)

sleek sundial
#

I mean computationally, but I see your point

wide spear
#

No one who frequents this channel knows how sage works

sleek sundial
#

||Iโ€™m not using sage, Iโ€™m using pyyyyyyython||

wide spear
#

Even then

sleek sundial
#

(Iโ€™m trying to make my MILP work on any graph, not just on grid graphs. And that requires finding symmetry breaking constraints, lest it takes forever)

pine jettyBOT
#

Enoo58

upper cape
#

i manged to prove it

balmy frigate
#

Hello everyone, I hope this is the right place to ask
I'm taking a course on Numerical Linear Algebra this semester, and the teacher gave us the possibility to find some topic/application related to what we've covered in class, and to explain it to the whole class, which is something I'd like to do. Unfortunately I'm kinda short on ideas, and I'm looking for some inspiration, can you help me? In class we've covered

-SVD decomposition
-QR decomposition via Grahm-Schmidt/Householder reflectors/Givens rotations
-Least Squares
-QR algorithm for eigenvalues/eigenvectors
-Iterative methods (specifically Krylov methods, Arnoldi & Lanzcos, Conjugate Gradient)
-We've begun randomized methods

If you maybe know some cool application or stuff related (for instance a classmate of mine is doing Principal Component Analysis, whatever that is), I'd be glad if you could share it with me. Even just the name, or a book and a page, then I can work it out my self, I just have to find a starting point ๐Ÿ˜…

plucky kayak
#

you can look at Stephen Boyd's Intro to Applied Linear Algebra, it's a free book and lectures for the course are also available

#

though the book focuses more on least squares than other things, but the examples there are still nice

#

probably the simplest thing you can look into is solving linear leas squares using QR and advantages of that approach vs the standard normal equations

#

but that's all based on this specific list, all these methods are more suited for the role of tools rather than goals, principal component analysis seems like something that doesn't use either of those (perhaps SVD?)thonk

balmy frigate
#

I don't really know what Principal Component Analysis is, but I've seen it was mentioned in the slides of SVD, so I guess so ๐Ÿ˜…

We've already discussed in class the different methods to solve least squares (normal equations, QR, SVD, Ridge regression), but I'll definitely check out the book you've recommend, thank youpandaWow

wide spear
#

What about multigrid?

#

Or maybe strassen multiplication

balmy frigate
#

More stuff to add to the list, thank you

hoary light
#

Some vague ideas: representing recommendation/categorization systems in terms of sparse SVD. Using eigensolvers (generally iteratively) to find the energy levels in a quantum mechanical system. Using eigensolvers to determine the resonances (and thus the stability) of a classical mechanical system.

faint ferry
#

How fast does power iteration converge if $q_1^Tv^{0}=0$ and $\vert\lambda_1\vert > \lvert \lambda_2\vert > ...$?

pine jettyBOT
#

Maxerature

hoary light
#

Do you know the answer when, instead of that condition, v is generic?

pine jettyBOT
#

squirtlespoof

plucky kayak
#

why use neural network if it's simply a convex optimization problem? thonk

#

depending on the norm used you'll get a different answer, but still

wide spear
#

Lolll

exotic pewter
#

trying to solve this optimization problem with a neural network is like using a plane to drive through the streets

exotic pewter
#

How do you estimate sampling errors when your algorithm relies on distributions that can only be approximated. Does one use some type of coupling argument to make sure the error doesn't deviate too much for example only worse by some multiplicative factor?

idle quartz
#

Any users of FEM software? What do you use? What is a good lobrary?

fathom rain
idle quartz
grave spoke
#

You can take a look at https://ngsolve.org/ too, but yeah, it depends on your goal

#

fenics' documentation needs to be fixed for beginners

idle quartz
grave spoke
#

Maybe take a look at the website

fathom rain
#

I think both fenics and deal.ii has DG also, which is good if you want to do flow problems

idle quartz
#

Dealii has CR and Nedelic but it's weird that they didn't apply elements for 4th order equations

simple vigil
#

Definitely has DG

small obsidian
#

Hi i have this question :
for all numbers $1\leq i \leq n$, $CM[i][i]=0$.

for all numbers $1\leq i \leq n-1$, we have :

$CM[i][i+1]=C[i][i+1]$

$P[i][i+1]=i+1$

for each couple $1\leq i < j \leq n$ such as $j-i>1$, we have :

$CM[i][j]=\min_{i<k \leq j}\left(C[i][k]+CM[k][j] \right)$

pine jettyBOT
#

spanner

small obsidian
#

and i have this starting matrix here and i'm trying to determine CM and P

wide spear
#

Sorry I am not really sure what you are asking

small obsidian
worn night
#

Would questions regarding compressed sensing go here?

plucky kayak
#

perhaps, depends on the question

worn night
#

getting hung up on the details of this question. Like I get for one coin only being counterfiet it would have to be the sixth coin, in this specific sampling

#

more confused about second part

#

like what specifically is it asking me to do

#

like it is literally just asking for me to set up two different scenarios where you'd get a different set of coins being counterfeit depending on what you choose to be 0 in your x?

#

I can send a link to the respective paper if that would help

plucky kayak
#

I guess it means that i-th column of ะค represents i-th coin and if x_i is the deviation from nominal value of i-th coin from nominal value, then the solution to ะคx=b would represent counterfeit coins and how many of them based on sparsity of x?

#

so the question is about finding the solution to this system if all, but 1 entry of x is zero, then showing that if there's two counterfeit coins (so 2 entries in x are non-zero) then there would be many such pairs satisfying the system?