@narain@mathstodon.xyz avatar

narain

@narain@mathstodon.xyz

Associate professor of computer science at IIT Delhi. Computer graphics, numerical methods, bad jokes.

I was on Mastodon before it was cool. But it's nice to have all you cool people here now too.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

bleuje, to random French
@bleuje@mastodon.social avatar

simulation made earlier this year: experimentation based on physarum simulation algorithm, using some parameters and ideas from Sage Jenson

https://www.youtube.com/watch?v=rZadY-4G92I

narain,
@narain@mathstodon.xyz avatar

@bleuje Fascinating! Is there anywhere I can read more about how these algorithms work?

narain, to random
@narain@mathstodon.xyz avatar

What is the area of a 3D polygon p₁p₂...pₙp₁? If the polygon is non-planar, this is not well-defined: if you split up the polygon into triangles pᵢpⱼpₖ and add up their areas ½‖(pⱼ−pᵢ)×(pₖ×pᵢ)‖, the result depends on the choice of triangulation. However, if you forget to take norms and just add up the vectors ½(pⱼ−pᵢ)×(pₖ×pᵢ) instead, you always get the same result: the "vector area" of the polygon! So if you're dealing with non-planar polygons, or non-planar curves in general, it makes sense to think of area as a vector rather than a scalar.

Further reading: https://en.wikipedia.org/wiki/Vector_area

narain, to random
@narain@mathstodon.xyz avatar

(axiom|Advent|Alexandria)
(of|Ocasio)
(Code|choice|Cortez)

j_bertolotti, to random
@j_bertolotti@mathstodon.xyz avatar

A few people on Xwitter were interested, so I added to my "Brief introduction to variational calculus" the calculation showing why sea waves almost always seem to arrive parallel to the shoreline: https://jacopobertolotti.com/VariationalCalculusIntro.html

narain,
@narain@mathstodon.xyz avatar

@j_bertolotti Even without solving the differential equation, one can see that y' = c√(x(1 + y'²)) implies y' = 0 when x = 0.

j_bertolotti, to random
@j_bertolotti@mathstodon.xyz avatar


If you sample N points uniformly on the unit sphere, take for each the halfway point to the north pole of the sphere, and then project is on the x-y plane, you obtain N points sampled uniformly on the unit disk.

(A request from @narain )

Black and white visualization on N points on a sphere moving smoothly to their halfway point to the north pole and then being projected on the x-y plane.

narain,
@narain@mathstodon.xyz avatar

@dduque Yes, the point is that the transformation maps a uniform probability distribution on the sphere to a uniform probability distribution on the disk. @j_bertolotti's (deterministic) choice of samples cleverly also results in well-spaced points in both domains, but in general this will not hold -- distances between nearby points do get squashed and stretched quite a lot.

Sampling uniform random points on a sphere is easy: you uniformly sample the z-coordinate in [−1, 1], then you uniformly sample the "longitude" in [0, 2π). Admittedly, it's not obvious that this results in a uniform distribution on the sphere -- it relies on a magical coincidence that only works in 3 dimensions!

narain,
@narain@mathstodon.xyz avatar
narain,
@narain@mathstodon.xyz avatar

@dduque @j_bertolotti There's a lot of ways to skin this particular cat. MathWorld lists many of them: https://mathworld.wolfram.com/SpherePointPicking.html
I'm guessing the reason the books chose these methods is that they require no transcendental functions, only arithmetic operations and a square root.

narain,
@narain@mathstodon.xyz avatar

@j_bertolotti Maybe I should stop hogging the replies on your toot...

narain, to random
@narain@mathstodon.xyz avatar

Here's a rather niche derivation in computer graphics theory that leads to a surprising and generally interesting fact about spheres. Please tell me if this has been noticed before.

In path tracing of Lambertian (i.e. diffuse) surfaces, we need to perform cosine-weighted sampling of a hemisphere, i.e. choose a point in {(x,y,z) : x² + y² + z² = 1, z ≥ 0} with probability density proportional to z. Depending on how you simplify the equations arising from inversion sampling, you get one of two possible methods:

A.1. Sample a point (x,y) uniformly from the unit disk.
A.2. Project it up to the hemisphere by choosing z = √(1 − x² − y²).

B.1. Sample a point p = (x,y,z) uniformly from the unit sphere.
B.2. Take the unit vector halfway between it and the north pole n = (0,0,1), i.e. (p + n)/‖p + n‖.

