1 / 4

Binomial expansion

Binomial expansion. Introduction to Computers and Programming, NCTU, Fall 2012. Functions. return-value-type function-name(parameter-list) { declarations and statements } return-value-type  void, int , long, etc. parameter-list  int a, int b, char ch , float f Examples:

swain
Download Presentation

Binomial expansion

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Binomial expansion Introduction to Computers and Programming, NCTU, Fall 2012

  2. Functions return-value-type function-name(parameter-list) { declarations and statements } • return-value-type void, int, long, etc. • parameter-list  int a, int b, char ch, float f • Examples: intmain() {…} long factorial(int n) {…} double result(double base, boolisFast, double interest) {…}

  3. Binomial expansion (x + y)3 = x3 + 3x2y + 3xy2 + y3 (x + y)4 = x4 + 4x3y + 6x2y2 + 4xy3 + y4 So, the binomial coefficients for power of 3 are 1, 3, 3, 1;and for power of 4: 1, 4, 6, 4, 1 There exists a recursive formula to compute them: With initial conditions

  4. Practice • Input: n • Output: binomial coefficients for power expansion of n • Exit if n = -1 • Hint: use recursion

More Related