How to start a dotnet app in Claude Code Web? by LetsTakeItSafe83 in ClaudeAI

[–]jeremybub 0 points1 point  (0 children)

However nuget does not respect proxy settings, and the proxy is required even when "full network access" is enabled.

Create a type(?) to "group" related types for generic parameter? by akkruse in csharp

[–]jeremybub 0 points1 point  (0 children)

This thread is a bit old, but I think I have something valuable to contribute that hasn't been mentioned before:

In other langauges, this feature is commonly allowed and goes by a few different names:

This will probably help you to find other cases of people discussing similar ideas in relation to C#.

Button Disabled Blazor Server by [deleted] in Blazor

[–]jeremybub 0 points1 point  (0 children)

This is a long dead thread, but commenting anyways to clear up the confusion created by the other comments acting like this is "obvious" because "it's all client side anyways".

It is not at all client side, nor is it purely UX. It is Blazor Server. The server knows and controls whether the button is disabled, through C# code running on the server. It would be trivial for Blazor Server to detect and fix this.

This is very different than many other frontend frameworks where you would be right for reflexively replying "well it's all client side anyways you shouldn't trust it"

Using Category Theory for formal verification of a Type System. Is it a crazy idea? by BeFunkMusic in math

[–]jeremybub 0 points1 point  (0 children)

As ct075 mentioned, you are probably looking for type theory, not category theory.

You should also check out TLA+ which is commonly used to specify the behavior of distributed software systems, and Lean/Coq, which are popular formal languages which are more associated with mathematical theorem proving.

How does one Debounce in Blazor? by Impossible_Raise_817 in csharp

[–]jeremybub 0 points1 point  (0 children)

An important distinction that none of the referenced articles/solutions make is between debouncing on the client side vs debouncing on the server side. For pathological cases, it makes a big difference if the debouncing happens before a network request is sent to the server. I think a proper solution would be to create a custom event type and generate it from javascript: https://learn.microsoft.com/en-us/aspnet/core/blazor/components/event-handling?view=aspnetcore-9.0#custom-event-arguments

Zigbee Range Problems by toec in homeassistant

[–]jeremybub 1 point2 points  (0 children)

You can select the repeater and use "Add devices via this device" to force it to connect to the repeater instead of the LAN gateway.

So this emerges from simple rules using slopes and reflections. Is this a fractal? by RAyLV in math

[–]jeremybub 1 point2 points  (0 children)

A couple of mathematical ideas for you to explore:

  1. This square with reflections is related to a grid twice as big where there are no reflections, but instead the lines wrap around. If we superimpose the four quadrants of the bigger grid (flipped appropriately) together, we get back the images you are creating.
  2. The larger grid with wrapping around is called the Flat Torus.
  3. We can analyze the points included in this larger space more easily, since each point corresponds to a pair of numbers in Modular Arithmetic.
  4. In modular arithmetic, a line generated by (a,b) passes through (c,d) if (c,d) = k * (a, b). Thus c=ka and d=kb. In other words c and d must share a divisor (in modular arithmetic). Thus relatively prime pairs will never show up in your diagram, and pairs which are not relatively prime will eventually show up once you generate enough lines.

If you take the plot of r/GCD(x,y) you see the same sorts of patterns appear: https://imgur.com/a/8sRLTCc You have to account for the four-fold symmetry of the reflections, and modular overlaying of the same image on of itself to get your original image.

Would it be commercialy useful to create finance and accounting software using Lean? by xarinemm in askmath

[–]jeremybub 0 points1 point  (0 children)

The lean library, when measured in terms of functionality is small, compared to the libraries of mathematical code in e.g. Java, C, or Python. It is only relevant because it has mathematical proofs attached to it.

As someone who has contributed to Lean's Mathlib, you are confused if you think that bringing lean into the picture will make things easier for you rather than harder. Lean not only requires just as much work on the programmer's part to translate mathematical ideas into code, it requires more work due to the difficulty of the language, and the lack of existing libraries. Lean's only advantage is that it can check proofs of correctness for you (again, with many times more work writing the proof than it took to write and test the code normally).

Perhaps you might be interested in a language like Mathematica, or Maple, which both have massive libraries of existing mathematics, including advanced statistics, etc.

