Skip to main content
  • 457 Accesses

Abstract

Polynomials, such as a 0 + a 1 x + a 2x2 + ... + a n x n, have a dual nature. On one hand, you can regard them as functions P(x). On the other hand, you can subject them to algebraic operations such as addition and subtraction, as though they were vectors with components, a 0 , a 1,a 2, ..., a n . Designing a data structure for them is complicated by this duality of roles that it must support. Section 6.1 defines classes Polynom for double and complex polynomials. Since they’re derived from the corresponding MSP Vector classes, they inherit some structure—in particular, their data components and some logical functions. But new restrictions must be imposed: Subscripts must start at 0 and there may be no trailing zero coefficients. Thus, some Vector operations must be modified when applied to Polynom objects. Some new operations are added—for instance, polynomial multiplication and differentiation—which don’t make sense for vectors in general. Finally, to reflect the functional nature of a polynomial, the C++ () operator is overloaded, so that P(x) makes sense when P is a Polynom object and x a scalar. These algebraic parts of the Polynom class definition are described in detail in Section 6.2. That section concludes with a detailed example, which verifies calculus results for Legendre polynomials.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 1999 Springer Science+Business Media New York

About this chapter

Cite this chapter

Smith, J.T. (1999). Polynomial Classes. In: C++ Toolkit for Engineers and Scientists. Springer, New York, NY. https://doi.org/10.1007/978-1-4612-1474-8_6

Download citation

  • DOI: https://doi.org/10.1007/978-1-4612-1474-8_6

  • Publisher Name: Springer, New York, NY

  • Print ISBN: 978-0-387-98797-2

  • Online ISBN: 978-1-4612-1474-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics