#numerical-analysis
1 messages ยท Page 2 of 1
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
Same for me. But then the thing I said earlier about O(t^5) becoming O(t^4) because the term vanishes and the you divide O(t^4)/t=O(t^3) is incorrect?
Then the thing you wrote above should also end up with O(t^3) right?
since you leave O(t^4) since those term vanish, and then divide by t leaving O(t^3)?
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)
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)?
So the time part is wrong?
In my solution
yes
Got it. Thanks a lot for your help!!
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!
Umm, I have 1 last question. At the end they say. Should't the order be determined by the big O?
Oh oops, I got confused about order too. The order is based on global (cumulative) truncation error, which is that first term you have. The O(h^4) is the local truncation error
I haven't taken numerical analysis in over a year so I'm a little rusty, sorry about that.
Crystalloid
oh man wish i understood stats more. im not sure this is the place to ask, maybe #advanced-probability ?
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
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
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?
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
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
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
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
yeah this is a toy system
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)
I guess then it looks right, assuming e=0 is special
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
Angetenar
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
Hello problem haver
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
Angetenar
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
This sounds really awful
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
Are they all in the same eighth of the sphere
Where you do some cross products and stuff
This also doesn't work
It still says that the point is in the triangle
Who knows how to spell 8th
The triangle is 1/20th of a sphere
It's the face of an icosahedron
You can see the plot I sent above
I guess it isn't very good
Yes
Im trying to think about projecting onto the plane normal to the center of the triangle
But i don't think this works
Converting to lat lon coords and then checking is an option but then you get poor behavior near the poles
Because the question is "which center"
Ah
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
Is it nonsense that this should be so difficult
It feels like it
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
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
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
That is very silly
one second
this v is the same as v3
what are your p1 and p2
Oh wait
i have been very confused for 5 minutes
@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
Is it
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
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
These are the points
In spherical coords
Oh I think I fixed it
Maybe
???
Spherical coordinates are stupid and dumb
Not really
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
Angetenar
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
Angetenar
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
Angetenar
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
Upon further investigation I believe that the barycentric coordinate approach and cross product method 2 are giving the correct answer
No wrong channel
hey I was wondering if this is the right channel for numerical analysis ?
yeah
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?
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
This is not really the place for code review
You're better off asking in the python server
I guess don't compute the norm of the gradient and compute the gradient itself instead
I was told to post here last time when i was doing linear programming because my math class is university level applied business math
i got yelled at for posting in another channel
Then whoever referred you is wrong, this is not suitable for #numerical-analysis
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
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
Does this build on the neural ode work from a few years ago
Yes it does
If you're referring to this paper? https://arxiv.org/abs/1906.12183
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
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
related saw this (neural ode experience is required): https://jobs.smartrecruiters.com/BoschGroup/743999800032176-intern-ml-based-methods-for-pdes
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
was posted in #jobs julia slack
sadly I disagree, unless the LPs are discussed in any interesting way.
simple enough LP questions should go #linear-algebra which would cover many basic theorems used for LPs
@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
You may also want to look at https://finite-element.github.io/
As well as *The Mathematical Theory of Finite Element Methods * by Brenner and Scott
For what type of functions are finite differences exact?
I got the exact solution when I solved Poissions equation with constant driving function
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.
Thanks ๐
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
Maybe see Brezis FA PDE
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
Nothing about harmonic analysis I just had a very introductory numerical analysis course, fixed point, interpolation, stuff. I know some of the big picture of Analysis, but I'm bad with the details makes me feel fake
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
Thanks
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
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
You should look into theory of generalized locally Toeplitz (GLT) sequences. Lots to do there ๐ For example, all PDE discretizations are GLT (https://link.springer.com/book/10.1007/978-3-319-53679-8)
Thank you, reading the preface looks like many things I like come together
Could look into wavelets and wavelet transform (see S. Mallat). The classical wavelet theory (see I. Daubechies) never really ended up being that useful in applications but it turns out that certain wavelet transforms are basically an early version of CNNs, so there's been some revival of using that kind of analysis in the context of deep learning.
can someone check my work for a linear programming problem using Big -M method?|
I need to fully solve the problem below
(are you going to show your work)
It would be unbounded right? cause the column of x3 in tableau 2 doesnt have any valid options for the ratio
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
Do not post the same thing in multiple channels
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
The conversation will continue in #computing-software
alright
squirtlespoof
How does Z depend on s and t
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
spend some more time on this problem and i think im now more confused
could really use some input or guidance
๐
Is this the correct place to ask optimization related questions?
ended up figuring this out ๐
but thanks to readers

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
jan Niku
Compile Error! Click the
reaction for more information.
(You may edit your message to recompile.)
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
Your method should depend on the step size
here is the original linear multistep
were told to apply it to the trivial IVP $u'(t) = 0$ with $u(0) = 1$
jan Niku
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?
What is k
Oh right
This makes sense
If u'(t)=0 then u(t)=u(0)
Which you can see this method does exactly
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
i guess yea, i mean the method makes sense for good choices of the constants
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
Wait they propose that form of U^n for what
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
Ok so what if U^1 is not 1
if c_2 isnt 0, it wont be, i think
right
You should get that expression
it depends on how many steps youve taken, and how big c_2 is
but youll begin to drift from 1
of U^n=c_1 + 4nc_2 you mean?
Yes
i have that in the write up
what happens in the very first step is up to c_1
What happens after
Oh that should be a c_2
Anyways
The point is that the U^n will diverge from the correct solution
right
Is the method consistent
yea
What does consistency mean
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
Consistency means that local truncation error goes to 0 as step size goes to 0
Does the local truncation error go to 0
||the method is not consistent||
Consistency + stability => convergence
Or something
right
Or you can argue that consistency is a necessary condition for convergence
how are you reading off the lte?
What is U^n+1 - U^n
in terms of their proposed solution?
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
hmm okay
and its not convergent
this seems like a poor problem to demonstrate these concepts
yea, this was my original hang up
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 ๐โโ๏ธ
Is this the correct answer for the convex conjugate of 1/2||y-b||^2
hey all, im trying to find any sort of resources on modifying this numerical approximation of the eikonal equation on a uniform grid to handle signed distances (rather than unsigned). does anyone have any leads here? https://en.wikipedia.org/wiki/Eikonal_equation#Numerical_approximation
What does a signed distance mean
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
this probably does a better job at explaining it than i could: https://en.wikipedia.org/wiki/Signed_distance_function
cool thanks! ill check this out
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
The standard methods are to treat the problem as a time varying problem where you advance the distance level sets in time. The classic algorithms are the fast marching methods and the fast sweeping methods.
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
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
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.
is there a good way to ensure that your finite differences point outwards? is that just a matter of making sure they match the sign of the current pixel?
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
instead of saying that why dont you tell me the correct place to put it
since this is where i was told
i just want help
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)$
Maxerature
I'm stuck at one point:
$x_1(1+\epsilon1)(1+\epsilon{1,2})+x_2(1+\epsilon2)(1+\epsilon{1,2})$
Maxerature
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
Why must Trefethen exist?
Ummm
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)
I, too, ask myself if I will read this
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)
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.
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.
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?
I do believe this would go better in #advanced-probability
Well maybe the people there would disagree with me, but sampling is explicitly mentioned in the channel description for it so
Thank you!!
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?
Have you tried any h values?
Is that approximately correct?
I am sorry, I don't know how to determine that.
What happens if you reduce the step size
Alternatively, can you solve the ODE analytically
Yes, I can do that.
The solution through wolfram I am getting is:
Is it possible to do something like this? https://math.stackexchange.com/questions/3137864/what-is-the-largest-step-size-h-for-which-the-euler-method-is-stable-initial-v
is anyone here familiar with stochastic gradient descent
+ask
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?
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
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
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.
Yes of course
I do not think the matrix in question is terribly ill conditioned though
But the thing is, using two triangular solves really is nearly just the same cost as multiplying by a dense matrix.
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
what is e_k?
Is this the right channel to ask about bicubic interpolation? If not, what is?
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
Sorry for late reply. e_k = (cos kx + cos ky), and mu is just a constant
Does f have some decay that allows this integral to converge
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
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
Do you have an example of where sinc is hyped up
It's the Fourier transform of the rect function.
Itโs also sine with decay
Whittaker said that sinc(x) is a "function of royal blood in the family of entire functions, whose distinguished properties separate it from its bourgeois brethen"
Apparently it is quite useful in numerical methods for PDEs and signal analysis
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
Why is it any better than a Heaviside? Or a gaussian?
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
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?
Yes, see Shannon-Whitaker interpolation theorem
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).
yes - triangulation uses measurement of angles. trilateration uses measurement of distance.
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
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, ...
Hey! Thankyou
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.
By the way, it is not universal that human read the larger-value columns first. If your native language is Arabic, you read the ones first, then the tens, then the hundreds.
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.
(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).
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!
(getting off topic)
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...
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.
@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!
I'm very interested in Time-Frequency Analysis, someone knows about this?
Better to ask a specific question
read "Foundations of Time-Frequency Analysis" by Grรถchenig :^)
I stumbled across it before asking and already downloaded it, thanks.
Found Byrne's "Signal Processing: A Mathematical Approach" also seems interesting
Anyone knows how to solve a recurring equation such as this?
Will the order of Admas Bashforth's 3 order local truncation error be O(h^4)?
Which definition of local truncation error are you using
I'm trying to read about Butcher series but I haven't found anything good on them, any suggestions?
Depending on what f(n) is, you may want to look up Master Theorem. Under the assumption that f(n) is non-negative and (in some texts) non-decreasing, the general solution can be deduced by the Master Theorem
Otherwise, you can unroll the recurrence and find a general solution that way
Is it possible to have a Universal Turing machine that terminates on any given machine and input?
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
maybe something in here? https://github.com/JuliaMath/RandomMatrices.jl
If you know what the distribution should be you can just sample right
I know the joint densities https://en.wikipedia.org/wiki/Circular_ensemble#Probability_distributions but am not sure how to implement that for large n
hm I don't see anything specific for eigenvalues of the circular ensembles in the readme
it has a sparse matrix model for GOE/GUE which could be interesting for some other computations though
what are you working on, sounds interesting ๐
How do i unroll the reccurence
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)
Right now I'm looking at some quantities related to fluctuations of CUE eigenvalues, just trying to run some numerics first to get an idea if a bound is reasonable
And presumably randomly generating matrices and finding their eigenvalues is too slow right
That's what I've been doing but it seemed really inefficient
How are you finding the eigenvalues?
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
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
maybe thats a stupid question but cant you just sample the eigenvalues somehow?
This is probably a nice read
That's what I would like to do but I don't know how for large n (since they are all dependent and I care about long range correlations so eg. local approximation won't be good enough)
(I am also not very familiar with numerical methods in general)
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
KSM are based
Does anyone know/has implemented the pivot algorithm used to find the number of self avoiding walks?
Do people still use lapack nowadays
Yes
Yeah I think scipy is built on lapack for example
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
I was being lazy and trying to get around figuring out the lapack things in c++
80 years of finite elements
You can get around it by using higher level libraries that often call lapack. For example Eigen in C++
Yeah but like
Does [X] supercomputer support this
Like they will all have lapack in some form or another
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
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
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
I cry everytime
With OpenMP this is straightforward, since it's all shared memory
You might want to search for parallel linear algebra libraries
Because the use cases are too varied
But libraries like Pardiso, Lapack, Arpack, those ARE quite standard
Sure but there are a bunch of different lapack implementations floating around, no?
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
screams
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
Also does openmp support gpu
OpenMP is for shared memory CPU multi threading
This chart seems to indicate that openmp works on gpu though
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.
OK then it is my mistake
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
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
My limited experience with cuda has been a nightmare
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?
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?
Gabriel Yanci
No this is not the correct channel, and do give #latex-help a look as well
it says x6 is an artificial variable, artificial variables better be 0 at the optimal solution otherwise the problem is simply infeasible, but sure if slack variables are non-zero at the solution then those constraints aren't tight
anyone familiar with applying https://en.wikipedia.org/wiki/KarushโKuhnโTucker_conditions?

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.
Ok so why does this trick work
Hi
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
And because 4/3 cannot be represented exactly right
Yes
Can 4/3 be represented exactly in a ternary system
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
Think some more about this
In ternary, I get that 4/3dec = 11/10tern = 1.1tern, and 1.1 is not exact
Why isn't it exact
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?
Is 3/2 represented exactly in binary
No
(yes it is, 1.1)
Yes
Okay, I think it was my understanding of exact representation that tricked me up. Thanks a lot ๐
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
Also, think about your rounding scheme. Typically "round to even" is the most common approach
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?
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)
Okay. thanks! I think I got it
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.
its hard to code but gives better returns often
yeah its def best for gpu.. i wouldnt buy an amd gpu
I have received expert guidance that openmp out performs openacc and is competitive with cuda
For some problem that I care about
for specific problems that may be the case
Also better for portability
hmm
try using torch.linalg.eigvals

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.
Do you care about riemann zeta for any z in C or just for 1/2+it
any z where Re(z) > 1
the other cases are covered by the reflection formula which I have implemented already.
I will take a look at it in a second
Probably take a look in here https://fredrikj.net/math/zetalk1.pdf from the guy doing Arb and mpmath
Is this the place for linear programming?
Sure
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
Spamakin๐ท
Kinda completely lost since we haven't really covered LP in class
Ok
It's this
I mean I'd just end up typing that out
but basically you have some function you want to optimize
I actually don't know how to write an inverted $\Pi$ o,o
่w
so I want to maximize a single value of a vector essentially
I think that's the hard part
And what are you trying to maximize
\begin{aligned}
\max \quad& c \cdot x \
\text{s.t.} \quad&\begin{aligned}[t]Ax &\leq b \ x &\geq 0\end{aligned}
\end{aligned}
่w
Compile Error! Click the
reaction for more information.
(You may edit your message to recompile.)
This is how you write one
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
No
You can write this mathematically as well, pre-formulating it as an LP
I guess yea but writing it more mathematically doesn't get rid of this self referential issue
Self-reference isn't a problem in math
That is not the constraint in this
?
Well I guess another one is that all the values in a have to be non-negative and sum to 1
Is that the only one?
I mean
Is there any other?
That is actually n+1 constraints right
Well yea but like
I suppose your question might be, does every simplex define a probability?
Cause I want to maximize the minimum of this vector
Let's go ahead with this, how would you do this?
that's what I'm lost on cause the best I got was this
\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?
่w
Compile Error! Click the
reaction for more information.
(You may edit your message to recompile.)
So what are the decisions in this LP?
The values of a?
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}$$
่w
I will change the writing as much as you can recognise what you need to do in the LP
I don't see how a is a decision since that's what I'm trying to actually find
Well seems like I stepped ahead without you noticing
Let's go back to an LP then,
also max isn't necessarily linear so I don't quite think that's valid?
\begin{aligned}
\max \quad& c \cdot x \
\text{s.t.} \quad&\begin{aligned}[t]Ax &\leq b \ x &\geq 0\end{aligned}
\end{aligned}
่w
Compile Error! Click the
reaction for more information.
(You may edit your message to recompile.)
What is the output of an LP?
Is it $c$? Is it $A$? Is it $b$? Is it $x$? If it is none of these, then what?
่w
I'll come back to this statement later since I think it's problematic
the output of the thing you wrote, assuming you're given c, is x such that c.x is maximized
This is wrong
The output is an objective value, a single element of $\mathbb{R}$.
่w
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}$$
่w
If you can see that you can get the solution of an LP, then what different is $a$ from being $x$ in the usual LP?
right
่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?
I don't understand the second part at all
Since I told you $a$ is a decision, then are there any other decisions in the LP as formulated? (which isn't complete)
่w
The only other decision I guess is the minimum of a but that doesn't really sounds correct
And the minimum of $a$ is ... ?
่w
min(a) idk?
$$\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}$$
่w
??
Is that not it? (other than the fact that all the values in a are non-negative and sum to 1)
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?
่w
yea that's fine
Let's go back to this. What is non-linear?
So my understanding of a linear program is that the function we are trying to optimize must be linear right?
Linear in what
No, I'm not asking for the definition of linearity
Is $\min_{x} y^2x + yx + 1$ linear?
่w
yes
uh
Yea I think so
well the x that minimizes the first term may not be the x that minimizes the second term
$$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}$$
่w
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}$$
่w
Is this linear?
The terms are not separate in a single objective function
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
Find out
and worst case, office hours are on Monday
You already have the answers
yea I'll try to figure it out later
And the modelling required
It doesn't feel like I do ๐
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
You might want to get a solver and solve a few anyway.
https://jump.dev/JuMP.jl/stable/
I was gonna use this yea: https://coin-or.github.io/pulp/
I recommend finding a textbook on LPs, like Vanderbei, Matousek, Bertsimas or Luenberger
I may take a full course on it in a future semester
I recommend https://pyomo.readthedocs.io/en/stable/ which is more generic.
I don't see any benefits from sticking with LP-only modelling
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
Where do the ones switch to twos
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);
It's 1's all the way until the first 2 shown
If you can make the laplacian matrix, can't you just modify that to get what you need
This is taken from: https://se.mathworks.com/help/matlab/ref/kron.html
Yeah I could but it's a bit annoying working out the indices and just wondered if there's a smart way to do it from the get-go
There probably is a smart way, but it'll take more time to figure out than just working out the indices
I managed to do it I think xd
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);

