#numerical-analysis

1 messages ยท Page 19 of 1

neon snow
#

Or wait

#

I see

#

or no

#

idk

wide spear
#

First, can you discretize the boundary conditions?

neon snow
#

WRite these as finite differences?

wide spear
#

Yeah

neon snow
#

Hmm forwards?

wide spear
#

Well, at the left side it will need to be forwards

neon snow
#

Yeah, and right side backwards

wide spear
#

And at the right side it will need to be backwards

#

Yeah

neon snow
#

so

#

[
N\left(u_{j+1}(t)-u_{j}(t)\right)=0
]

pine jettyBOT
#

Victor H

neon snow
#

For the left side

wide spear
#

Yes

neon snow
#

But is this with respect to x now

wide spear
#

Well, this also holds for t+1 right?

neon snow
#

Yeah you're right

wide spear
#

How can you incorporate this into your update routine?

neon snow
#

Well since this is the first one

#

I need

brave crypt
#

So that's the compressible mass conservation, incompressible is just $\nabla\cdot(u)=0$. The answer to number 2 in this picture about the pressure was that it enforces mass conservation. I definitely did not get that right at the time, still don't understand it now totally. But pretty sure that was it and physically it makes sense somewhat. Like in a pipe that is thinner downstream than upstream flow speeds up according to mass conservation. How would the individual fluid particles know to speed up? Because of the pressure, which is still a wave with finite speed. But very large compared to the velocity of the fluid such that it is infinite in the mathematical analysis.

pine jettyBOT
#

Abdul Aziz

neon snow
#

Right?

wide spear
#

Yes

neon snow
#

So I need u_j=1 and u_j=0 to be the same every iteration

wide spear
#

Sure, you're talking about Bernoulli's principle or whatever similar concept applies here

neon snow
#

But I can't just set them to whatever value

wide spear
#

No, but how did you update them in the past?

neon snow
#

What do you mean?

wide spear
#

How did you compute u_1(t+1)?

neon snow
#
u(2:end-1,m+1) = u(2:end-1,m) + dt * udot(:,m+1);
wide spear
#

Ok

#

So this is how you get u_1(t+1)

#

Then you can just set u_0(t+1)=u_1(t+1)

#

I think

neon snow
#

oooh

#

so I still step inside only

#

but I also update the boundary

#

YES OK

wide spear
neon snow
#
for
u(2:end-1,m+1) = u(2:end-1,m) + dt * udot(:,m+1);
u(1,m+1) = u(2,m+1);
u(end,m+1) = u(end-1,m+1);
#

?

wide spear
#

Something like this, yes

#

Also obligatory Matlab sucks

neon snow
#

why haha

wide spear
#

Python is faster

#

Open source

#

Free

#

Etc....

neon snow
#

Comparing Python to MATLAB is weird

#

MATLAB is fast when you use MATLAB properly, i.e using vectorized instructions and utilizing it's perfect implementation of LAPACK

wide spear
#

Python calls LAPACK via Num/Scipy

brave crypt
#

Python is definitely superior

neon snow
#

Yes ofc I know that

#

But one actually pays for MATLAB because of it's really good documentation and robust functions that work out of the box

#

It's like a big ass library

#

But Python is good too imo

#

I wouldn't pay for MATLAB personally ๐Ÿ˜„

#

Academic license

brave crypt
#

Yup the libraries are very nice

wide spear
#

I would hesitate to say that Matlab has good documentation

neon snow
#

??

#

I find MATLAB's documentation to be one of the best I've ever seen

wide spear
#

I've tried working with some things

#

I prefer the Scipy style of documentation

neon snow
#

The von Neumann BC doesn't work

#

It shouldn't turn around

#

Why the fuck is the video 3 min

#

It should reflect without inverting the wave

wide spear
#

First, I'm going to suggest that you replace all of your first order approximations with second order approximations

#

This should help with the oscillations

neon snow
#

other than this

wide spear
#

Yes

#

Second order approximation

#

Also for the endpoints

neon snow
#

sorry I'm back

#

I just had to commit seppuku

#

From this piece of shit assignment

#

but we back

wide spear
neon snow
#

So I looked in my book

#

And found something similar

#

Dog shit book btw

#

And the author uses second order method for derivatives

#

Then he solves some system of linear equations in the for-loop

wide spear
#

Ok that makes sense

#

Second order method will reduce oscillations

#

System of linear equations at the endpoints, yeah

neon snow
#

But he only uses second order method for the

#

first derivatives

#

ie. the boundary cond.,

wide spear
#

Yeah yeah

neon snow
#

But I don't know how to fix it with symplectic Euler

#

So the derivative approximations are

wide spear
#

Oh you don't need second order for the main symplectic Euler part

neon snow
#

For the left end-point:
[
-3u_{j=0}(t)+4u_{j=1}(t)-u_{j=2}(t)=0
]

wide spear
#

Yep

pine jettyBOT
#

Victor H

neon snow
#

For the right endpoint:
[
-u_{j=N-2}(t) +4u_{j=N-1}(t)-3u_{j=N}(t)=0
]

pine jettyBOT
#

Victor H

neon snow
#

How the fk do I do this

wide spear
#

Yes these are correct

neon snow
#

Ok so

wide spear
#

So

neon snow
#

Ok my try broke matlab

#

It grew a little bit

#

Ok I don't know what to do

wide spear
#

What did you do?

neon snow
#

Honestly I don't know

wide spear
neon snow
#

The book changes the matrix A to this

#

To reflect the end points somehow

wide spear
#

Is this what you did?

neon snow
#

Yeah

#

And I did a random \ in MATLAB and hoped for the best

wide spear
#

For u(1,m) right?

#

Not u(2,m-1)

neon snow
#

But I don't understand where to put it

wide spear
#

Put what

neon snow
#

The \

#

What system am I solving?

wide spear
#

