Skip to content

YilingSuun/polynomial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

  1. Introduction.

Polynomial arithmetic is a classic application of linked data structures. For this project, you must write OCaml code that adds, multiplies, negates, and subtracts polynomials. Some of your code will use OCaml higher-order functions, which you must also write.

  1. Theory.

For the purposes of this project, a polynomial is a finite sum of zero or more terms, like this.

anxn + an−1xn−1 + an−2xn−2 ⋯ + a2x2 + a1x1 + a0x0

Each term has a coefficient, shown as a subscripted a. It also has a variable, shown as x with a superscripted exponent. All polynomials have the same variable. The polynomials’ coefficients are nonzero integers, its exponents are nonnegative integers, and their terms appear in decreasing order of their exponents. A polynomial with no terms is assumed to be 0. For example, suppose that we have three polynomials, p, q, and r, like this.

p = 3x⁵ + 2x⁴ + 2x³ − 1x² + 5x⁰

q = 7x⁴ + 1x² − 4x¹ − 3x⁰

r = 2x¹ + 3x⁰

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages