How do I raise polynomials to various powers and then multiply them together?

4 views (last 30 days)
What is the easiest way to multiply a series of polynomials, some of which are to be squared or cubed or raised to some other power? Also, is there any way to generate output that looks like the sort of typeset polynomial one would see in a textbook as opposed to a concatenation of integers?
  4 Comments
Image Analyst
Image Analyst on 31 Dec 2012
Type ver on the command line to show what toolboxes you have. What do you mean by "a series of polynomials"? Do you have a bunch of equations rather than a numerical values for them at certain range of x values? Do you want to print out formulas with superscripts and Greek letters and other mathematical symbols onto figures, axes, or static text labels on GUIs?
James
James on 31 Dec 2012
My version/toolboxes: MATLAB Version: 7.14.0.739 (R2012a) MATLAB License Number: STUDENT Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1) Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot™ Client VM mixed mode ------------------------------------------------------------------------------------------------ MATLAB Version 7.14 (R2012a) Simulink Version 7.9 (R2012a) Control System Toolbox Version 9.3 (R2012a) DSP System Toolbox Version 8.2 (R2012a) Image Processing Toolbox Version 8.0 (R2012a) Optimization Toolbox Version 6.2 (R2012a) Signal Processing Toolbox Version 6.17 (R2012a) Simulink Control Design Version 3.5 (R2012a) Statistics Toolbox Version 8.0 (R2012a) Symbolic Math Toolbox Version 5.8
Now, suppose I have these polynomials: a = (x^2 + 4)^3 b = (x + 5) c = (e^ix +3x^4 + 2y + 4xy) and I want to compute d = a*b*c. How would I do that? I understand now how to make"pretty" from Walter Roberson's answer below, but would still like to know how handle products of powers of polynomials.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 31 Dec 2012
syms x
p1 = 5*x^3 - 7*x^2 - 9*x + 11;
p2 = 5*x^4 + 4*x^3 + 3*x^2 + 2*x + 1;
p3 = p1 * p2;
p3
pretty(p3)
p4 = expand(p3);
p4
pretty(p4);
  3 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!