It looks correct I think
Solved it!

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
Are the inner pragma omp parallels in function // stuff to do in parallel not being parallelized?
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
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
Are you asking for specific code/libraries
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
just any good efficient way of doing it works ig
#computing-software I believe fits better
any channel for fourier analysis stuff?
What type of Fourier analysis
we are trying to convert all parts of a CNN to spectral domain
#computing-software then
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)
hmm ok
Does anyone know what nnz means here?
probably number of nonzero (in a sparse matrix/array)
thanks
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
h_vitalikkk
Consider latex-ing it instead
anybody familiar with proximal gradient descent? having a bit of trouble understanding what's the iteration and why mine's diverging
I'd like to hear if you eventually get any insight. Never got around to doing my "homework" learning about proximal methods.
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?
You'd need to write your own solver if you want to start based on previous solves
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
1/3rd of 12 is 4
Nah, 1/3 of 12^2 is 48 ๐
Well, yeah. It makes me wonder if thereโs some dumb flaw in my formulation that makes it run orders of magnitude slower than is should
the integer constraint 
๐๐๐
perhaps try some other solvers like cvxpy or others just in case
What do you get with linear relaxations?
Do you mind sharing your .nl? I'd try HiGHS and CBC
I wouldnโt mind, but Iโm not at home rn, and donโt have my laptop with me. I can dm them to you when I get back if you want
Also, I just realised, ortools does not support .nl, only .mps
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
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 ๐
Oh, yeah, I got back home, and a(13) has finally finished calculating. Took it only 16 hours ๐
12 iterations