Why do you want to solve a system?

#

This is the matrix A

neon snow
#
for m = 1:M
    udot(:,m+1) = udot(:,m) + dt * c^2 * A*u(2:end-1,m);
    u(2:end-1,m+1) = u(2:end-1,m) + dt * udot(:,m+1);
#

This is what I have now

#

With the "normal" A

wide spear
#

You don't need to solve a system

#

udot(:,m+1)=udot(:,m)+dt * c^2 * A * u(:,m)

#

Where A is the modified matrix you have

neon snow
#

and change A to correct size too?

wide spear
#

Well you add the two rows on top and bottom so that it's the correct size right

neon snow
#

Yes it's N-1 x N-1 rn

#

So I did N+2 x N+2

wide spear
#

No it should be N by N

neon snow
#
u = zeros(N+1,M+1);
udot = zeros(N-1,M+1); %
e = ones(N-1,1);
A = N^2*spdiags([e -2*e e],-1:1,N-1,N-1);
x = linspace(0,1,N+1)';
#

But u is N+1

wide spear
#

Oh wait yeah N+1 by N + 1

neon snow
#

Yeah!

neon snow
wide spear
#

Not N+2 by N + 2

neon snow
#

yeah

#

I meant I added +2

#

xD

wide spear
#

Yeah

neon snow
#

from n-1

wide spear
#

Ok

#

So the first row is 1 -4 3 0s

#

And then the next row is 0 coeff coeff coeff 0s

#

And so on

neon snow
#
u = zeros(N+1,M+1);
udot = zeros(N+1,M+1); %
e = ones(N-1,1);
A = N^2*spdiags([e -2*e e],-1:1,N+1,N+1);
x = linspace(0,1,N+1)';

A(1,:) = [-3 4 -1 zeros(1,N-2)];
A(N+1,:) = [zeros(1,N-2) -1 4 -3];
#

Still wrong

#

๐Ÿ˜ฆ

#

Still inverts

wide spear
#

The right hand signs are wrong

#

1 -4 3

neon snow
#

These?

wide spear
#

Yeah

#

I think

neon snow
#

Other ones correct?

wide spear
#

Yeah left hand side is -3 4 -1

neon snow
#

Literally no difference

#

or am I interpreting shit wrong?

wide spear
#

Hmmmm

#

Changing the signs is not supposed to not change anything

neon snow
#

But why would this even make sure it's zero

#

I never say it should equal zero

wide spear
#

Oh ok I think I see what you need to do

#

You keep the matrix A as a N-1 by N-1 matrix

#

You update u(2,m-1)

#

Then you know that -3u(1,m+1)+4u(2,m+1)-u(3,m+1)=0

#

So u(1,m+1)=(u(3,m+1)-4u(2,m+1))/(-3)

#

And you do the same at the other endpoint

#

Does this make sense?

#

Sorry for the late reply

neon snow
#

I can try

neon snow
wide spear
#

u(2:n,m-1)

#

Whoops

neon snow
#

Why the one previous?

wide spear
#

u(2:n,m+1)

#

My bad

#

What a mess

neon snow
#
for m = 1:M
    udot(:,m+1) = udot(:,m) + dt * c^2 * A*u(2:end-1,m);
    u(2:end-1,m+1) = u(2:end-1,m) + dt * udot(:,m+1);
    u(1,m+1) = (4*u(2,m+1)-u(3,m+1))/3;
    u(end,m+1) = (4*u(end-1,m+1)-u(end-2,m+1))/3;
end
#

Let's see what happens

#

It's probably gonna suck fucking ass

#

Yes, it sucked ass, more than usually actually

#

Looks even more Parkinsony than usual

#

But wait a minute

#

For the g(x)=sin(3pi*x)

#

Look how the end point at x=0 is moving

neon snow
#

This shit can't possibly work

#

It cant

#

Because we need to pick these 3 end points closest to each side to fulfill the equations

#

but they're all coupled to everything, arent they?

#

So we need to solve a huge system of eq.

#

???

wide spear
#

Oh yeah do that

neon snow
#

yeah do that

wide spear
#

Usually when I get here, to something that is almost correct, I randomly switch +/- signs, add +1/-1 to things, etc...

neon snow
#

xddd

#

i laughed irl

#

the proper desperation

brave crypt
#

Kek

wide spear
#

Try solving the system u(:,m+1)=u(:,m)+c^2 * A * u(:,m+1)

#

Maybe?

neon snow
#

with the N+1 matrix with the -4 3 -1 shit?

wide spear
#

Yeah

neon snow
#

But how do I update it with that?

#

What's the update scheme

#

iteration scheme

#

I solve that system first?

#

Sorry if I'm dumb but I'm legit on the verge of death

wide spear
#

Yeah you solve the system

#

(I-c^2*A)u(:,m+1)=u(:,m)

#

Solve for u(:,m+1)

neon snow
#

I can just use backslash in matlab

wide spear
#

Yeah

neon snow
#

So I do

#

u(:,m+1)=(I-c^2*A)\u(:,m)

#

What about udot and everything?

wide spear
#

udot(:,m+1) = udot(:,m) + dt * c^2 * A*u(2:end-1,m);

#

In this line

#

Shouldn't it be udot(:,m+1) = u(:,m) + dt * c^2 * A*u(2:end-1,m);

#

I don't know

#

Nothing makes sense anymore

neon snow
#

I know man

wide spear
#

This is when debugging becomes a spiritual experience

neon snow
#

My spirit is legit zero

#

nada

wide spear
#

udot(:,m+1) = udot(:,m) + dt * c^2 * A*u(2:end-1,m);

#

What is this line doing

#

Why udot(:,m) and not u(:,m)

neon snow
#

Well it's just the scheme isn't iot??

#

First I do

#

udot(:,m+1) = udot(:,m) + dt c^2 Au(:,m)