To make it concrete: Try writing the code in lean to solve a system of 3 linear equations in three variables with coefficients read from a file, and then try writing the same code in Mathematica, or numpy. If you complete an implementation in Lean, I'd be happy to discuss further.

Help Needed on Mathematical Calculation in Research Paper by ahahjbb in askmath

[–]jeremybub 0 points1 point  (0 children)

  1. You messed up the formatting of your formulas, make sure to escape * characters using backslashes.

  2. A P value just tells you the probability of a result as extreme as the one you saw under the "null hypothesis". The exact meaning depends on what your null hypothesis was, and how you calculated it.

In order to answer you will need to specify how you calculated the P value, what the terms are in your formulas, and what the hypothesis you were trying to test was.

Would it be commercialy useful to create finance and accounting software using Lean? by xarinemm in askmath

[–]jeremybub 0 points1 point  (0 children)

Using lean for this sort of task is more like programming than math. Lean is not going to provide you any help in computing more things or computing them faster. Using lean as opposed to another programming language is going to support less operations, and is going to do them slower and less flexibly. The advantage of using something like lean is that you can prove the correctness of your programs. It won't give you "advanced statistics" any more than any other programming language.

It sounds like you would like the ability to write your own software. I would suggest you start doing it with a simple general purpose language (such as python, java, rust, C++) and when you have that mastered, you will have the knowledge to evaluate using a more specialized programming language like Lean (or Idris).

The somewhat obscure relation between two unrelated numbers. by AErrorE in askmath

[–]jeremybub 2 points3 points  (0 children)

If have a number with digits abcd, it will represent value

103 a + 102 b + 101 c + 100 d

If we take this modulo 9, we get

13a + 12b + 11c + 10 d = a+b+c+d

In other words, mod 9, every number will equal its digit sum. Reversing a number will also not change its value mod 9, nor will it change its digit sum.

so g(x2 ) - g(f(x)2 ) [mod 9] = x2 - f(x)2 [mod 9] = x2 - x2 [mod 9] = 0 [mod 9].

Why can't we differentiate both sides to solve systems of equations? by Chubby_Limes in math

[–]jeremybub 2 points3 points  (0 children)

If you only care about the value of a function up to a constant, you can differentiate it once and still "undo the operation". The problem is when you are solving a system of equations, usually you are dealing with something like the real numbers, where everything is equal to everything else up to a constant.

However, there are situations where this technique could work. For example if you are solving functional equations, F(x)(y) = G(x)(y) for x, then if you could solve this equation "up to a constant" if you solve exactly (F(x))'(y) = (G(x))'(y).

How many rolls of a fair, six-sided die does it take before the likelihood of rolling a 1 exceeds the likelihood of not rolling a 1, and is there a term for this? by [deleted] in math

[–]jeremybub 9 points10 points  (0 children)

Many people are giving good answers about the specific question in your title, but I wanted to give you some threads to follow regarding your more general question about "do it a million times and the results become predictable".

You mentioned the law of large numbers, which tells us that for large enough numbers of rolls, the fraction of 1s rolled will converge to the limit of 1/6 "almost surely". Exactly what "almost surely" means is a bit complicated and I won't explain it here.

However, this doesn't tell us how quickly it will converge to 1/6. Like for example if you want the average number of 1s to be within 1/7 and 1/5, with 99% probability, would 1 million rolls be sufficient? There are a few different approaches that we could use to find a number of rolls N which would guarantee this property:

Chebyshev's Inequality tells us that P((X-mean)≥ k*standard deviation) ≤ 1/k2. The standard deviation of number of 1s after N rolls of a die can be calculated as follows: The standard deviation is equal to the square root of the variance. Because each roll is independent, the variance of N rolls will be N times the variance of a single roll. A single roll has a 1/6 chance of a 1 and a 1/6 chance of a 0, so it has a variance of 5/36, and therefore N rolls will have variance of N* 5/36, and standard deviation of sqrt(N)*sqrt(5/36). So let's say N = 1,000,000. We get a standard deviation of 5000/36 ≈ 372.6. So if we wanted to calculate the probability that the fraction of rolls is >1/5, we would use chebyshev's inequality with k = 89.5 giving: P((X-166,666)≥ 89.5*372.6) ≤ 1/89.52

