Is it possible to display negative integer exponentials in MATLAB's MuPAD Symbolic Notebook?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 27 Aug. 2009
Kommentiert: Pouya Jamali
am 20 Dez. 2013
I would like get MuPAD to give me back polynomials with negative integer exponentials instead of displaying them in the rational form. For example, the following code in the MuPAD
% THIS CODE SHOULD BE WRITTEN IN THE MUPAD NOTEBOOK
[ f := (b0 * z^(2) + b1 * z^(1) + b2) / z^(2)
gives me:
[ 1/z^2*(b0*z^2 + b1*z + b2)
I would like to "simplify" this to
[ b0 + b1 * z^(-1) + b2 * z^(-2)
This would mainly be useful for me when creating and displaying a Laurent Polynomial.
Akzeptierte Antwort
MathWorks Support Team
am 27 Aug. 2009
The ability to directly display negative exponents is not available in MuPAD .
A workaround would be to place all the exponents into a domain that hides the negative signs from the output code for a while. As an example, try running the following code in the MuPAD Notebook:
domain expo
new := e -> new(dom, e);
print := e -> extop(e, 1);
end:
Pref::output(ex -> misc::maprec(ex,
{"_power"} = (ex -> subsop(ex, 2 = expo(op(ex, 2)), Unsimplified)))):
f := (b0 * z^(2) + b1 * z^(1) + b2) / z^(2);expand(f)
Note that this has the side effect of breaking the display of all fractions other than rational numbers. However, one can create a domain for the Laurent series that does something like the example shown for the exponents of the series variable and only there. That would ensure that the order of the terms is fixed and that the z factor is always the last in the product.
1 Kommentar
Pouya Jamali
am 20 Dez. 2013
Tanx. Could you please explain more about the method to define appropriate domain you've mentioned?
I like to have a Laurent Polynomial too. but the suggested domain above, doesn't ensure the reducing order of z.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Number Theory finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!