It's very strange to me that a routine calculation can be simplified in two different ways to yield two very different geometric interpretations -- in particular, two interpretations that by themselves cannot easily be related to reach other.

In fact, putting them together yields the (non-obvious!) fact that the following bijection between a sphere and a disk is area-preserving, up to a constant factor:

C.1. Given a point on a sphere, take the point halfway between it and the north pole.
C.2. Project it down to the xy-plane to get a point on the unit disk.

Since there is only one such equal-area map with rotational symmetry, we must have just reinvented the Lambert azimuthal equal-area map projection!

narain,
@narain@mathstodon.xyz avatar

I've been sitting on this toot for months, thinking I'd make a beautiful 3D animated visualization to go with it first. Never got around to it. I don't know how @gregeganSF and @j_bertolotti do it.

narain,
@narain@mathstodon.xyz avatar

@j_bertolotti Looks about right! Might be clearer to have a bunch of points all move at the same time, so you can see that they form a uniform distribution on the sphere, a cosine-weighted distribution on the hemisphere, and a uniform distribution on the disk?

narain,
@narain@mathstodon.xyz avatar
gregeganSF, to random
@gregeganSF@mathstodon.xyz avatar

The volume of a ball of radius r in n dimensions is

B(n,r) = π^{n/2}/Γ(n/2+1) r^n

If you look at the volumes of the balls (blue circles) inscribed inside hypercubes with edge length 1 and volume 1, they go to zero as n gets larger:

lim n→∞ B(n,½) = 0

If you look at the volumes of the balls (red circles) that circumscribe each hypercube (of diagonal √n), they go to infinity:

lim n→∞ B(n,½√n) = ∞

But what if you always choose the radius of an n-ball so that its volume is exactly 1 (green circles)?

r₁(n) = Γ(n/2+1)^{1/n} / √π

This gives us B(n,r₁(n)) = 1

It turns out that:

lim n→∞ (r₁(n) - √[n/(2eπ)]) = 0

In other words, r₁(n) is asymptotic to a multiple of √n, so it approaches a fixed ratio with the length of the diagonal of the hypercube with the same volume.

Projections of n-cubes for n=2 to 12 so that their outline is a 2n-gon. Blue, green and red circles centred on the projection show the radii of the inscribed ball, the volume-1 ball, and the circumscribed ball.

narain,
@narain@mathstodon.xyz avatar

@gregeganSF So in high dimensions a simplex is fundamentally "pointier" than a hypercube. What about an n-orthoplex (hyperoctahedron)?

narain,
@narain@mathstodon.xyz avatar

@gregeganSF Darn, I was hoping it would be something funky in between, like n^(2/3) or √n log n.

narain,
@narain@mathstodon.xyz avatar

@gregeganSF As a computer scientist I'm perfectly happy with just letting the ratios go to 1. Or even any nonzero constant!

graveolensa, to random
@graveolensa@mathstodon.xyz avatar

https://arxiv.org/abs/2311.06596

/Surfaces in The Tesseract/
Manuel Estévez, Erika Roldan, Henry Segerman (@henryseg)

Abstract: How can we visualize all the surfaces that can be made from the faces of the tesseract? In recent work, Aveni, Govc, and Rold'an showed that the torus and the sphere are the only closed surfaces that can be realized by a subset of two-dimensional faces of the tesseract. They also gave an exhaustive list of all the isomorphic types of embeddings of these two surfaces. Here, we generate 3D models of all these surfaces. We also exhibit, with the help of some hyper-ants, the minimum realization of the M"obius strip on the tesseract.

narain,
@narain@mathstodon.xyz avatar

@demofox @henryseg @graveolensa I think it's a topological torus (a polyhedron with a hole), not a geometrically round doughnut shape. See Figure 3.

christianp, to random
@christianp@mathstodon.xyz avatar

Here at the International Campaign to Stop Styling Links as Undecorated Red Text, we've decided to take a more militant stance.

We're calling for a complete boycott of all undecorated red links. Comrades shouldn't even try to look for them.

narain,
@narain@mathstodon.xyz avatar

@christianp As a comrade I will henceforth try to click on all the text in the page that ISN'T red.

j_bertolotti, to random
@j_bertolotti@mathstodon.xyz avatar

I have added to my personal webpage a brief high school math-level introduction to what tensors are, with the hope to make them a bit less scary to people encountering them for the first time:
https://jacopobertolotti.com/TensorsIntro.html

narain,
@narain@mathstodon.xyz avatar

