• 0 Posts
  • 5 Comments
Joined 2 years ago
cake
Cake day: June 12th, 2023

help-circle


  • Let f(x) = 1/((x-1)^(2)). Given an integer n, compute the nth derivative of f as f^((n))(x) = (-1)(n)(n+1)!/((x-1)(n+2)), which lets us write f as the Taylor series about x=0 whose nth coefficient is f^((n))(0)/n! = (-1)^(-2)(n+1)!/n! = n+1. We now compute the nth coefficient with a simple recursion. To show this process works, we make an inductive argument: the 0th coefficient is f(0) = 1, and the nth coefficient is (f(x) - (1 + 2x + 3x^(2) + … + nx(n-1)))/x(n) evaluated at x=0. Note that each coefficient appearing in the previous expression is an integer between 0 and n, so by inductive hypothesis we can represent it by incrementing 0 repeatedly. Unfortunately, the expression we’ve written isn’t well-defined at x=0 since we can’t divide by 0, but as we’d expect, the limit as x->0 is defined and equal to n+1 (exercise: prove this). To compute the limit, we can evaluate at a sufficiently small value of x and argue by monotonicity or squeezing that n+1 is the nearest integer. (exercise: determine an upper bound for |x| that makes this argument work and fill in the details). Finally, evaluate our expression at the appropriate value of x for each k from 1 to n, using each result to compute the next, until we are able to write each coefficient. Evaluate one more time and conclude by rounding to the value of n+1. This increments n.


  • Rant incoming, because I just happened to be dealing with this today.

    I tried the push to talk binding method in sway, and found it was extremely fragile because if you press any modifier keys before releasing the button, the release binding won’t trigger and your mic will stay open. This is especially problematic for my use case as I use both my push to talk hotkey and my modifier buttons while gaming.

    I just use a toggle mute hotkey instead of push-to-talk though. Just gotta remember to re-mute, and have a visual indicator for your mic status so you don’t accidentally leave it in the wrong state.

    Another workaround is binding all possible combinations of modifier keys explicitly, and passing in --device-id so that the binding doesn’t consume the keypress and instead forwards it on to the application. This should perfectly emulate the behavior of an X-style global hotkey. With 4 mods (super, ctrl, shift, alt) and 2 bindings per combination there are 2^5 = 32 total bindings for each such hotkey. However there’s still no telling if the key-release event could be missed somehow and leave your mic open. I don’t know how reliable this method is.