Is it possible to display negative integer exponentials in MATLAB's MuPAD Symbolic Notebook?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 27 Août 2009
Commenté : Pouya Jamali
le 20 Déc 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.
Réponse acceptée
MathWorks Support Team
le 27 Août 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 commentaire
Pouya Jamali
le 20 Déc 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Number Theory dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!