Restart Wang's algorithm with appropriate polynomial (#3256)
jscode (javascript) printer added
added jscode.py to sympy/printing
added test_jscode.py to sympy/printing/tests to test jscode.py
modified __init__.py files to pull in relevant jscode for imports
nsimplify expr: use simultaneous substitution

nsimplify has troubles with the Floats in this expression because while doing
successive substitutions. The expression changes and creates new
Floats that weren't detected in the call to atoms. Using xreplace (with a
dictionary of replacements) does not work either. Simultaneous
substitution solves the problem:

-3.0*z**2*(x**2 + y**2 + z**2)**(-2.5) + 3*(x**2 + y**2 + z**2)**(-1.5)
>>> eq=_
>>> nsimplify(factor(eq.subs(x,0)))
-3.0*z**2/(y**2 + z**2)**(5/2) + 3.0/(y**2 + z**2)**(3/2)

Notice the leading 3.0 which should be a 3. This is fixed by this
commit.
Merge pull request #1339 from smichr/nsimp

nsimplify expr: use simultaneous substitution
Presenting newplot.py

A new plotting framework supporting numerous backends.

Two files are present:
plotting/newplot.py containing the module
test.py in the root containing some examples

See the docstring of newplot.py for implementation details.

It has 2d and 3d plots, parametric plots and contours.

Example:

a = Plot(x**2, x, 0, 10)
a.title = 'A Figure'
a.xlabel = 'The argument'

A big and dirty commit.

The current version of matplotlib (1.1.0) has a bug so some
of the 3D stuff does not work.
Concerning the bug - it's reported, but to fix it now try this:
/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.pyc in set_autoscale_on(self, b)
    252         """
    253         Axes.set_autoscale_on(self, b)
--> 254         self.set_autoscalez_on(self, b)
    255
    256     def set_autoscalez_on(self, b) :

TypeError: set_autoscalez_on() takes exactly 2 arguments (3 given)
I believe there is one self too much.
Adding an experimental new lambdify to the plotting module.

Needed because of the limitation of the old lambdify:
No symbolic Sums or other nontrivial expression.
Mixing translated and non translated functions.

rewrite of lambdify - This stuff is not stable at all.

It is for internal use in the new plotting module.
It may (will! see the Q'n'A below) be rewritten.

  We parse the expression string into a tree that identifies functions. Then
 we translate the names of the functions and we translate also some strings
 that are not names of functions (all this according to translation
 dictionaries).
  If the translation goes to another module (like numpy) the
 module is imported and 'func' is translated to 'module.func'.
  If a function can not be translated, the inner nodes of that part of the
 tree are not translated. So if we have Integral(sqrt(x)), sqrt is not
 translated to np.sqrt and the Integral does not crash.

#  Please, if there is a bug, do not try to fix it here! Rewrite this by using
# the method proposed in the last Q'n'A below.
#  If you insist on fixing it here, look at the workarounds in the function
# sympy_expression_namespace and in lambdify.

# Q: Why are you not using python abstract syntax tree?
# A: Because it is more complicated and not much more powerful in this case.

# Q: What if I have Symbol('sin') or g=Function('f')?
# A: You will break the algorithm. We should use srepr to defend against this?
#  The problem with Symbol('sin') is that it will be printed as 'sin'. The
# parser will distinguish it from the function 'sin' because functions are
# detected thanks to the opening parenthesis, but the lambda expression won't
# understand the difference if we have also the sin function.
# The solution (complicated) is to use srepr and maybe ast.
#  The problem with the g=Function('f') is that it will be printed as 'f' but in
# the global namespace we have only 'g'. But as the same printer is used in the
# constructor of the namespace there will be no problem.

# Q: What if some of the printers are not printing as expected?
# A: The algorithm wont work. You must use srepr for those cases. But even
# srepr may not print well. All problems with printers should be considered
# bugs.

# Q: What about _imp_ functions?
# A: Those are taken care for by evalf.

# Q: Will ast fix all possible problems?
# A: No. You will always have to use some printer. Even srepr may not work in
# some cases. But if the printer does not work, that should be considered a
# bug.

# Q: Is there same way to fix all possible problems?
# A: Probably by constructing our strings ourself by traversing the (func,
# args) tree and creating the namespace at the same time. That actually sounds
# good.
Removing lambdarepr from experimental_lambdify in newplot.py

For the restricted usage of experimental_lambify there is absolutely
no need to complicate the code and make it dependent on lambdarepr.

Now experimental_lambdify is completely self contained.

Also some additions to the documentation were done.
Removing checks for ctypes.

There were checks about the ctypes module. As it's included in
python 2.5+ those are no longer needed.

Also removed a remark about ctypes from the documentation.
Moving the old pyglet plotting module and adding a warning

To make place for the new interface the old plotting module was
moved to another location. It was noted in examples, documentation
and tests.

The location has changed but the Plot function is still imported
from the same location. It's a proxy object giving the Plot from
the old pyglet module, but it adds a warning about the change.
Importing the pyglet Plot from the new location does not give a
warning.
plotting: enabled doctests for some utils.
Adding plot function (not implemented)

The docstring for the plot function is ready. The function itself is not
ready. It just calls Plot with the same arguments.

Also now the default between a contour plot and a 3d plot is the 3d plot.

Also fixed some comments.
Finishing touches in the new plotting module.

There are probably still many bugs, but the module should be ready for
review after this commit.

- Finishing the plot function.
   Now the plot function gives a great flexibility in how one
can define a plot. Multiple cartesian or parametric plots are supported.

- Fixing imports.

- Minor fixes to plotting/experimental_lambdify.py
 The sqrt function was not translated to the numpy sqrt. Now it is.
before the commit sqrt(x) -> sqrt(x).evalf()
after the commit sqrt(x) -> np.sqrt(x)
 Also experimental_lambdify now supports the print_lambda argument.
When true the function will print the lambda expression to the terminal
before creating the actual lambda function.

- Many other clean-ups and bug fixes.
Preparing examples of the new plotting module.

In the root folder two preliminary files with examples were created.
They should be moved.
Bug fixes and examples concerning coloring of plots.
Fixes to experimental_lambdify from the plotting module.
Stop raising warnings every single one missing option in the backend.
Some new functionality for plotting only integer values and steps.
Extensive simplifications of code for the plotting module.

All the setattr and getattr overrides were deleted. The _options and
_aesthetics dicts were deleted and all options and aesthetics are now
regular attributes.
All plotting examples are moved to ./examples
Add a rudimentary save() method to plot.

Currently there is only one argument (string path) that is directly
sent to the backend. No *args or **kwargs.