DEV Community

Caleb Zhao
Caleb Zhao

Posted on • Edited on

Incorrect calculations: polynomials

In this blog post, we discuss incorrect calculations of polynomials in MATLAB.

Example 1. Given that

f(x)=727313x1289459499x1144x2+665683.13 f(x)=727313\,x^{12}-89459499\,x^{11}-44\,x^2+665683.13
and
g(x)=584927x9721800000x8+101188x713x2+19795832, g(x)=584927\,x^9-721800000\,x^8+101188\,x^7-13\,x^2+19795832\,,

calculate f(123)f(123) and g(1234).g(1234)\,.

Let's just post the figure directly.

MATLAB outputFrom the above screenshot, it can be seen that the two outputs from MATLAB are both large numbers, with one having 16 integer digits and the other having 17 integer digits.

However, the accurate values of the two polynomials are 7.13 and 4, respectively (as provided by ISRealsoft). Thus, the outputs from MATLAB are both incorrect.

previous \,\quad\quad\quad\quad\hspace{7.2cm} next

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more