Trying to generate Bernoulli numbers in c++

I have 2 functions. In one the user inputs n and it returns a list of the 1st n Bernoulli numbers, recursively generating the Kth number by doing some math on the (k-1)th number. The other function generates and returns only the Nth Bernoulli number. Both functions diverge wildly from what the outputs should be at around n=13 and I'm wondering if this is unavoidable due to rounding errors? I thought errors might be compounding in the 1st function which is why I wrote the second but I'm seeing similar behavior in both. I'm only including the 2nd function here for brevity. Thanks for any insight!

https://pastebin.pl/view/1f89b044

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/HydrogenxPi
πŸ“…︎ Jan 16 2022
🚨︎ report
Hey guys, I'm in desperate need to prove the following identity for the connection between Eulerian and Bernoulli numbers. I really have no idea how to (Beta is a Bernoulli number) prove it, could somebody help me please?
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/babestalive
πŸ“…︎ May 01 2021
🚨︎ report
B for Bernoulli Numbers
πŸ‘︎ 247
πŸ’¬︎
πŸ‘€︎ u/12_Semitones
πŸ“…︎ Nov 26 2020
🚨︎ report
Bernoulli numbers help requested

Can anyone explain Bernoulli numbers and / or link to any helpful material? Even stuff that I should know beforehand, etc. I'm attempting to learn them to work out how to use the tan function (for a Butterworth filter algorithm for music).

I've found this (link: https://medium.com/@starkcoffee/discovering-adas-bernoulli-numbers-part-1-65bdfeb7cc8f) for Bernoulli numbers, but I'm still having trouble and only get to about half-way down the page almost. I'm working everything out by intuitive leaps mainly but it's pretty slow. There also doesn't seem to be a lot of resources around

Thanks team

πŸ‘︎ 8
πŸ’¬︎
πŸ“…︎ Apr 08 2021
🚨︎ report
Can someone help me with the number 9?? It a differential equation, I need to solve it using a sutitution or Bernoulli
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/fmaldonado6
πŸ“…︎ Mar 21 2021
🚨︎ report
The next puzzle in the Detective Bernoulli series is here: can you find a path through the maze - starting at yellow and ending at red - where you can only move horizontally or vertically to a square so that the two numbers differ by one OR are multiples of one another. Link to full story below.
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/tomrocksmaths
πŸ“…︎ Feb 06 2021
🚨︎ report
Recreating the first computer algorithm, developed by Ada Lovelace to calculate Bernoulli numbers projectlovelace.net/probl…
πŸ‘︎ 423
πŸ’¬︎
πŸ‘€︎ u/ProjectLovelace
πŸ“…︎ Aug 03 2019
🚨︎ report
Puzzle number 5 from TRM intern Lucas Bachmann: as detective Bernoulli closes in on the criminals, he is confronted by a booby-trap in the form of a partial chessboard with only two pieces - a knight and a queen... Can you help him to pass safely? Link to full story in comments.
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/tomrocksmaths
πŸ“…︎ Feb 04 2021
🚨︎ report
TIL The first computer programmer was a woman named Ada Lovelace, who in 1842 wrote and published an algorithm to calculate Bernoulli Numbers on Charles Babbage's analytical machine. en.m.wikipedia.org/wiki/A…
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/TheLastFartan
πŸ“…︎ Oct 14 2015
🚨︎ report
My Bernoulli numbers algorithm and newly(badly) self-taught Number theory

This is a version of a code I made in Python using mainly properties of Pascal's (with binomial coefficients) triangle to compute Bernoulli numbers (My only other algorithms use the positive recursive definition and generating functions) . -5.31870446941632e+1769 is ^(B)1000 in approx. 14 seconds of calculation . I am very unsure of its time complexity and know there are far more efficient ways to calculate them. I am new to number theory, which I am learning by myself for now.

I was wondering if anyone had experience with Bernoulli numbers here and if so would you be so kind as to tell where to start learning about these ? I read about their complex links to the Riemann zeta function, combinatorics, a variety of series and that they have a bunch of different representations and definitions...

I have a difficult time wrapping my head around all their implications and I would be interested to know which methods and definitions should I read about first and what mathematical background would they require ?

