Difference between revisions of "Timescalecalculus python library documentation"

From timescalewiki
Jump to: navigation, search
(Created page with "{{lowercase}} This is the documentation for the Python repository [https://github.com/tomcuchta/timescalecalculus timescalecalculus]. =The basics= After extracting the files...")
 
Line 17: Line 17:
 
2</pre>
 
2</pre>
 
The [[delta derivative]] works as expected. The delta derivative of a constant is zero:
 
The [[delta derivative]] works as expected. The delta derivative of a constant is zero:
<pre>>>> def f(x):
+
<pre>>>> dderivative(lambda x: 1,5,ts)
...    return 1;
 
...
 
>>> dderivative(f,5,ts)
 
 
0</pre>
 
0</pre>
 
and obeying the [[delta derivative of squaring function]], we see
 
and obeying the [[delta derivative of squaring function]], we see
<pre>>>> def g(x):
+
<pre>>>> dderivative(lambda x: x*x,5,ts)
...    return x*x;
 
...
 
>>> dderivative(g,5,ts)
 
 
11</pre>
 
11</pre>

Revision as of 03:09, 19 December 2016

This is the documentation for the Python repository timescalecalculus.

The basics

After extracting the files, open a Python instance in its folder and type

 >>> from timescalecalculus import *

Now the full functionality of timescalecalculus is available to you.

Defining a time scale

Right now, a time scale can consist of only a finite list of numbers. Fraction types are available.

>>> ts=[1,2,3,4,5,6,7]

The forward jump $\sigma$ can be used:

>>> sigma(3,ts)
4

The backward jump $\rho$ can be used:

>>> rho(3,ts)
2

The delta derivative works as expected. The delta derivative of a constant is zero:

>>> dderivative(lambda x: 1,5,ts)
0

and obeying the delta derivative of squaring function, we see

>>> dderivative(lambda x: x*x,5,ts)
11