peetceenatoo / polyplot

speeding up polynomial evaluation, not much useful yet, though

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Polynomial plotting

Straightforward method

Let $p(x)$ be an n-degree polynomial with real coefficients. Let k be the discrete number of points which is intended to be plotted. A straightforward approximated evaluation at such points has got time complexity $O(k*n^2)$. The approximation is due to the impossibility of representing real numbers.

This algorithm

Let's initially consider a restriction of the problem. Let $p(x)$ be an $n$-degree polynomial with integer coefficients. One may want to plot the polynomial for $k$ consecutive integer positive values of $x$, or to plot it for some integer positive values such that the largest one is $k$. This algorithm seems to be working, through a phase of initialization with time complexity $O(n^2)$ and a phase of actual evaluation with time complexity $O(k*n)$. As $k$ is reasonably much larger than $n$ in - kind of - every realistic context, it just works better.

Implementation

It is required to install "numpy" and "matplotlib" packages. Since the "now it actually plots" commit, a scatter plot of the polynomial is displayed.

Soon

Completely aware that it's still pretty useless, I'm working on a formal proof that it actually works, to then finally generalize its features.

Next features hopefully available soon in this repository:
1. Formal proof;
2. Extension of the domain;
3. Extension of the domain of the polynomial coefficients;

About

speeding up polynomial evaluation, not much useful yet, though


Languages

Language:Python 100.0%