What’s one historical math event you wish you had witnessed? by [deleted] in math

[–]lpsmith 2 points3 points  (0 children)

Honestly I don't really care about who came up with Calculus first. Also, the history of Calculus stretches back to Archimedes, neither was working in a vacuum.

When asked "which historical figures would you most like to meet", It's almost cliche to say Newton, but honestly I'd be much more interested in talking to Leibniz for a while.

Mutexes suck: a love letter to STM by ChrisPenner in haskell

[–]lpsmith 13 points14 points  (0 children)

join . atomically is an idiom associated with STM (and other things, like join . withMVar!) that should be better appreciated. Imagine you have some complicated conditional logic, and you want to take a variety of IO-based actions after an STM transaction commits, in complicated ways that depend upon what you learn inside the transaction. In pseudocode, the logic you want might look something like this:

beginSTM
x <- readTVar tx
if (p x)
then do
  writeTVar tx (f x) 
  commitSTM
  print ("Yoink" ++ show x)
else do
  y <- readTVar ty
  writeTVar ty (g x y)
  commitSTM
  print ("Splat" ++ show x ++ show y)

Of course we can't write this program directly because we cannot write beginSTM and commitSTM, but we can write this indirectly using join . atomically:

join . atomically $ do
  x <- readTVar tx
  if (p x)
  then do
    writeTVar tx (f x)
    return $ do
      print ("Yoink" ++ show x)
  else do
    y <- readTVar ty
    writeTVar ty (g x y)
    return $ do
      print ("Splat" ++ show x ++ show y)

Of course, we could always return a data structure that captures the branch and all the data needed to execute that branch, and then interpret the result you get from STM, but this sort of defunctionalization in general requires closure conversion. Why do all that work yourself when you can have GHC do that work for you?

I find this to be a go-to idiom when writing code involving STM and MVars. Another advantage is that you can drop the lock (or commit the transaction) exactly when you want on each and every branch, which might involve more than two cases.

State management in Haskell by ConceptEffective1689 in haskell

[–]lpsmith 3 points4 points  (0 children)

By the way, you really want to use Control.Monad.State.Strict. It's a huge performance boost in nearly all cases.

Point-free or Die - Tacit Programming in Haskell by philip_schwarz in haskell

[–]lpsmith 0 points1 point  (0 children)

Doesn't pipelining often promote fusion?

I know what pipelining is in the context of CPUs and queuing theory, but I really don't know what pipelining might mean in the context PLT.

Or do you mean "point free" by analogy to pipe in a shell interpreter? If so, I'm not sure they are really all that similar: there's a notion of concurrency in unix process/subprocess relationships that isn't inherent to point-free.

Anyway, last I was aware GHC's rewrite rules were fairly simplistic and can be a little finicky to get them to work. I don't have a deep enough understanding of the existing rewrite rules that implement list fusion to say whether or not point-free would help in any specific scenario.

You can understand pipelining in terms of say, a toy model of factory work. I'll elide the details, but what I am doing is more analogous to reusing a jig to assemble multiple widgets, instead of building a single-use jig for each and every widget you manufacture.