#

then

#

u(:,m+1) = u(:,m) + dt*udot(:,m+1)

neon snow
#

lmao

#

but it's like close

wide spear
#

Is that close?

#

It seems like you're off by a sign

neon snow
#

I mean it's not close at all

#

But the end-points are mving

wide spear
#

I would guess

neon snow
#

Dude

#

I'm just bruteforcing stuff

#

Testing every possibility

#
for m = 1:M
    udot(:,m+1) = udot(:,m) + dt * c^2 * A*u(:,m);
    u(:,m+1) = u(:,m)+dt*(eye(N+1)-A)\udot(:,m+1);
end
#

eye() is identitiy matrix

wide spear
#

Don't you need c^2*A?

neon snow
#

c is one anyways

wide spear
#

Oh lol

#

Haha

neon snow
wide spear
#

Oh my

neon snow
#

Now it's just sperging out

fleet sail
#

any hint to show divided difference is the coefficient of lagrange interpoly

neon snow
#
difference = zeros(2,M);
for i = numel(M)+1
    difference(1,i) = -3*u(1,i)+4*u(2,i)-u(3,i);
    difference(2,i) = -u(end-2,i)+4*u(end-1,i)-3*u(end,i);
end
#

Only two values

#

Probably round off values

#

So it's like correct

wide spear
#

Ummmmm

#

Your signs are still off

#

End should be 1 -4 3

neon snow
#

It doesn't change anything

wide spear
#

Well you want it to be correct

neon snow
#

Honestly, I see your point but

wide spear
#

And it should change something after it stops randomly flipping

neon snow
#
for m = 1:M
    udot(:,m+1) = udot(:,m) + dt * c^2 * A*u(:,m);
    u(:,m+1) = u(:,m)+(eye(N+1)-dt*c^2*A)\udot(:,m+1);
end
#

Is still even slighty

#

like

#

this is 100% nonsensical

#

Like legit

wide spear
#

Oh wait in the second line you don't need the first u(:,m)

#

I think

#

Wait nevermind

neon snow
#

But this doesn't even make sense in the slightest

wide spear
#

Nothing makes sense anymore

fleet sail
#

how in za warudo

#

any hints

fleet sail
#

cant seem to use induction blobsweat

#

pain

#

also I dont want to assume they are permutation invariant as i prove permutation invariant assuming this fact, but if its really necessary then its ok

wide spear
#

How did you define Lf?

wide spear
neon snow
#

lmao

#

speaking of neumann boundary conditions

#

I solved it

wide spear
#

Nice

brave crypt
#

Excellent

neon snow
#

Really appreciate it

wide spear
#

I'm not sure how much I actually helped though

neon snow
#

Well you were part of the process

#

Who cares who drove it across the finish line

wide spear
fleet sail
#

the lagrange form is ez, but the professor just took it for granted that the recursive def of divided difference will give the coefficient w.r.t the other basis for the same interpol

pine jettyBOT
#

Anticipation

wide spear
#

Is this how you defined Lagrange interpolation? This is Lagrange interpolation with divided difference coefficients right?

#

I think that can induct on k, the number of interpolating points

fleet sail
#

yea

#

but i tried inducting and failed

#

wait

#

yea i think i failed

wide spear
#

Well what did you try

fleet sail
#

so assume its true for n โ‰ค m

wide spear
#

Ok

fleet sail
#

i can't show its true for n = m+1 because everything is a mess

wide spear
#

Well I agree that it will be a mess

fleet sail
#

wait either im wrong yesterday or im wrong today

wide spear
fleet sail
#

OK so I suppoed

#

$\sum_{k=0}^mf[x_0,\cdots,x_k]\omega_k(x) = \sum_{k=0}^ma_k\omega_k(x)$ where RHS is the interpolating polynomial

pine jettyBOT
#

Anticipation

fleet sail
#

we know it exists cuz the wks are a basis

#

now i need to show $\sum_{k=0}^{m+1}f[x_0,\cdots,x_k]\omega_k(x) = \sum_{k=0}^{m+1}a_k\omega_k(x)$

#

and using inductive assumption thing

wide spear
#

Are the w_k the same on both sides?

fleet sail
#

yea

pine jettyBOT
#

Anticipation

fleet sail
#

which is same as showing $f[x_0,\cdots,x_{m+1}]\omega_{m+1}(x) = a_{m+1}\omega_{m+1}(x)$

wide spear
#

Right

pine jettyBOT
#

Anticipation

wide spear
#

So it's showing that f[x]=a_{m+1}

fleet sail
#

wait but i need to show that

wide spear
#

Well omega_{m+1}(x) is on both sides so you cancel it out

#

So you need to show this

#

Yes I agree

fleet sail
#

no i mean

wide spear
#

Expand out the definitions

fleet sail
#

and by showing this thing im done as u said

#

ok so another way to phrase this is I need to show

pine jettyBOT
#

Anticipation

prime kraken
#

i'm under the impression it is a telescoping sequence if you look at partial sums

#

do a few smlal ones and look for a pattern

wide spear
#

Wrong channel?

fleet sail
#

i think not but it doesn't work ๐Ÿ˜ฆ

fleet sail
wide spear
#

This is not a telescoping series

prime kraken
#

yeah mb, i didn't mean telescoping, but self similar

brave crypt
#

I'm trying to understand why fixed point iteration is at least quadratic convergence when g'(x) = 0.

wide spear
#

Which fixed point iteration? Just x_{n+1}=f(x_n)?

brave crypt
#

yeah

wide spear
#

Or g I guess

#

Ok

brave crypt
#

I get to this point and dont know how to get a constant out of this?

wide spear
#

What does quadratic convergence mean?

#

To get a constant, try taking the Taylor expansion of f(x_n) about r

#

So f(x_n)=f(r)+f'(r)(x-r_n)+....

brave crypt
#

