« first day (944 days earlier)      last day (2286 days later) » 

11:05 AM
Wie jetzt, wir haben Schweizer hier?
 
there is one indeed
 
11:51 AM
@flawr FEM halp plz plz
 
 
2 hours later…
1:36 PM
@AnderBiguri good morn-fternoon
 
1
Q: How to compute the gradient of the function on a triangular mesh

Ander BiguriGiven an arbitrary (lets say 2D) triangular mesh, with known $(x_i,y_i)$ locations of points, and numerical values of a function $f$ on them (either in the nodes, or in the centroids of the triangles, doesn't matter) like this random example, how can I obtain a numerical approximation of the dire...

I posted it somewhere
When I realized the problem was harder than I thought
@flawr how you doing btw
 
hahaha, I just remembered that I edited my math.SE profile
> Despite all appearances I am not a sock puppet of user Ander Biguri; we just know each other from the MATLAB and Octave chatroom on Stack Overflow.
 
@AndrasDeak <3 I do remember XD
 
@AnderBiguri Piotrs answer makes most sense, provided you have the neighbours of each node
 
Yes, definitely I like that answer
still will leave the question open and read a bit more about the problem to be sure
 
1:50 PM
make sure that whatever you use is consistent with simple cases: planes and local maxima
 
What do you mean?
 
@Andy Nö, nur deutsche :D
@AnderBiguri evaluate e.g. a constant or a parabolic function, compute your gradient, quiver() it and make sure what you see makes sense.
 
I see
 
I'll write another answer based on the gradients on each triangle
 
Yeah! :D
I am still exploring my problem, but I think I need gradients in the nodes. However, my calculations will always result in me computing the values of the triangles. So I am interested!
 
1:55 PM
Yeah, I meant defining an exact plane on your mesh and checking that what gradient you get is ~the same as what you put into it. And looking at the max of a paraboloid. A constant plane wouldn't be too informative I'm afraid
 
@AndrasDeak Fortunately I am generating the meshes from images, so I should be able to test simple and complex cases
 
if you have whatever mesh the plane is as simple z=fun(x,y), z = a*x+b*y; end
the paraboloid is only marginally more complicated because you need to put its center around your node of interest, but basically z = a*(x-x0).^2 + b*(y-y0).^2;
 
Yup! So should I create a plane/paraboloid going trough an specific node? or just one for the entire mesh
 
@flawr wait, you're not Swiss, just among Swiss? Or do the Swiss in German cantons don't regard themselves as Swiss? :P
@AnderBiguri if you want numerical gradients, you'll probably need function values at neighbouring nodes ;)
I'd generate the full functions and just look at the grad at the node(s) of interest
 
@AndrasDeak yeah yeah XD But you mention outting the center of the paraboloid in the node
 
2:00 PM
yes, because that's the point where we know that the grad should be 0
 
this is just because its interesting to have a node in the local maxima, right?
 
@AndrasDeak I am swiss, just pretending to be german :)
 
any other point for the paraboloid will have nonzero gradient
 
yes, I get it
Thanks my differentiation friends
 
good luck :)
 
2:02 PM
∂Knoledge/∂friendship > 0
@flawr wait, I am missing something in that answer of yours.
what about different sized triangles. or triangles whose center is very far from the node?
oh, you edited
 
@AnderBiguri you have to judge yourself what you value more. when you have a more uniform mesh (all triangles have ~ the same size) both should work well
 
But I wont.
 
then the method weighing the angles would probably fare better
 
I know it's not in the question, but I will definitely not have a uniform mesh
@flawr makes sense!
 
another method would be (least squares)- fitting a plane through all neighbouring points.
 
2:12 PM
OK, so side question, that may be, or not, complicated (let me know if I should add to the question or open anew one if its too complicated): What if I only know values at the centroid of the triangle?
 
@flawr yup, that would work well for the plane and extremum tests
it will be a pain to compute though
then again least squares for a plane is pretty easy by hand
 
@AndrasDeak magic wand \?
 
but for every single node separately...
 
yep, I don't think you can get around that.
@AnderBiguri you can apply the same approches that were mentioned in those answers
 
yes I am an idiot
just my (x_i,y_i) is a different location
 
2:17 PM
But you should maybe consider what is needed for these: Some use knowledge of the incident edges, some require knowledge of the incident elements.
 
you have the dual of the mesh, right?
 
@AndrasDeak i.e. connection on elements among them, right? yes I do
@flawr what are you referring to? these? the methods?
 
@AnderBiguri yep
 
For flawr's method, I could compute the gradient of the element on the dual mesh, and then use the element->point angle weighed equation, for example
While for piotr's method, I could directly use the vectors from the node to the centroid of the elements, as long as I know which elements connect to each node
lots of things to test :D
 
2:40 PM
@AnderBiguri the dual mesh will not consist of triangles, right?
 
huh.... Not the voronoi mesh, nope
 
ps: why is it that you do not try to use meshes that are as "uniform" os possible?
 
@flawr because with the gradient, I will move the nodes location
@flawr but I do have the "connectivity" of the elements. Hum I have no idea of the mathematical implications of the dual mesh tbh
 
@AnderBiguri to optimize the mesh, or do you do that for something else?
 
Again, its not a FEM. My objective is finding edges that are in the continuous function f
for that, I will move the nodes, to match the edges
my function is an X-ray image though
 
2:50 PM
so you want to align the edges of the mesh with the edges within the image?
 
yes, the unknown image
It is complicated, but I honestly do not have the XY problem :P
I promise
I essentially need to do image processing stuff in triangular meshes
 
@AnderBiguri that in itself sounds horrible enough^^
 
I gain memory, but lose on "easiness". E.g. Gradient is easy in an image
@flawr ah, research
It is actually challenging and fun
we will see if it works
 