@j_bertolotti @matthras Probably a stupid question but... Should one think of an inner product as a (0,2) tensor? It takes two vectors and creates a scalar. Any students reading about tensors would probably know the standard dot product as a particular example of an inner product.

narain,
@narain@mathstodon.xyz avatar

@j_bertolotti Is it really? Admittedly I don't know much about this stuff, but I thought that what you're saying would correspond to application of a 1-form to a vector, which requires no additional structure, and is distinct from the inner product of two vectors, which requires the specification of a metric tensor. Maybe I'm reading too much into it. And in any case this is too much for a high school student!

narain,
@narain@mathstodon.xyz avatar

@j_bertolotti If you're allowed to transpose, why even bother with the "row of rows" interpretation in the first place? You could just say "a (0,2) tensor is just a matrix, you can put in two vectors u and v and get a scalar by doing uᵀMv".

narain,
@narain@mathstodon.xyz avatar

@j_bertolotti Or maybe the confusion is that by default I think only about real vector spaces and you are considering complex vector spaces as well...

gregeganSF, (edited ) to random
@gregeganSF@mathstodon.xyz avatar

The easiest way to start conceptualising gravity as a geometric effect is to ponder the simplest toy model: the convergence of great circles on a sphere. Two nearby meridians are “as close to parallel as they can be” at the equator, and ships/planes that follow them will certainly not be accelerating sideways, but they will nevertheless draw closer together.

That takes the geometry for granted rather than trying to explain why (or in precisely what manner) space-time geometry is curved by the presence of mass, but it captures the essence of the kinematics. The worldline through spacetime of a free-falling body is a geodesic, and it’s a failure to follow a geodesic that involves what’s known as a “proper acceleration”, requires a force, and is perceived as weight.

The weight you feel as you stand, motionless, with respect to the Earth is due to the fact that your worldline is curved compared to the spacetime geodesic that would take you towards the centre of the Earth. But in principle, that’s no stranger than the sideways force required to keep a ship/plane at a constant (non-equatorial) latitude, rather than following a great circle.

Edit: This was meant to be a reply to:

https://mathstodon.xyz/@benleis/111146740106068901

by @benleis but for some reason didn’t connect to it.

narain, (edited )
@narain@mathstodon.xyz avatar

@j_bertolotti @gregeganSF I guess the problem is that the sphere is a Riemannian manifold, and hence can only model curved space, not curved spacetime. Is there an easy-to-visualize example of a curved (1+1)-dimensional Lorentzian manifold immersed in 3-space (if such a thing is even possible)?

topher_batty, to random
@topher_batty@mastodon.acm.org avatar

I'm very excited to share our new SIGGRAPH Asia 2023 paper on improved reconstruction of explicit surface meshes from signed distance field data: "Reach for the Spheres: Tangency-Aware Surface Reconstruction of SDFs".

https://odedstein.com/projects/reach-for-the-spheres/

narain,
@narain@mathstodon.xyz avatar

@topher_batty Could this be considered an argument for using "closest point fields" which store the vector to the actual closest point on the surface, rather than just the distance to it? After all, this point is usually known at the time of SDF construction. And in your algorithm (I haven't read your paper yet, but I assume) you're having to figure out the closest point along the way, whereas if you already had it life would be much easier.

narain,
@narain@mathstodon.xyz avatar

@topher_batty Neat! I found this graphics paper after searching for "closest point surfaces" https://diglib.eg.org/handle/10.2312/conf.EG2013.short.001-004 but it also cites the 2008 CPM papers as the source of the idea. Bit odd that there seems to be very little done along these lines since then. Also, since the closest point function is essentially the SDF times its gradient, I guess it's similar in spirit to the higher-order spatial interpolation methods (using both the values and the gradients of a scalar field) that people were exploring in fluid sim in the 2000s.

narain, to random
@narain@mathstodon.xyz avatar

Cool rainbow effect in the reflection in a metro train window.

What could be the reason for this? I assume it's an LCD screen so the light coming out of it is polarized, but I'm not sure what's going on at the glass interface to cause the colour shift.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Leos
  • ngwrru68w68
  • InstantRegret
  • thenastyranch
  • magazineikmin
  • GTA5RPClips
  • rosin
  • osvaldo12
  • tacticalgear
  • Youngstown
  • slotface
  • khanakhh
  • kavyap
  • DreamBathrooms
  • JUstTest
  • modclub
  • everett
  • provamag3
  • cubers
  • cisconetworking
  • ethstaker
  • Durango
  • mdbf
  • anitta
  • megavids
  • normalnudes
  • tester
  • lostlight
  • All magazines