4.8

4.8 | 5 ratings Rate this file 212 downloads (last 30 days) File Size: 49.76 KB File ID: #9577

Symbolic Polynomial Manipulation

by John D'Errico

 

10 Jan 2006 (Updated 22 Mar 2009)

Code covered by BSD License  

Symbolic polynomial manipulation as an exercise in OOP

Download Now | Watch this File

File Information
Description

This toolbox is a very simple polynomial manipulation package.

I originally wrote it some years ago as a means of learning how to work with objects in Matlab. When I decided to publish this package, I completely rewrote it from scratch just this week, as the old one had some bugs in it.

Why publish this at all? Because I think writing such a tool is a marvelous way to learn about OOP and the use of classes in Matlab. A second reason is that this toolbox is actually of use to me on occasion, whenever I need to manipulate simple polynomials in one or several variables. If, as is the case with me and you don't own the symbolic toolbox, you may find it of interest too. I have included the functions orthpoly and gaussquadrule, as neat applications of the sympoly tools.

I've also put in a helper document that discusses things I felt important in writing a toolbox like this.

If you wish to use these tools, they are quite easy to use. A few quick examples:

% This creates 3 sympoly objects in your
% workspace: x, y, z.
sympoly x y z

% Add 1 to x, put the result in p.
p = x+1

% arbitrary expressions
q = (x-1)^3 + x*y*z - (x+1)*(z-1)

There are many other examples in the ReadMe file, some involving arrays of sympolys, as well as many more.

Whatever use you do find for this toolbox, have fun with it. I did. I even get some use from it occasionally.

If by some amazing chance you do find any bugs, please e-mail me.

Acknowledgements
This submission has inspired the following:
Polyfitn, Multiple-root polynomial solved by partial fraction expansion
MATLAB release MATLAB 7.0.1 (R14SP1)
Zip File Content  
Published M Files Sympoly_demos
Other Files
license.txt,
SymbolicPolynomials/@sympoly/clean_sympoly.m,
SymbolicPolynomials/@sympoly/conj.m,
SymbolicPolynomials/@sympoly/ctranspose.m,
SymbolicPolynomials/@sympoly/defint.m,
SymbolicPolynomials/@sympoly/det.m,
SymbolicPolynomials/@sympoly/diag.m,
SymbolicPolynomials/@sympoly/diff.m,
SymbolicPolynomials/@sympoly/disp.m,
SymbolicPolynomials/@sympoly/display.m,
SymbolicPolynomials/@sympoly/double.m,
SymbolicPolynomials/@sympoly/equalize_vars.m,
SymbolicPolynomials/@sympoly/gradient.m,
SymbolicPolynomials/@sympoly/horzcat.m,
SymbolicPolynomials/@sympoly/imag.m,
SymbolicPolynomials/@sympoly/int.m,
SymbolicPolynomials/@sympoly/minus.m,
SymbolicPolynomials/@sympoly/mpower.m,
SymbolicPolynomials/@sympoly/mrdivide.m,
SymbolicPolynomials/@sympoly/mtimes.m,
SymbolicPolynomials/@sympoly/plus.m,
SymbolicPolynomials/@sympoly/polyerrorprop.m,
SymbolicPolynomials/@sympoly/power.m,
SymbolicPolynomials/@sympoly/prod.m,
SymbolicPolynomials/@sympoly/rdivide.m,
SymbolicPolynomials/@sympoly/real.m,
SymbolicPolynomials/@sympoly/roots.m,
SymbolicPolynomials/@sympoly/sqrt.m,
SymbolicPolynomials/@sympoly/subs.m,
SymbolicPolynomials/@sympoly/subsasgn.m,
SymbolicPolynomials/@sympoly/subsref.m,
SymbolicPolynomials/@sympoly/sum.m,
SymbolicPolynomials/@sympoly/sympoly.m,
SymbolicPolynomials/@sympoly/syndivide.m,
SymbolicPolynomials/@sympoly/terms.m,
SymbolicPolynomials/@sympoly/times.m,
SymbolicPolynomials/@sympoly/uminus.m,
SymbolicPolynomials/@sympoly/uplus.m,
SymbolicPolynomials/@sympoly/vertcat.m,
SymbolicPolynomials/adjoint.m,
SymbolicPolynomials/consolidator.m,
SymbolicPolynomials/gaussquadrule.m,
SymbolicPolynomials/orthpoly.m,
SymbolicPolynomials/ReadMe.rtf,
SymbolicPolynomials/sym2sympoly.m,
SymbolicPolynomials/sympoly toolbox issues.rtf,
SymbolicPolynomials/sympoly2poly.m,
SymbolicPolynomials/sympoly2polyn.m,
SymbolicPolynomials/Sympoly_demos.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
11 May 2007 Oh-ig Kwoun

Excellent job! Thank you !!!

28 May 2007 Meghana Ranade

really helpful.. :)

26 Jun 2007 emilio Arnieri  
30 Jan 2009 Mohsen Nosratinia  
23 Mar 2009 Derek O'Connor  
Please login to add a comment or rating.
Updates
12 Jan 2006

Fixed a minor bug in the display of long expressions (too many *'s)

16 Jan 2006

Version 1.1: Repair disp bug - extraneous "*"
Version 1.2: Repaired a synthetic division bug

30 Jan 2006

Version 1.2 - Fixed a bug in subsasgn to make deal & repmat work properly. Added diag and adjoint capability, plus sympoly2poly. Added author, date and release number to the ReadMe doc.

30 Jan 2006

Version 2: added sympoly toolbox issues doc, plus HTML files, along with several new functions.

05 Apr 2006

Repaired a bug when substitutions are done into a constant sympoly.

18 Oct 2006

Version 1.3.

- Added overloadings for: real, imag, conj, ctranspose.

- Fixed adjoint for complex arrays.

- Repaired a bug on displaying some complex coefficients.

19 Mar 2009

Updated

22 Mar 2009

Now checks the command window numeric display format to decide on the formatting of all coefficients in disp. If the format is rational, then rational approximations for the coefficients are used.

Tag Activity for this File
Tag Applied By Date/Time
symbolic math John D'Errico 22 Oct 2008 08:12:08
symbolic polynomials John D'Errico 22 Oct 2008 08:12:08
expression John D'Errico 22 Oct 2008 08:12:08
manipulation John D'Errico 22 Oct 2008 08:12:08
mathematics John D'Errico 22 Oct 2008 08:12:08
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com