(I'm new here sorry if the format is not adequate or I am unclear, I will give any precision necessary, sorry this is not a vocabulary I am used to; not a native speaker)

https://preview.redd.it/cqzdftsr9d551.png?width=1493&format=png&auto=webp&s=32c72bdaab00ee2e18213a4061faadc8fcea84f2

πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/Ant_Ender
πŸ“…︎ Jun 17 2020
🚨︎ report
Literature on Bernoulli Numbers?

Anyone know of any articles or books/chapters that explain Bernoulli Numbers and their application?

πŸ‘︎ 22
πŸ’¬︎
πŸ‘€︎ u/Expain7
πŸ“…︎ Nov 12 2019
🚨︎ report
Finding the Bernoulli numbers generating function

I'm having trouble finding the exponential generating function for Bernoulli numbers given that B0=0 and the sum from k=0 to n of ((n+1) choose k )*Bk = 0, for each natural number n where Bn denotes the nth Bernoulli number. Sorry for the horrible formatting but it should suffice. I've set f(x) to be the EGF with coefficients Bn and multiplied it with e^x in its power series form. After multiplying I divided the inner sum to the sum of k=0 to n-1 of n choose k * Bk(which should be equal to zero) and the last element which is just Bn. I end up with the relation f(x)e^(x)=f(x) which makes no sense. I'm missing a piece somewhere. All help is appreciated, thanks.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/jakobinacc
πŸ“…︎ Jan 14 2020
🚨︎ report
Bernoulli, Fibonacci and Euler Numbers in Desmos
πŸ‘︎ 33
πŸ’¬︎
πŸ‘€︎ u/Heavenira
πŸ“…︎ Sep 16 2019
🚨︎ report
It is reported that Ada Lovelace was the first programmer, and that the first program was an algorithm to calculate Bernoulli numbers, isn't that too complex to be the first program ever written?

I would expect the first program to be a code that added 2 numbers, or something simple like that.

Could it be that this is the oldest surviving code from Ada Lovelace but that she wrote other simpler programs before it?

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/Frigorifico
πŸ“…︎ Sep 04 2019
🚨︎ report
The only nonzero value of the Bernoulli numbers that occurs more than once is -1/30, which is both the 4th and the 8th term. Does this have any deeper number-theoretic significance?

I wasn't able to find anything about this on math.SE or various google searches, but I might well have missed something.

πŸ‘︎ 50
πŸ’¬︎
πŸ‘€︎ u/HarryPotter5777
πŸ“…︎ Mar 22 2018
🚨︎ report
TIL At the age of 17, Srinivasa Ramanujan had developed Bernoulli numbers and calculated Euler’s constant up to 15 decimal places nytimes.com/1987/07/14/sc…
πŸ‘︎ 59
πŸ’¬︎
πŸ‘€︎ u/CoolGuess
πŸ“…︎ May 16 2018
🚨︎ report
Is there an algorithm for picking a random integer uniformly in [1, n] using a bounded number of Bernoulli trials (random bits)?

A practical algorithm for making a uniform pick in [1, n] is to extend the range to the nearest power of two and then pick in that extended range, i.e. using ⌈log2 nβŒ‰ bits. The result is the base-2 representation of a number, which is returned if it falls in the desired range; otherwise, we repeat the procedure. This is fine for practical computing purposes but it's not guaranteed to terminate.

πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/znegva
πŸ“…︎ Jul 08 2018
🚨︎ report
Algorithm for the computation of Bernoulli numbers created by Ada Lovelace in 1843 for Charles Babbage's Analytical Engine. twitter.com/fermatslibrar…
πŸ‘︎ 52
πŸ’¬︎
πŸ‘€︎ u/red_fern
πŸ“…︎ Feb 27 2019
🚨︎ report
Was Ada Lovelace's first ever recognized program, an algorithm for producing Bernoulli numbers on Babbage's Analytical Engine, ever practically tested? Were there any bugs?
πŸ‘︎ 109
πŸ’¬︎
πŸ‘€︎ u/LukeInTheSkyWith
πŸ“…︎ Jan 17 2017
🚨︎ report
HP 42S/DM42: Error Funciton, Bernoulli Numbers, Chebyshev Polynomials

The program ERF calculates the error function:

erf(x) = 2 / βˆšΟ€ * ∫ e^-(t^2) dt from t = 0 to t = x

The calculation uses the series:

erf(x) = 2 * e^(-(x^2)) / βˆšΟ€ * Ξ£( 2^n * x^(2n+1) / (1 * 3 * ... * (2n+1)) from n=0 to ∞

The program BERN calculates Bernoulli numbers for positive integers n > 2. The calculator is set to Radian mode.

The formula used:

B_n = (-cos(n * Ο€/2))^((n+2)/2) * 2 * n! * Ξ£(2 * j * Ο€)^(-n) from j=1 to ∞

Chebyshev Polynomials

The program CHEBY calculates the value of a first-order Chebyshev polynomial using the recurring formula where:

T_n(x) = 2 * x * T_n(x) - T_(n-1)(x)

where T_0(x) = 1, T_1(x) = x

Link: http://edspi31415.blogspot.com/2019/10/hp-42sdm42-error-function-bernoulli.html

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/EdPi314
πŸ“…︎ Oct 03 2019
🚨︎ report
ELI5 how to generate Bernoulli numbers.

The wiki page on them goes just barely over my head.

πŸ‘︎ 55
πŸ’¬︎
πŸ‘€︎ u/AlephNull-1
πŸ“…︎ Apr 01 2018
🚨︎ report
TIL Euler's number (2.7182818) was discovered when Jacob Bernoulli tried to find what the maximum balance a $1 loan, at 100% interest, could have after one year, depending on how often you compounded interest. The maximum was $2.7182818 www-history.mcs.st-and.ac…
πŸ‘︎ 26
πŸ’¬︎
πŸ‘€︎ u/tmishkoor
πŸ“…︎ Apr 13 2016
🚨︎ report
Proving Odd Bernoulli Numbers Are Zero

We are given the following recursion relation for the Bernoulli numbers:

[;B_j = \sum_{n=0}^{j-1} \frac{B_n}{n!(j-n+1)!};]

Use it to prove [;B_3 = B_5 =B_7 =\ldots=0;]

So my attempt was using induction, but I'm stuck in the final step for [;k=n+1;] (assuming I want to prove [;B_{2k+1}=0;] for every k). I'm utterly stuck, any help?

Thanks!!

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/RuleteroNini
πŸ“…︎ Oct 04 2018
🚨︎ report
[Statistics] Deriving p of Bernoulli trial from number of successes.

Hi. I'm working on a personal project and need to make sure the work I'm doing is mathematically sound. For the questions below, is my approach correct, or is there a correct/better way of doing things?

I have conducted 20 Bernoulli trials. My observed outcome is 8 successes.

It was proposed that $p_{suc}$ was 0.2. As the number of successes follow a binomial distribution, I have calculated the standard deviation as $\sqrt(npq)$ = $\sqrt(200.20.8)$ = $\sqrt(3.2)$ = 1.79

The proposed mean was 4, so my observed value is therefore + 2.22 standard deviations from the mean, and so my p value is 0.0264. So this is significant by my measure (<0.05). However is it valid to say that there is a 97.4% chance that $p_{suc}$> 0.2?

Also, I want to define a range of values for $p_{suc}$ given my observed number of successes, which I can be 95% confident in. So my estimate is $8/20$ = 0.4 +/- $x$.

Is there a way to calculate $x$, or can I use brute force to simulate 20 trials say 10,000+ times for different $p_{suc}$ values, and use an algorithm to find the upper and lower cut-off values for $p_{suc}$ whereby my observed success count of 8 appears in < 5% of simulations?

Thanks for any help.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/chazwc
πŸ“…︎ May 20 2018
🚨︎ report
Can you show that a number is prime if the nth Bernoulli number's denominator / n+1 is an integer

I think it is interesting that this holds as far as I've checked. If it isn't prime, that fraction isn't an integer.

n is offset assuming you consider the Bernoulli numbers starting at 0.

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/Roverse
πŸ“…︎ Mar 31 2018
🚨︎ report
Nice article about Bernoulli numbers. ams.org/publicoutreach/fe…
πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/MadPat
πŸ“…︎ Feb 04 2018
🚨︎ report
Scaling Mathematica: Computing the 10-millionth Bernoulli Number blog.wolfram.com/2008/04/…
πŸ‘︎ 40
πŸ’¬︎
πŸ‘€︎ u/pkrumins
πŸ“…︎ Jun 13 2008
🚨︎ report
Estimating number of Bernoulli trials given number of successes

(Note: I asked this question before on the Stats Stackexchange, but did noy get any authoritative answer. I hope my luck is better with Reddit).

Suppose you have a series of n trials, where the probability of success in each trial is p. The distribution of the number of successful trials follows a Binomial distribution with parameters (n, p). The mean is given by np whereas the variance is np(1-p). So far so good: this is pretty mundane Stats 101 stuff.

But suppose now that I only knew about the number m of successful trials, and had no knowledge of the total number n of trials, which is the variable I am interested in estimating. For example, I knew I had 100 successful trials, where each trial had a 0.1 chance of success. Is there a known probability distribution that describes the probable outcomes for n, the total number of trials? Estimating the mean is easy: m/p. But what about variance and other measures?

What if each success had a different (but known) chance of success? Suppose I had the following records:

  • success1 (with p=0.1)
  • success2 (with p=0.1)
  • success3 (with p=0.2)

Again, a good estimation of the total number of trials can be obtained by simply summing 1/p for each successful trial. In this case that number is 10+10+5=25. But what about variance and other measures?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/jon_smark
πŸ“…︎ Dec 07 2012
🚨︎ report
Born today : January 6th - Jacob Bernoulli, Mathematician, "an early proponent of Leibnizian calculus", "one of the founders the calculus of variations", "his most important contribution was in the field of probability, where he derived the first version of the law of large numbers" en.wikipedia.org/wiki/Jac…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/spike77wbs
πŸ“…︎ Jan 06 2018
🚨︎ report
Pseudorandom number generation using chaotic true orbits of the Bernoulli map scitation.aip.org/content…
πŸ‘︎ 2
πŸ’¬︎
πŸ“…︎ Jun 27 2016
🚨︎ report
The numerator of the 200th Bernoulli number has been factored listserv.nodak.edu/cgi-bi…
πŸ‘︎ 28
πŸ’¬︎
πŸ‘€︎ u/fredrikj
πŸ“…︎ Aug 06 2012
🚨︎ report
TIL that Srinivasa Ramanujan, with no formal education, independently developed and investigated the Bernoulli numbers and had calculated Euler's constant up to 15 decimal places by the age of 16 after studying a library book on pure mathematics. en.wikipedia.org/wiki/Sri…
πŸ‘︎ 22
πŸ’¬︎
πŸ‘€︎ u/hjelpme
πŸ“…︎ Jan 27 2012
🚨︎ report
Born today : January 6th - Jacob Bernoulli, Mathematician, "an early proponent of Leibnizian calculus", "one of the founders the calculus of variations", "his most important contribution was in the field of probability, where he derived the first version of the law of large numbers" en.wikipedia.org/wiki/Jac…
πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/spike77wbs
πŸ“…︎ Jan 06 2017
🚨︎ report
ELI5:Bernoulli numbers and the algorithm to find them

So i was reading up on Ada Lovelace, who's credited with, as you probably know, creating the first every algorithm; to compute Bernoulli numbers.

So i tried to read in to them but i ran in too maths not with numbers, not even with letters, with greek looking shit.

So can any of you folk explain Bernoulli numbers to me in any way or is it so far in mathematician territory it'd take too long?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/samuelma
πŸ“…︎ Aug 10 2015
🚨︎ report
Bernoulli numbers and their generating function

Using this generating function, what exactly do you do with the t in the summation? I don't understand how the bernoulli numbers are generated from this...?

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/expertprogr4mmer
πŸ“…︎ Apr 17 2014
🚨︎ report
TIL that Bernoulli numbers and Bernoulli's principle are named after two different people. en.wikipedia.org/wiki/Ber…
πŸ‘︎ 15
πŸ’¬︎
πŸ‘€︎ u/SpaceCorgi
πŸ“…︎ Apr 15 2013
🚨︎ report
Could someone please explain Bernoulli Number?

Every thread that I found has no comments, and when I tried to make a thread in eli5, no one commented either.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/chamington
πŸ“…︎ Sep 01 2015
🚨︎ report
ELI5 Bernoulli numbers
πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/asianmaster
πŸ“…︎ Jan 27 2015
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.