Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
glenfletcher committed May 2, 2014
1 parent 7f32c0e commit 77672ff
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 50 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Example
\sin\left(\left(x + y^{(2+0j)}\right)\right)
>>> fn(3,4)
(0.42016703682664092+0j)
>>>

Numpy Arrays Supported
----------------------
Expand All @@ -36,7 +35,7 @@ Latex Support

The display string format i.e. str() is set to use Latex syntax allowing high quality equations to be rendered in output this syntax is supported by the grqaphing package matplotlib

Note: repr() method will return a string suitable for passing to Expression, however it is recalucated from the tokenized expression, and has all brackets.
.. Note:: repr() method will return a string suitable for passing to Expression, however it is recalucated from the tokenized expression, and has all brackets.

Future Versions
---------------
Expand Down
50 changes: 4 additions & 46 deletions doc/source/Examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,11 @@ Dynamic Ploting of functions

Requires numpy, matplotlib and h5py

.. code-block:: python
**sample/DPOF.py**

.. literalinclude:: ../../sample/DPOF.py
:language: python

from Equation import Expression
from Equation.core import constants
import matplotlib.pyplot as plt
import numpy as np
import h5py
db = h5py.File("dataset.hdf5", "r") # External Data base of consts and values
while True:
expr = raw_input("Enter Equation to Plot in terms of (x): ") # Fetch Equation From User Input
try:
fn = Expression(expr,['x'])
except SyntaxError as err:
print err.message
continue
if 'x' not in fn: # check 'x' is used in expr
print "Error: Equation must have a variable named x"
continue
for v in fn: # load all data values from db
if v == 'x':
continue
if v in db:
fn[v] = db[v]
continue
if v in db.attrs:
fn[v] = db.attrs[v]
continue
if v in constants:
continue
print "Error: Variable '{0:s}' is not defined in database".format(v)
break # Break the For Loop
else:
break # Break the While Loop
# One We get Here fn is a valid Expression object requiring a single argument 'x'
x = np.linspace(0,1,1000)
plt.plot(x,fn(x))
plt.title("Plot of ${0:s}$".format(fn))
plt.show()
The Following is the result of running the script, given "dataset.hdf5" contains the attribute ``A = 3``

.. code-block:: none
Expand Down
Binary file modified doc/source/_static/DPOF01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/source/_static/DPOF02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/source/_static/figure_1.png
Binary file not shown.
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@
#

# The short X.Y version.
version = '1.0'
version = version = csp.get_version(__version__)
# The full version, including alpha/beta/rc tags.
release = '1.0'
release = __version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down

0 comments on commit 77672ff

Please sign in to comment.