@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$
ๆขฆๅขๅๆต
You can alternatively write this with the material derivative as $\frac{D\mathbf{u}}{Dt}=-\nabla p$
ๆขฆๅขๅๆต
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
any open source codes using this?
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)
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
is this related to particle in cell methods?
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
fast multipole?
sounds fun, good luck
Have you worked with Arbitrary Lagrangian-Eulerian discretizations?
Ah, I see
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
given the usual risk formulation, I assume that f*(x) should be the y corresponding to x
Okay yeah, that makes more sense
Right because we have potentially noisy data we are approximating with f
ye
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
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
Yeah, I don't have too much time, but I'm making do
I would like to ask is there any connection between polynomial Newton iteration and Newton Raphson approximation
you mean newton polynomial interpolation?
is the Jacobi method convergent for all norms if the spectral radius is smaller then 1?
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?
Yeah, norms in finite-dimensional spaces are equivalent
I realized that lexicographic comparison is a linear constraint for binary variables. Tried it, it sped the process up sixfold-ish. Now I feel stupid and smart at the same time lol
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
Nonlinear, CFL condition, turbulence
The stokes equation*
Do you mean the linearized ones?
No. Dealing with the divergence free condition is a drag too.
Well, people do finite volume methods for a reason
Why isn't that a problem in FVM?
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?
The discretization automatically handles the continuity condition
Iserles
Say, I have a group, represented as a list of permutations. How can I find a minimal generating set for this group?
I mean computationally, but I see your point
No one who frequents this channel knows how sage works
People who frequent #groups-rings-fields will be more likely to know how sage works
||Iโm not using sage, Iโm using pyyyyyyython||
Even then
(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)
Enoo58
i manged to prove it
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 ๐
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?)
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 you
More stuff to add to the list, thank you
Is this at the undergraduate level? I would suggest finding a problem that can be directly translated into a numerical linear algebra problem, in which case the interesting part is explaining how to describe the application in terms of matrices and vectors, rather than trying to learn new mathematics. And I'm guessing each student is supposed to present something different?
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.
How fast does power iteration converge if $q_1^Tv^{0}=0$ and $\vert\lambda_1\vert > \lvert \lambda_2\vert > ...$?
Maxerature
Do you know the answer when, instead of that condition, v is generic?
squirtlespoof
why use neural network if it's simply a convex optimization problem? 
depending on the norm used you'll get a different answer, but still
Lolll
trying to solve this optimization problem with a neural network is like using a plane to drive through the streets
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?
Any users of FEM software? What do you use? What is a good lobrary?
fenics and deal.ii are pretty popular
Do you have any experience with these? Any pros and cons?
You can take a look at https://ngsolve.org/ too, but yeah, it depends on your goal
Netgen/NGSolve is a finite element tool. One can solve mechanical, electromagnetic or flow problems and many more
fenics' documentation needs to be fixed for beginners
What can netgen do that other codes can't?
What should I compare it to? It's hard for me to say anything if I don't know your use case. Personally, I use it because of the shape optimization capabilities, but there are other features that might be interesting for you.
Maybe take a look at the website
All in one Netgen/NGSolve provides the full workflow of finite element simulation: The constructive solid geometry module supports geometric modeling. Alte...
I think both fenics and deal.ii has DG also, which is good if you want to do flow problems
Dealii has CR and Nedelic but it's weird that they didn't apply elements for 4th order equations
Yea fenics is very nice
Definitely has DG
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)$
spanner
and i have this starting matrix here and i'm trying to determine CM and P
Sorry I am not really sure what you are asking
it's dynamic programming
Would questions regarding compressed sensing go here?
perhaps, depends on the question
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
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?
