Code covered by the BSD License  

Highlights from
SymPy CAS in MATLAB

Be the first to rate this file! 10 Downloads (last 30 days) File Size: 2.49 KB File ID: #42787
image thumbnail

SymPy CAS in MATLAB

by

 

23 Jul 2013 (Updated )

Enables using Python's SymPy CAS in MATLAB

| Watch this File

File Information
Description

This function utilizes Python's SymPy module to provide symbolic capabilities for those of us who do not have the Symbolic Toolbox at our disposal. The function passes strings to and from Python via the System command. Computation of the result is easily accomplished via the vectorize and inline functions.

Example:
result = symeval('integrate','"x^2+3x-4"','x');
y = vectorize(inline(result));
plot(y([1:100])

This can be slow since the Python interpreter is started and shutdown every time the function is called. However, successive calls are sped up due to OS caching.

A better way of interfacing with Python is being sought out.

I'm open to ideas...

Acknowledgements

Maxima Cas In Matlab inspired this file.

This file inspired Maxima Cas In Matlab.

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Other requirements Local install of Python with sympy module.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
10 Aug 2013 Jonathan Lister

The entry "Maxima Cas in Matlab" works better IMO.

24 Jul 2013 Jonathan Lister

Try:

result = symeval('integrate','"(cos(x)/x) - (sin(x)/x^2)"','x')
f = vectorize(inline(result));
plot(f(1:.1:100))

24 Jul 2013 Jonathan Lister

make sure the equation string that you pass in is enclosed within a double quotes as well as the single quote...

funstr = '"x^2 + 2*x + 1"'
result = symeval('factor',funstr)

Updates
07 Aug 2013

updated title, description, and other requirements text

09 Aug 2013

Added image and changed title text...

Contact us