@AnderBiguri blink with your left eye if you're forced by your boss to say this!
 
hahaha
it is genuinely nice. I like coding this kind of stuff. Almost anythign else that I would be doing, I'd need some 3rd party software, and that is boring. As no one has worked on what I am, I need to figure out everything
its fun
and frustrating, but that is why I have my maths friends <3
 
2:57 PM
awww <3
 
56 mins ago, by Ander Biguri
∂Knoledge/∂friendship > 0
 
partial knowledge divided by partial friendship is greater than zero?
 
yes, the more friendship the more knowledge
positive
OK, im an idiot
 
I thought it was complex analysis because all my friends are imaginary.
 
badum tsss
 
3:03 PM
:D
 
question: I have some trimesh plots, and I need to print them out, is there an ink-saving colour map?
 
"snowflakes" colormap...
 
red-blue?
 
a I could make one myself
the plots are zero almost everywhere
so I should have white there
 
then the red-blue one will work
 
3:10 PM
@AnderBiguri flag?
 
@AnderBiguri oooh cool, thx!
 
@AnderBiguri Dutch flag!
 
@Adriaan we shoudl report it, and rename it
 
@Adriaan you obviously mean the french flag XD
 
3:19 PM
@flawr No, that's rotated. The image clearly shows a vertical colourbar
 
posted on January 30, 2018 by Loren Shure

Recently a customer asked me an interesting question about a good way to compute something. Before I sat down to tackle it, I happened to mention the problem to my pal, Sean. And he quickly answered, "max logical". It took me just a moment to realize what he was saying, and it is the answer to the problem. But when I heard it, I heard a person's name "Max Logical", and though I didn't kno

 
3:59 PM
@Feeds "Have You Embraced Logical Indexing?"
Sounds like a cult
 
4:26 PM
@flawr easier to get to hot list from maths aparently
you may get some random upbvotes
 
@AnderBiguri I'm more concerned about the spelling of MATLAB directly beneath the arrow :P
 
Its a common one
 
5:04 PM
@AnderBiguri Have you given thanks to your Lord and Savior accumarray?!
 
"Oh, he, that adds to all things"
 
5:21 PM
"Oh, he, that brings us together, like with like"
 
 
2 hours later…
7:15 PM
@Dev-iL my job has been bumming me in the anoos for the past few months haha, I've barely even had time to be here!
 
8:06 PM
Yeah, I figured you could top Sam's despair easily :|
 
8:48 PM
Hi people !
how do you test if your Jacobian matrix is right?
 
9:03 PM
@feddy use finite differences to approximate it and compare?
 
@fla
 
@fed
 
lol

@flawr thanks, I didn't know that command. I used to compute the fifference quotient, taking a small h: lim as h \rarr 0 of (F(u+hv)-F(u))/h, with u and v random vectors
 
@feddy right, that is what I'd do otherwise:)
 
Good :)
But it is suffering from numerical cancellation, right? How do you choose that h?
 
9:12 PM
@feddy I'd plot the errors you get for `h = 2^0, 2^-1, 2^-2, 2^-3,.... and check if you get the right order of convergence for the difference quotient you used
 
Ok, it's everything clear :) Thanks @flawr :)
 
@feddy np:)
oh and regarding the cancellation: you probably expect that around 10^-15 provided your function f is more or less stable. (because matlabs machine eps = 2.2204e-16)
 
9:52 PM
Just got StackOverflow/ServerFault keyboard. My life is so easy. I can solve all problems now. Via https://www.reddit.com/user/Soullesswaffle
3
 
@feddy for analytical functions there's also complex step differentiation. Damn useful stuff
@flawr that's not matlab's eps, that's double precision :)
 
@AndrasDeak it is matlab's, not every langauge uses double
some use single
some half
some quarter
 
@ballBreaker ye bloody wanker, finally found time to gloat about you having a job? ;) Welcome back you slacker!
 
10:09 PM
@AndrasDeak why are they comparing a single sided difference quotient to a double sided one?
 
@AndrasDeak I'm gonna read it... so interesting :)
 
@AndrasDeak I don't quite get why this should be better than any other old direction:/
 
@flawr read what I linked. It avoids the loss of precision by not taking the difference of two small numbers
@flawr I don't remember the details but I think the forward difference would be even worse (less stable)
 
@AndrasDeak it is just using two complex number instead (you probably wanted to say to very close numbers)
 
could be, as I said the details are hazy, and I was astonished when I first read it. The point is that is just works
@flawr there are different representations, sure. But all the languages I'm familiar with use IEEE 754 doubles by default
 
10:21 PM
I have the impression that you could also have functions where the "real" way works better, not sure?
@AndrasDeak sure, I was just joking, wanted to post the link there :)
 
Fpc = @(x,h) imag(F(x+i*h))/h; <-- where's the difference of small numbers?
oh, yes, very close numbers. But anyway, the complex one doesn't take a difference at all
 
@AndrasDeak d'oh now I see, thank you!
I've seen too many difference quotients in my life, now I even see them where there aren't any.
From now on I deny the existence of non-analytic functions.
 
10:38 PM
it's actually not that practical, because usually you either have numeric data or you can compute everything on paper. But feddy's problem is a rare exception where you have an analytical function but wnat to compute its numerical derivative :)
 
as an alternative you could just continue using finite differences but use quadruple instead of double
 
good luck with that :P
 
did you read the IEEE754-RRP quarter precision floating point specs I posted above? :)
 
nope :P
 
 
1 hour later…
11:52 PM
> Numerical precision issues in the wau the matrix power is computed
@LuisMendo *way?
 
wou
:-) Thanks. Corrected
 
;)
 

« first day (944 days earlier)      last day (2286 days later) »