Hi there,
this post shows how Grapheme and Nexus GUI tables and charts can be used to evaluate and plot analytical functions.
In this example we will use a table and a scatter chart to show how the Exponential function of X in the [0,2.5] domain can be approximated by an exponential series (more info can be found here).
To do that we will, in the order:
- create a table
- create the exponential function
- create the first 6 series terms
- plot contributions on scatter chart
- assess the error of the approximation
Creating a support table
We aim at creating a new table having a single numeric column X having values that range from 0.0 to 2.5.
Once the Wizard opens up we create a new column named X and we fill it up using the progression algorithm. We set 0.0 as initial value, 0.0025 as step and we generate a table with 1001 lines. This will generate points spanning the domain domain [0.0, 2.5], spanned equally.
Creating the exponential function
Once the table has been created, we simply add a new Expression Column and we set the column expression to be exp(X).
Creating the first 6 series terms
The next step consists in adding columns to represent each contribution of the Tailor Series.
More in particular, we will create 6 new Expression columns. Each having the value of the preceding one plus the new series contribution. This is:
- S1 = 1 + X
- S2 = S1 + X^2 / 2!
- S3 = S2 + X^3 / 3!
- S4 = S3 + X^4 / 4!
- S5 = S4 + X^5 / 5!
- S6 = S5 + X^6 / 6!
plotting contributions on scatter chart
Once the table has been populated, we can display the single series contributions against the Exponential function of X.
Looking at the whole considered domain, the series expansion at the 6th order provides a good approximation of the true Exponential function. Clearly the better it is the closer we are to 0.0.
Error of the approximation
Finally we would be interested to assess the error of the first 6 series contribution with respect of the exponential function computed via exp(X).
The easiest way to do that, is to create an additional Expression Column in the source table, where we set as expression (exp(X)-S6)/exp(X)*100.
Results are reported on the right. Maximum Percentage error of the expansion of order six in the domain [0.0,2.5] is around 1.5%.