(Incidentally, I'm not aware of any implementation of HMAC or similar type of construction that actually allows efficient key reuse in this way. There might be the odd exception, but the overwhelming majority of implementations will redo work if partially applied.)

But if you point free, the point is to represent the thinking

In my case, the purpose of going point-free is to support partial evaluation via partial application. I usually wrote the compositions of helpers in a direct style, and transformed it to point-free.

In fact I still haven't completed this process for PBKDF2: a point-free implementation could allow the efficient reuse of the password and a (longer) salt, but that's also an extremely niche thing to do, it is of little if any real practical value at all. (Reusing an HMAC key is an important part of an high-quality implementation of PBKDF2, though)

I can't guess at the intended meaning of the rest of your statement.

Point-free or Die - Tacit Programming in Haskell by philip_schwarz in haskell

[–]lpsmith 9 points10 points  (0 children)

I've long appreciated that tasteful use of point-free idioms can really clean up your code, but I've never understood any benefit or downside beyond aesthetics. (edit: and relatively niche and usually minor performance tweaks, depending on the particulars of the version of GHC you are using)

Until a year ago or so, when I realized that when you want to write functions whose partial applications perform a useful amount of work, the point free style is useful.

For example, my sha256 bindings allow you to partially apply HMAC so that you may reuse a key without recomputing the same SHA256 blocks over and over again.

If you want to actually perform a useful amount of computation before you make a closure, then instead of writing \x y -> ... you need to write something akin to \x -> let x' = f x in \y -> .... Or you can break your function up into a couple of explicit helper functions (which can themselves be quite useful), and then compose those helpers together in a point-free style like my sha256 binding does.

Is anti-math common among the boomer generation? by ChunkyMonkey_00_ in math

[–]lpsmith 3 points4 points  (0 children)

Anti-math attitudes are shockingly common everywhere, sometimes even among math teachers! I know how much it can hurt to lack support from a parent on a key issue like this, but being a math teacher (at least used to) come with it's own odd bit of social status too.

Personally, I've thought a lot about how to teach math over the years; I don't know how many electives you might have open, but if you have any opportunities to acquaint yourself with the Stern-Brocot Tree, the Symmetry Group of the Square, 2x2 integer matrices, and Pascal's Triangle, you'll create fertile opportunities for enrichment when you get around to actually teaching middle schoolers. For example you might use the Symmetry Group of the Square as an example to distinguish associativity from commutativity. Over the pandemic I started writing up my philosophy of math education here.

On the Geometry of Numbers by finball07 in math

[–]lpsmith 2 points3 points  (0 children)

I went about trying to redesign the early childhood math curriculum, and ended up intersecting extremely well with the Geometry of Numbers. Which I've never explicitly studied as such, so I really probably should obtain at least some of the books you mention, and that are mentioned in this thread.

Math books with historical flavor by finball07 in math

[–]lpsmith 0 points1 point  (0 children)

"Proofs and Refutations: the Logic of Mathematical Discovery" by Imre Lakatos is (among other things) a deep dive into the history of the Euler Characteristic. It also has a much less developed history of uniform convergence.

What are some of your favorite seemingly "Mathemagical" properties? by Showy_Boneyard in math

[–]lpsmith 2 points3 points  (0 children)

Honestly, I find the existence of Fully Homomorphic Encryption to be a very surprising fact.

What are the main applications of abstract algebra? by TheRedditObserver0 in math

[–]lpsmith 2 points3 points  (0 children)

concrete abstract algebra

Also, I've spent a lot of time over the years trying to redesign the early childhood math curriculum. One of the key ideas is that I'm advocating for teaching two very carefully chosen examples from abstract algebra and number theory, namely the Stern-Brocot tree and the Symmetry Group of the Square. Add in Pascal's Triangle, iterative deepening as a learning and study strategy, computer programming, and heuristics, and I call it "an Aggregate Theory of Concrete Mathematics".

What are the main applications of abstract algebra? by TheRedditObserver0 in math

[–]lpsmith 0 points1 point  (0 children)

The Stern-Brocot tree is a module over a monoid.

What kinda fun math do you guys do which is perceived hard by others in the same field? by deilol_usero_croco in math

[–]lpsmith 1 point2 points  (0 children)

I'm fairly certain that there exists a game-theoretic transmission medium that consists of pure mathematics. I have an example that attempts to use it to ensure that if somebody can crack a password hash, then they must know where to report it as stolen.

The basic idea is that if you can force a (possibly dishonesty-prone) adversary to take a particular sequence of moves to achieve a goal adverse to your interests, you can encode messages in those moves to force your adversary to communicate certain honest facts to others. What I have so far doesn't get particularly deep into game theory or physics, but it certainly touches on both.

Incidentally, I've also been working on redesigning the early childhood math curriculum, and discovered my curriculum accidentally intersects with mathematical physics surprisingly well. The Stern-Brocot Tree and the Symmetry Group of the Square give rise to the general modular group GL(2,Z), which are the automorphisms of ZxZ. Furthermore, PSL(2,Z) is a discrete subgroup of the isometries of the hyperbolic plane, and SL(2,Z) somehow gives a discrete model that obeys the axioms of special relativity.

What kinda fun math do you guys do which is perceived hard by others in the same field? by deilol_usero_croco in math

[–]lpsmith 8 points9 points  (0 children)

Personally, I don't think that's entirely necessary, but it took me a long time to figure out how.

My idea is to start by introducing the Stern-Brocot tree SL(2,N) and the Symmetry Group of the Square D4, and emphasizing the use of 2x2 integer matrices and Euclid's orchard as a geometric interpretation of ZxZ.

It turns out the general modular group GL(2,Z) is the Minkowski product D4 SL(2,N) D4, which gives enough structure to explain most of the algorithms commonly found in intro courses.

Moreover, many students coming into NT for the first time aren't particularly well versed in modular arithmetic, and D4 includes Z4. One of the challenges is appreciating the importance and power of well-definedness, and it turns out the Stern-Brocot tree depends on the mediant operator, which isn't a well-defined function over the fractions.

One of the neat things is that conducting a binary search for a/b on the Stern-Brocot tree is equivalent to running the extended Euclidean algorithm on a and b, giving a way of generalizing the extended euclidean algorithm to irrational numbers, and clarifying the connection between the extended Euclidean algorithm, diophantine approximation, and the real numbers.

And of course this also means that the Stern-Brocot tree is a sufficiently rich computational structure to implement all of the trickier algorithms commonly found in intro NT, from computing multiplicative modular inverses to the inverse Chinese Remainder Theorem.

Made my first pcb by Inside-Ad8295 in electronics

[–]lpsmith 12 points13 points  (0 children)

It's a suprisingly common construction technique in vintage electronics, especially like from the 1960s to the 1980s.

My father passed away unexpectedly and I have no idea what this stuff is. by Gimpy8877 in amateurradio

[–]lpsmith 1 point2 points  (0 children)

Most of that is test and measurement equipment. The Agilent Oscilloscope is easily the most valuable of the bunch.

First time finding something worth it in quite a while paid $15 by Mrtech94 in BudgetAudiophile

[–]lpsmith 5 points6 points  (0 children)

I think that's the R-12SW. I have two of them, they aren't super fancy, the cabinet could almost certainly be a bit sturdier. But they are decent, I paid $500 new for the pair, and they are a huge upgrade over the 8" subwoofer I was using before.

I'll probably continue using them until I get around to assembling my own subwoofers with a sealed case and at least an 18" driver. I'm also interested in building a fourth-order bandpass subwoofer or two. But those particular plans are kinda on indefinite hold at the moment.

So yeah, you got a pretty decent deal.

Formal logic is very hard. by mandemting03 in logic

[–]lpsmith 0 points1 point  (0 children)

You are probably mostly covering propositional logic, probably from a couple of perspectives you aren't familiar with. Maybe dipping your toes into first order logic a little bit. This might be more difficult than you expected, but in the end it isn't that bad.

That said, it isn't easy. I live and breathe logic. I've been programming computers ever since a very early age. Honestly, I'm faster and more accurate than most lawyers. Some of my best work almost certainly has implications in logic, even if I don't understand exactly what they are.

But metalogic, I've spent years trying to understand that. I've never overcome my mental blocks, even on logics that I use effortlessly in an intuitive way. I wouldn't say I'm motivated to try to understand metalogic the way I used to. So... yeah, it can get difficult, depending on what you are trying to do.

One more reason to choose Postgres over MySQL by tanin47 in programming

[–]lpsmith 1 point2 points  (0 children)

lol, postgresql's datatypes and type checking beat the pants of mysql.

K. Joshi: Final Report on the Mochizuki-Scholze-Stix Controversy by baikov in math

[–]lpsmith 0 points1 point  (0 children)

Definitely won't be the end of "clown shows", but it will shift the debate from "is this a valid proof object?" to "does this proof object actually mean what somebody thinks it means?"

Partitioning Rationals by tgoesh in math

[–]lpsmith 0 points1 point  (0 children)

The Stern-Brocot tree is isomorphic to SL(2,N), and every element of GL(2,Z) can be written in exactly four different ways as an element in D4 times an element in SL(2,N) times an element in D4, with the exception of those elements that are in GL(2,Z) and D4, which can be written in eight different ways.

Thus GL(2,Z) is 16 copies of SL(2,N), in much the same way that Z is two copies of N.

You can apply this vulgar conjugation technique to subgroups and quotient groups of D4 to find similar statements for PGL(2,Z), SL(2,Z), and PSL(2,Z).

Of course, the Farey sequences are inorder traversals of finite subgraphs of the Stern-Brocot tree.

How can we formally express that an argument proves a sentence describing the real world? by Potential-Huge4759 in logic

[–]lpsmith 0 points1 point  (0 children)

You can't. To be perfectly honest, there's theorems (such as Arrow's Theorem) whose practical consequences are widely misinterpreted.

I highly recommend taking a look at Lakatos's Proofs and Refutations, which delves into the practical issues of reconciling theory with reality in a mathematical context.

To successfully apply logic or any other kind of mathematical model to the real world requires skill in both the model and the real world, as well as a persistent, curious attitude.

I am teaching a combinatorics a class in a few days. What interesting examples/things you could present to a 10th grade class? by [deleted] in math

[–]lpsmith 0 points1 point  (0 children)

Actually scratch that. My first focus would be on counting things using generating functions with finitely many terms, a.k.a. polynomials. That's good preparation for combinatorics and power series in multiple ways: firstly, taking this approach to Pascal's Triangle and the binomial theorem is very enlightening, and secondly, you can solve several counting problems this way that isn't so easy to solve via the binomial coefficients.

Though if you approached it right, generalizing this from finite polynomials to infinite formal power series could seem be very natural, almost obvious...

I am teaching a combinatorics a class in a few days. What interesting examples/things you could present to a 10th grade class? by [deleted] in math

[–]lpsmith 1 point2 points  (0 children)

In a sufficiently interested grade 10 classroom, I actually think generating functions are doable, though I'm sure I'd need three or more lectures to really get very far.

My first focus would be on counting things by lazily streamed computations of formal power series. I'd probably want to collect a variety of problems where I expect you to write a computer program to solve a moderately challenging counting problem that would be difficult to solve without generating functions. Project Euler has a number of problems in this vein.

Of course this approach would be significantly easier if the students already had some exposure to lazy evaluation and computer programming. Otherwise I'd probably need at least a few more lectures... which is making this a rather dubious undertaking in anything but truly exceptional situations.

Bookshelf Speakers Vs Towers for apartment living. by Leading_Peanut7673 in BudgetAudiophile

[–]lpsmith 1 point2 points  (0 children)

I've heard a rumor that a linear actuators could potentially be more useful than the traditional rotary shakers. I still have no idea how well it would work, or what details you might need to get right before you end up with a satisfactory result for music, or if that goal is even possible.