one sec

brave crypt
wide spear
#

I should hope so, I don't have the applied math role for no reason

rose turret
#

can someone give me like a eli5 for EM GMM? like how do we initialize mean, covariance and pie with respect to the number of clusters? In python, given m x n matrix, would the implementation of expectation just be scipy.stats.multivariate_normal(array[:, n], mean[cluster_num], cov[cluster_num]) for all n?

wide spear
#

Wikipedia suggests that the parameters can be randomly initialized

rose turret
#

@wide spear between [0,1], right? because normal/gaussian distribution

wide spear
#

(Also disclaimer I don't know any stats but I am in close contact with someone who does so they're answering via proxy)

#

Wait why between [0,1]?

rose turret
#

oh good question... umm

jolly wadi
#

I guess that's the wrong language...

light rover
#

my homework asks me to do this

#

but they are not circles?

#

and im reading the textbook and it only has stuff for circles

#

can someone pls explain

wide spear
#

Newton's method to find the root? Or Newton's method for finding minima

light rover
#

uhh

#

im assuming root

wide spear
#

Well

#

Make sure which one it is

light rover
#

you see, I would if my professor actually responds to his emails

#

but does the first two steps differ based on which it is?

wide spear
#

Well

#

They're doing two completely different things

#

So.......

light rover
#

can I know both?

wide spear
#

First, can you explain what the textbook has about circles?

light rover
#

this

wide spear
#

Ok

#

Where is the Gauss-Newton method defined

light rover
wide spear
#

Ok

#

Why does being a circle matter

light rover
#

I wish I knew the answer to that question LOL I'm just trying to understand this thing

#

because my prof doesnt lecture :)

wide spear
#

Can you write down the r_1 and r_2 for example 3?

light rover
#

uh

wide spear
#

r_1(u,v)=....

#

r_2(u,v)=....

light rover
#

yeah but isnt R1 the radius

#

so like

wide spear
#

Don't think about that

#

Do you understand how the r_1,r_2, and r_3 were derived in example 4.21?

light rover
#

I understand the parts before the radius yeah

#

isnt that just the distance

wide spear
#

The distance from what

light rover
#

x to y?

wide spear
#

No

light rover
#

x, x1?

wide spear
#

(x1,y1) to (x,y)

#

Do understand what you're trying to do?

light rover
#

noppe

wide spear
#

Did you read the chapter?

light rover
#

it doesn't really make sense but it's okay sorry for bothering you

wide spear
#

No

#

I'm going to make sure you understand

#

For example 4.21, we are trying to find a point (x,y) that minimizes the distance to the three circles with centers (x_1,y_1), (x_2,y_2), and (x_3,y_3) with radii R1, R2, and R3

#

r_1 is the distance from (x,y) to the 1st circle

light rover
#

okay

wide spear
#

r_2 is the distance from (x,y) to the 2nd circle

#

r_3 is the distance from (x,y) to the 3rd circle

light rover
#

oh my gosh

#

so sorry about that

wide spear
light rover
#

i don't understand why we are finding a point that minimizes the distance

wide spear
#

Well

light rover
#

and that entire thing you typed

wide spear
#

Why is another question

#

But that's the goal of this section it seems

#

Which thing I typed

light rover
#

the three circles and the centers

wide spear
#

Ok

#

What don't you understand

light rover
#

what this method exists for

#

and how do I apply it to this equation

wide spear
#

First, do you understand the example they give?

#

4.21

light rover
#

why they used what they used? no
how to use it on another circle? maybe

wide spear
#

Well, it turns out that finding minima of these types of functions is pretty important in applied math

light rover
#

okay I did not know that thank you

#

sorry, I am just a very confused being but I will try my best here

#

so is this related to finding the minima?

wide spear
#

Well, you have the three distance functions

#

(x,y) to each of the three circles

#

You combine these to get the function you want to minimize

#

Then you use the Gauss-Newton method to minimize it

light rover
#

okay is the radius relevant or irrelevant in the u^2 + 4v = 4

wide spear
#

Well, stop thinking about the radius

light rover
#

why?

wide spear
#

Instead, think about how you can find an analogous distance function

#

It won't be in exactly the same form

light rover
#

okay

wide spear
#

So how can you find the distance from a point to the curve you were given?

light rover
#

