Problem 55335. Generate Bernoulli polynomials

The Bernoulli polynomial B_n(x) is a polynomial of order n with the properties that B_0(x) = 1 and for n > 0
B'_n(x) = n B_{n-1}(x),
where the prime denotes differentiation with respect to x, and
Integral[B_n(x),{x,0,1}] = 0.
Therefore, B_1(x) = x-1/2, B_2(x) = x^2 – x + 1/6, B_3(x) = x^3 – 3 x^2/2 + x/2, etc. Notice that B_n(0) is the nth Bernoulli number.
Write a function to generate the Bernoulli polynomial of order n. Use MATLAB's approach for specifying the coefficients. For example, the function should return [1 -1/2] for n = 1 and [1 -1 1/6] for n = 2.

Solution Stats

58.33% Correct | 41.67% Incorrect
Last Solution submitted on Sep 15, 2023

Solution Comments

Show comments

Problem Recent Solvers6

Suggested Problems

More from this Author244

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!