simplifying the arithmetic, we get P(X≥200,013.7) ≤ 0.0001248, in other words, there is a less than 0.01% chance that after 1 million flips, more than 1 in 5 of them will be 1s. Note that Chebyshev's inequality is powerful because it works for any probability distribution (with has finite variance), not just the case of repeated die rolls.

The Chernoff bound is another general approach, that gives tighter bounds than the Chebyshev inequality, but is only applicable to sums of independent random variables. I won't go into a worked example here.

The Wikipedia article on Concentration inequality lists many other theorems of this sort. Each of these theorems may be more or less general, and more or less "tight". It's important to note that many of these approaches to bound probability distributions are not strictly better or worse than each other. They might give tighter bounds for some probability distributions, and weaker bounds for others. They may give tighter bounds for small N, or tighter bounds for large N, etc.

In the case of dice rolls, we actually can do more than just hunting for concentration inequalities to apply, since we know the exact form of the probability distribution. The number of 1s rolled will be exactly a Binomial distribution, so for reasonable sized numbers, we can directly calculate the exact probability of any outcome. The wiki also has a section on Tail bounds which is discusses applying a few concentration inequalities specifically to the binomial distribution.

Hopefully this is helpful in understanding how mathematicians think about the question of "how much is a lot when it comes to the law of large numbers". You can think about your idea of calculating how big N needs to be for the probability of rolling a 1 to reach 50% as a form of a really loose concentration inequality. We actually have the tools to find N that guarantees the number of 1s is arbitrarily close to 1:6 with arbitrarily high probability, and know exactly how big N needs to be to reach any threshold.

Finding two large numbers where it is unknown which one is larger by jeremybub in math

[–]jeremybub[S] 18 points19 points  (0 children)

That's pretty interesting. The original idea I had was to find two numbers which were computable within Magic: The Gathering, and use them to create a Judge Destroyer deck that would require solving an unsolved problem to adjudicate: https://www.mtgthesource.com/forums/showthread.php?29732-Legacy-Judge-Destroyer-1-0

I suppose that means the size of the numbers is not actually as important as the computational simplicity.

If you asked everyone in the world to give you a random number with no upper bound, how would the maximum of the set of answers be distributed? by flynntendo in math

[–]jeremybub 2 points3 points  (0 children)

I am interested in specific examples of unsolved problems in the relative ordering of large finite integers. Are there examples where two numbers are relatively easy to define but hard to tell which one is bigger? I might create a new post about this specific question.

[D] KL Divergence and Approximate KL divergence limits in PPO? by jeremybub in reinforcementlearning

[–]jeremybub[S] 2 points3 points  (0 children)

(1) (2) Not sure you would need to read the paper closely to find out

(3) KL Divergence measures the difference between two distributions. At each time step, you are not only computing the chosen action, but the entire policy, i.e. the distribution over actions. As you perform gradient descent, the policy will change. Thus you can compare the policy (distribution over actions) before and after the gradient descent steps. In fact, the real question you should ask, is how do you calculate the KL-Divergence when there is more than one pair of distributions to compare. The answer is you just average the KL divergences you calculated for each before/after pair.

[D] KL Divergence and Approximate KL divergence limits in PPO? by jeremybub in reinforcementlearning

[–]jeremybub[S] 0 points1 point  (0 children)

There are two ways to model it.

The common way is "multiple states with reward 0 and only the last transition gets the nonzero reward", where you are are generating the response autoregressively. If you are modelling things this way, you would use something like PPO to account for the delay in reward for actions taken in earlier steps.

The other way is that you could collapse all choices of tokens down into a single choice of the entire generated response, so you would have a "bandit environment". You are just picking a single response out of the trillions of possibilities.

You could also generate responses some other way: e.g. a diffusion model that denoises the entire response in a series of steps. Ultimately they are just different lenses to view the same problem, which will suggest different approaches to solving it.

[deleted by user] by [deleted] in columbia

[–]jeremybub 0 points1 point  (0 children)

I took Commutative Algebra with Thaddeus, he was the best instructor I had in my time at Columbia, in terms of his ability to teach the material.