the abs value of a (point on the curve) - (the point we're given)?

wide spear
#

I think

light rover
#

d(x,y) = |x - y|

#

or thats the distance I know

wide spear
#

Well that's the distance between x and y

#

You want the distance between (x,y) and the curve u^2+4v^2=4

#

So you'll need to find another equation

light rover
#

okayy

wide spear
#

Find a formula for this distance and then come back

light rover
#

okay gotcha

wide spear
#

You'll also want to find the formula for the distance between (x,y) and the curve 4u^2+v^2=4

light rover
#

okay

#

thank u

light rover
#

so I finally found my profs "notes" on this as I was on the hunt to find if he posted this equation somewhere, and I think I am even more confused than when I started

#

but I think I found what he wants out of this question (?)

light rover
#

nvmm I figured it out

wide spear
light rover
#

his definition of newtons method is very different

#

it seems like

#

what is this

#

is this also newtons method?

wide spear
#

Well, Newton's method refers to many different things

light rover
#

such as?

wide spear
#

Newton's method for finding zeros of functions

#

Newton's method for finding minima of functions

light rover
#

ohhh

#

okay this makes more sense to me now

#

thanks for all ur patience ^^

#

even though I asked some pretty irrelevant and dumb stuff I hope I didnt take too much of your time

wide spear
light rover
#

wait can I ask one more question?

wide spear
#

Ok

light rover
#

are you a math major?

neon snow
#

I see you're using Sauer numerical analysis book

#

Dog shit book

light rover
neon snow
#

Nah it's the only book I've tried

light rover
#

LOL

neon snow
#

Course recommended

#

So maybe it's the best but then all must be trash

light rover
#

yeah but imo its better than trying to decipher my professor's chicken scratch

#

when he decided to give up lecturing all together

neon snow
#

Oh yeah anything is usually better than the professor's parkinson

light rover
#

yep

#

ngl

#

i thought that was wiqqles

#

for like 2 hours

neon snow
#

Does his g go the other way

light rover
#

no idea

neon snow
#

Why did he reflect his g around the horizontal axis

light rover
#

LOL IKR

wide spear
#

Yes I am a math major

#

There are no good numerical analysis books

light rover
#

I can't handle that

wide spear
light rover
#

are you undergrad?

wide spear
#

Yes

light rover
#

ohh ok!

wide spear
hollow ingot
#

wait angetenar is an undergrad monkagiga

wide spear
#

It doesn't really discuss numerical methods for pdes though?

#

Just looking at the table of contents

hollow ingot
#

not in any sort of depth

wide spear
#

Also very little about FFT and signal processing

wide spear
hollow ingot
#

you seem pretty knowledgeable in this stuff and i thought you were a grad student at least

wide spear
#

Well

#

I'll probably be a grad student next year

#

And I've done a fair amount of classes about numerical analysis

hollow ingot
#

sounds great

#

i had like, one numerical analysis class that was offered in my undergrad

wide spear
#

Ah

#

I go to a big school

#

With a lot of applied mathematicians

#

2 undergrad numerical analysis classes, 3 graduate ones

#

Some other applied math classes that touch on the topic

light rover
#

Wait how does that happen

#

I thought usually people take a year off before going to grad school?

wide spear
#

Ummmm

#

Gap years are of varying popularity

#

Depending on circumstances

light rover
#

Wow

#

I applaud u

wide spear
#

Thanks

#

Grad school admissions are hard

light rover
#

Which school are you aiming for?

wide spear
#

Well

#

Of the schools that I haven't been rejected from yet, Caltech would be cool

light rover
#

:0

#

thats very ambitious of you

wide spear
#

Well, I still have dreams

#

I haven't given up all of them yet

light rover
#

whOa that sounds sad

#

but not sad at the same time

wide spear
#

Becoming an adult means giving up on your dreams

light rover
#

not necessarily true

wide spear
light rover
#

eerr i meann

#

what is your dream?

brave crypt
#

testing testing

wide spear
fleet sail
#

my dream is to taylor expand every day

fleet sail
#

this proof valid?

#

feel like its pretty unjustified for some reason

light rover
#

Proofs

#

Heh the bane of my existence

#

I'm surprised I even lived thru my real analysis class

light rover
#

question - how do I find d degree of polynomials that pass through four points?

#

I could just be really dumb and this could just be something super simple, but I'm going to accept my dumbness

#

where does this come from

random hornet
#

Lagrange interpolation could give you a 4th degree polynomial, right?

#

I'm not sure if that's the lowest possible you can get

light rover
#

uhh is that okay?

#

I can do that?

#

cus the question asks for d degree

#

but never specified 3rd or 4th

random hornet
#

Okay so a quick web-search reveals you'd get a polynomial of least possible degree from Lagrange interpolation

#

For k given points, it will be at most k-1

#

So in your case, at most 3

#

Once you plug in the actual values of the points, you can possibly obtain a polynomial of a smaller degree than 3

light rover
#

oh I see

#

alright, thank you

#

๐Ÿ˜„

random hornet
#

I'd still suggest you read about polynomial interpolation methods

dark sinew
#

just try remembering that you need two points to get a polynomial of degree 1 (a line)

random hornet
#

My knowledge about this is too superficial

dark sinew
#

that gives you an idea of the relationship

light rover
#

yeah I'll probably hunt the textbook

dark sinew
#

d+1 data points for polynomial of degree d

light rover
#

oh okay thank you for the pointer

dark sinew
#

yeah whenever you're trying to remember whether its like plus or minus one

#

think about the edge cases

light rover
#

ohhh ok

wide spear
#

Ultimately this is because a polynomial of degree n has n+1 coefficients

light rover
#

i see

pine jettyBOT
#

davidW

wide spear
#

What does triangular support mean

pine jettyBOT
#

davidW

glad mantle
#

yeah so trying to see if there's a slick way to do this without induction lol, maybe something involving Schur Complements? hm, thinking

wide spear
#

No induction seems like the best way to do this

#

Schur complements will indeed work, but I don't think it will give you the triangular support condition

brave crypt
#

currently i parsed the input file into these:

  1. nu of faces (cells)
  2. nu of edges (Using Eulers Identity V - E + C = 2)
  3. coordinate of each vertex
  4. cell centroids
    and made this image

could one suggest an algorithm to enumerate the edges of such graph?

light rover
#

Imagine knowing the answer to this... I can't lol

brave crypt
#

it should be sth like

create edge center array
for each cell loop around the edges
if mean of any 2 is not in edge center array
fill center array

if i do not mess up with logic :\

wide spear
#

Have you considered breadth first graph traversal?

brave crypt
#

wasnt it for trees only

wide spear
#

Wait how is your graph stored

#

Do you not store it as a set of vertices and a set of edges?

brave crypt
#

just coords

#

x array
y array
triangle connectivity array

wide spear
#

Can you convert this into an adjacency matrix

brave crypt
#

had to work in google sheets also :\

wide spear
#

Triangle connectivity array?

brave crypt
#

size of 3 by nu of triangle regions

wide spear
#

Oh my god why is this in google sheets

#

Turn your triangle connectivity array into an adjacency matrix

brave crypt
#

๐Ÿ˜
okay

#

with adj mat it would be very tidy ikr
but moving connectivity into adj mat is another nightmare

wide spear
#

Write some code

brave crypt
#

ye, kinda doing it rn

#

nvm it should be ez to create adj matrix

#

run over all triang
put + 1 for each combination of 3 vertices in my file (or +0 if 1 already)

#

boom, made it

#

strange, nu of edges in adj matrix does not coincide with eulers identity formula >_>

#

nvm, had to fill ij and ji, then take half

brave crypt
#

all done! thank you @wide spear

wide spear
fleet sail
#

i rly want to make the last part of this pf better

fleet sail
#

heres the updated i think its better but maybe its still flawed

light rover
#

how did they get 1???

#

for f[x1x2x3]?

#

is it not 2 - (-1) / 1 - 3?

#

ohhhh sike

#

nvm

wide spear
light rover
#

haha my math isn't the greatest

#

i respect the mathematicians

#

I am a part of the 10% of chinese ppl that can't math

wide spear
#

Well

#

I don't really believe that there are people who can't do math

light rover
#

wait can I ask a question why is -1 and 2 both f[x1, x2]

light rover
wide spear
#

f[x1,x2]=2

#

Oh I see

#

That's a typo

#

The second one should be f[x2,x3]

#

And the third should be f[x3,x4]

light rover
#

ohh okay that makes more sense

#

thank u

#

i've taken a lot of math classes and still learned nothing

#

as you can see

wide spear
#

So?

#

Maybe math classes aren't the right way for you to learn math

light rover
#

i mean watching yt videos aren't really like amazing either

#

or reading stuff from textbooks

#

unless you have a different way

#

although patrick JMT - great dude

wide spear
#

Well I have no experience as an educator so I don't think I'm the right one to make recommendations

#

But something that I've found very important for me when learning is motivation

#

Learning math for the sake of doing things with it

light rover
#

such as?

#

(besides everyday life things)

wide spear
#

Well I'm interested in fluid dynamics

#

I think it's a really cool field

#

See this

#

Fluids are very pretty

#

And behave in very cool ways

light rover
#

that is indeed very cool

wide spear
#

And understanding this is a very difficult mathematical question

light rover
#

I would imagine so

#

I respect ^^

fleet sail
#

divided difference is just pascal triangle

wide spear
light rover
#

oh oke

#

I mean thanks

#

how

turbid jay
#

hey, has someone done some convex optimisation? We proved that gradient descent for a convex and Lipschitz $f$ with stepsize $\gamma = \frac{R}{B\sqrt{T}}$ where $||x_0-x^|| \leq R$ and $\nabla f(x) \leq B$ is in $O(\frac{R^2B^2}{\varepsilon^2})$. $T$ is the number of total steps. However, we don't know $B$ and $R$ (only that they exist) so we can't actually use this algorithm. Suppose I know $R$ and also know that some $B$ exists, I need to find an algorithm to find the optimum $x^$ up to some arbitrary error in the same complexity as before. I'm not sure how I should go about that tbh. Should I just try different stepsizes that only depend on $B$ and $T$ and try to prove that this has the correct complexity, or is there a better way? I feel like I should somehow use the fact that $f$ is Lipschitz

wide spear
#

What did you prove about gradient descent

pine jettyBOT
#

lyinch

wide spear
#

If you know R and that B exists, why can't you just run gradient descent until the error is small enough?

#

In practice you never know what R and B are

#

You just run gradient descent

turbid jay
#

it's an exercice in a convex optimisation lecture ๐Ÿ™‚

#

I proved that if R and B exist, then I can find the optimum in with the above given steps

#

where epsilon is f(x)-f(x*) < epsilon

wide spear
#

Sure

turbid jay
#

but I can only reach this for the correct gamma, and to chose that I need to know R and B. Which is, as you said, not feasible

wide spear
#

Gradient descent still works if gamma is not chosen optimally

#

You just converge slower

turbid jay
#

yes

#

but I need to prove how slow

wide spear
#

Ah ok there we go

turbid jay
#

now I assume that I know R and that B exists but is unknown. I need to find a gamma such that the convergence has still the same complexity above and it's actually feasible

#

(or better complexity of course, it's big O)

wide spear
#

8da is typing stare

brave crypt
#

I don't think B is knowable, or boundable, right? No matter how finely you know f, there can be some crazy shit happen in some small neighborhood

wide spear
#

Hopefully you are optimizing on a convex compact set?

turbid jay
#

it's an assumption here, we start with convex differentiable Lipschitz functions

#

and a minimum exists

wide spear
#

Even for something like f(x)=x^2

#

B does not exist

#

f'(x)=2x is not bounded

turbid jay
#

yes, we've also treated this. To reason about such functions we need different assumptions such as strong convex functions

#

but that's not part of this problem

#

strong convexity will be treated in the next 2 exercises, don't worry ๐Ÿ˜„

#

(note strong convex is different than strict convex)

wide spear
#

Ok so what happens if you do the error analysis with an arbitrary step size gamma

brave crypt
turbid jay
#

that's for an arbitrary gamma

light rover
#

i have a question

#

nvm

#

wait I do

#

wait nvm

wide spear
brave crypt
wide spear
#

"Waifu's Region"

light rover
#

is this

#

not

#

right?

wide spear
#

It's fine

light rover
#

then whats up with this

#

my brain

#

is not comprehending

#

so which one is right and which one is wrong?

wide spear
#

They're the same

light rover
#

what????

#

they are???

#

I'm sorry

#

my brain doesnt understand that

wide spear
light rover
#

oh sorry

wide spear
#

In the first one you can divide 12 and 15 by 3

light rover
#

sorry sorry I instinctively come here bc this is for my computational math class

#

but I will note that next time

light rover
#

um I'm not sure if I'm starting this question right

#

it was the newton's multivariate method thing

#

but like my prof's notes look like this:

#

and thats kind of what I got out of it?

#

but I'm not sure if i'm even on the right track ...

hollow ingot
#

looks okay i think? you have the jacobian and the function evaluated at x, now you can do a linear solve for the step delta x.

turbid jay
# turbid jay that's for an arbitrary gamma

For anyone wondering about this question, I got the solution today. Since we know that the gradient is bounded by some B (we don't know the value), the algorithm is simply to guess the correct B. Let's call the guess B' . We initialise this by B'=epsilon/R (not sure yet why, I need to derive the proof myself) and then for every iteration, we check if the gradient <= B' . If it's not, then we double it: B' = 2B' . This means that in the worst case, our guessed bound B' is at most 2B, the real but unknown bound. Now we know B' and also know R (by assumption) and this gives us the stopping criterion T >= 4(RB'/epsilon)^2 and we have in bigO the same number of steps as mentioned above

prime kraken
#

looks like the Armijo rule

brave crypt
#

interesting

turbid jay
#

I don't know the Armijo rule but it looks indeed similar

wide spear
brave crypt
#

I would like to compute first and second derivatives of scattered 2D/3D data using fast fourier transforms, are there any good sources for this if it's even possible?

wide spear
#

Ok so you know how Fourier transforms turn derivatives into polynomials right

#

If you have data, look at Poisson summation formula or Shannon-Whitaker sampling to reconstruct the Fourier transform

#

This will at least be a starting point

lofty bone
wide spear
#

Oh Anatole are you attending Sylvie's talk

lofty bone
#

this is right now ?

#

Oh f*ck

wide spear
lofty bone
#

thanks bruh

wide spear
#

Ah I see you here

lofty bone
#

who are you ?

wide spear
brave crypt
wide spear
#

Way to ignore my suggestion

brave crypt
#

Oh sorry I'm on tablet and just missed it, reading it now

lofty bone
#

It's free in the open archive

#

HAL

#

the link is legal

brave crypt
#

Ok I will look at those formulas and that reference thank you

empty umbra
#

Hello

#

I need help

wide spear
#

Ok

#

With what

empty umbra
#

Yes

wide spear
#

Ok

#

I will say that based on the quick glimpse I saw of the image you sent, this is not the correct channel

empty umbra
#

Ohh which channel should i go to ๐Ÿฅบ

wide spear
#

Ask in one of the math help channels

empty umbra
#

Okay thank you

glad mantle
#

@wide spear do you have thoughts on how to continue, given that I can express transpose as matrix mult?

wide spear
#

Ok so you have A'=LPL'

glad mantle
#

right

#

wait no

wide spear
#

P is your permutation that we use as a transpose

#

Wait no that's not legal

glad mantle
#

well, maybe you're using different notation, but I originally had that we have A_n = A' + (LPL')_n

#

where A' is non-invertible

wide spear
#

Oh yeah

glad mantle
#

and we have that (LPL')_n -> A' uniformly

wide spear
#

You should look more into the properties of the Bruhat decomposition

#

Is all I can say

glad mantle
#

I think there is still room for it to work

#

since I know we have LUP decomp for any square matrix

#

and any triangular matrix is the limit of invertible triangular matrices

wide spear
#

Yes triangular matrices are closed

glad mantle
#

Ok, so then aren't we done?

wide spear
#

We are?

glad mantle
#

(LPL')_n = L_n P_n L'_n

#

and triangular matrices and permutation matrices are closed

#

well, maybe not permutation, is limit of permutation mat even well defined or smth

wide spear
#

Would you like to explain how you've written a general matrix as the product of two lower diagonal matrices and a permutation?

brave crypt
#

There are only finitelyany permutation matrices, so certainly closed, right?

wide spear
#

Yes finite number of permutation matrices

glad mantle
wide spear
#

I don't think the limit needs to exist

brave crypt
#

I guess we must pass to a subsequence for convergence

wide spear
#

It can keep spinning around

#

Or something

glad mantle
#

exactly my point

glad mantle
glad mantle
# wide spear Would you like to explain how you've written a general matrix as the product of ...
wide spear
#

Sure, but it is not true that you can write a general non-invertible matrix as the product of two lower triangular matrices and a permutation

glad mantle
#

yes, that's why I'm asking n the first place lol, since this is only for invertible

#

but I know that square matrices have LUP decomp, so there should be a way to extend

wide spear
#

Well you'll need to turn L' into an upper triangular matrix

brave crypt
#

Is there such a thing as LUL decomposition?

wide spear
#

No

#

For spd matrices you have Cholesky

#

Which is A=LL*

glad mantle
#

sure just take P' s.t. LPL' = L P (P' L' P'^{-1}) = L (P P') (L' P'^{-1}) = L P'' U

glad mantle
#

for D diagonal

brave crypt
#

Sadly LDL doesn't sound as lulz as LUL

glad mantle
#

which is basically cholesky like ang said

wide spear
#

Some indefinite matrices have D with negative elements

#

Which is definitely not a permutation matrix

glad mantle
#

I'm aware

wide spear
#

So you have L'=P'L'P'^-1

#

Why is P' invertible

#

Ok it's a permutation

glad mantle
#

it's the inverse permutation

wide spear
#

Sure

#

Then you say L'P'^-1 is upper triangular

#

Why is this true

glad mantle
#

that's how I chose P'

wide spear
#

Can you elaborate further

glad mantle
#

it's the permutation matrix that makes L'P'^{-1} upper triangular

wide spear
#

I don't know why you can choose P' in this way

#

Why does it exist

glad mantle
#

isn't a permutation matrix just a reordering of the rows and columns

#

can't I reorder the rows and columns of a lower triangular matrix into an upper triangular one

wide spear
#

If you have U=LP then you're saying that UL^-1=P

glad mantle
#

no I'm not

wide spear
#

I'm still not sure this P exists

glad mantle
#

I'm saying L = UP^{-1}

#

I never claim L' is invertible

wide spear
#

Sure

#

But you're writing transposition as a permutation

#

Which I'm not sure can be done

brave crypt
#

I think it surely exists right? We can prove it by drawing a triangle and reflecting it twice

wide spear
#

Can you?

#

Let's say L is diagonal

#

Then it is lower and upper triangular

#

So P is the identity

#

Clearly the identity will not take the transpose of any non-diagonal matrix

brave crypt
#

At least assuming permutation matrix is composition of row and column interchanges, and not just row interchanges

glad mantle
#

I don't understand how what you just wrote doesn't show what I want

#

then P is the identity

#

so you found such a P

wide spear
#

AP only permutes columns

#

You want the P to be the same for all of them

glad mantle
#

no I don't

wide spear
#

So that you have convergence

#

Anyways multiplying L'P only reorders columns

glad mantle
#

sure, for convergence we will need the sequence of Ps

wide spear
#

It doesn't reorder rows

glad mantle
#

the sequence of P' s s.t. each L' P'^{-1} is U

#

but a P' will always exists

wide spear
#

No

#

It doesn't

#

You need two permutation matrices to turn a lower triangular matrix into an upper triangular one

glad mantle
#

oh

#

is that your point? hm

wide spear
#

One to rearrange rows and one to rearrange columns

glad mantle
#

sure

wide spear
#

Your P' doesn't exist

#

You would need to multiply P_1LP_2

glad mantle
#

I have P'' = P P'

#

I can also write L = P_1 L P_1^{-1} if we want

#

so we'd have like

wide spear
#

You don't know that P_1^-1 is P_2

glad mantle
#

$$LPL' = (P_1 L P_1^{-1}) P (P_2 L' P_2^{-1}) = P_1 L (P_1^{-1} P P_2) L' P_2^{-1} = P_1 L U P_2^{-1} $$

pine jettyBOT
#

davidW

glad mantle
#

maybe you're right we're missing another matrix, or does this fix anything

#

I'm not sure

wide spear
#

Why is there a P_2 inverse at the end

glad mantle
#

did you see the latex I put above

wide spear
#

Yeah

glad mantle
#

we get to pick P1 and P2

wide spear
#

It should be in U

glad mantle
#

well, I hesistated to write that since then you have

#

P_1^{-1} P (P_2 L' P_2^{-1}) = P_1^{-1} P L'

#

so if we needed to choose 2 matrices to be able to permute the rows and columns then you'd want to group (P_1^{-1} P P_2) so it acts on L' to make it U

wide spear
#

You misunderstood the 2 matrices

#

You need to multiply one matrix in front and one matrix after

#

Multiplying before permutes rows, multiplying after permutes columns

glad mantle
#

Ok sure

#

$$LPL' = (P_1 L P_1^{-1}) P (P_2 L' P_2^{-1}) = P_1 L (P_1^{-1} P P_2) L' (P_2^{-1}) = P_1 L U$$

pine jettyBOT
#

davidW

glad mantle
#

so now the two parenthasized permutation matrices act on L' before and after, respectively

wide spear
#

Yes

#

What's next

glad mantle
#

I'm not sure, did you have any thoughts?

wide spear
#

Well, do you want the individual matrices to converge?

#

This is hard

#

Because you only had bounds on the product of the matrices

glad mantle
#

actually now I see

#

(sorry :p)

wide spear
#

Well, as the condition number of A_n goes to infinity, these 3 matrices can behave wildly

glad mantle
#

sure so let's add some error mats

#

yep

wide spear
#

They will behave wildly probably

glad mantle
#

but we know PLU is indeed a way to represent a square mat

wide spear
#

Yes

glad mantle
#

we shouldn't need any other conditions on these matrices

wide spear
#

But we don't know that the PLU coming from the Bruhat decomposition is

glad mantle
#

?

wide spear
#

I don't know do we

#

Maybe we do

glad mantle
#

why would we

wide spear
#

Why does PLP^-1=L

glad mantle
#

we know A is square, and L is any triangular matrix and U is any triangular matrix, and P is a permutation matrix

wide spear
#

Right multiply by P gives you PL=LP

#

But there's no reason for these to be the same

glad mantle
wide spear
#

LPL' = (P_1 L P_1^{-1}) P (P_2 L' P_2^{-1}) = P_1 L (P_1^{-1} P P_2) L' (P_2^{-1}) = P_1 L U

glad mantle
#

where did I use the equality you wrote

wide spear
#

You wrote L=P_1LP_1^-1

glad mantle
#

yes

#

we get to pick P_1

#

oh

#

did I just use the identity matrix lmao

wide spear
#

Yes

#

So this doesn't work

glad mantle
#

good catch

glad mantle
#

by definition of permutation matrix basically

wide spear
#

Well

#

No

#

P_1P_1^-1L=L

#

And P_1^-1 exists because permutations are a group

#

But when you are inverting group elements you need to act from the same side

glad mantle
#

right, but if I first permute the entries then I move them back why is that not what I started with

wide spear
#

When you do P_1LP_1^-1 you have P_1^-1 permuting the columns and P_1 permuting the rows

#

How can a column permutation and a row permutation cancel each other out?

glad mantle
#

ah ok, sorry for dumb question lol

wide spear
glad mantle
#

@wide spear so now I think I see why you brought up cholesky before, since bc A is invertible so we have cholesky, and we're gonna be able to choose L = L', with P being the inverse ordering of the rows

wide spear
#

Invertible does not mean psd

glad mantle
#

whoops positive definite

wide spear
#

Invertible does not mean positive definite

glad mantle
#

touche

wide spear
glad mantle
#

@wide spear so why did you think this related to cholesky then?

#

if we're only demanding invertible and never anything psd

wide spear
#

Burhat feels like Cholesky

glad mantle
#

it do ๐Ÿ˜ฉ

wide spear
#

But it isn't

glad mantle
#

it's cholesky but made worse by algebraists

wide spear
#

Yes exactly