Re: How to find the exponents of terms in a symbolic polynomial using maple commands




"Paul Lusina" <paull@xxxxxxxxxx> wrote in message
news:ef3271c.-1@xxxxxxxxxxxxxxxxxxx
Dear Newsgroup

I have generated a polynomial using the maple symbolic kernel in
matlab to give:
S = L^4+L^5

I now want to extract the powers of L to get a vector
V = [4 5]

Is there a command to do this in maple?

Thanks
Paul.

Since you asked for a maple command, this is how I would do it in Maple:
(need to use the maple command in Matlab to use these)

restart;
with(PolynomialTools);
s:=x^5+x^4;
CoefficientList(s,x);

This gives a a list which has zero entry corresponding to missing power of L
entry in the polynomial.
i.e it will give

[0,0,0,0,1,1]

So all what you need to do is find all the entries that are not zero. The
position of that non-zero entry corresponds to the power that L is raised
to. Hence you can that V you are looking for. So in the above you see that
the 4th position is non-zero, hence you know there is an x^4 term, etc...

The bottom line is that using output from symbolic maple with Matlab own
functions is not a very smooth operation. There seems to be some
discontinuity between the two (a step function at the boundaries :)

Some output from the symbolic part can be easily converted to Matlab types
and used, some is not so easy to do.

What is probably needed is a complete set of Matlab functions that converts
all known Maple generated data types (Lists, sequences, Matrix, Vector,
rTable, matrix, vector, set, etc...) to Matlab defined data structures
(matrix, cells, structs, etc..)

This will allow one to more easily use pass Maple output to Matlab functions
by wrapping them in this conversion routines.

Nasser






.



Relevant Pages

  • Re: Mathematica Vs. Matlab
    ... Mathematica is a powerful CAS. ... Maple, REDUCE, MuPAD (it can be legally obtained for free at some circumstances, ... There are a number of programs to do numerical calculations with usual ... One example is Matlab; ...
    (sci.math.symbolic)
  • Maple vs Mathematica questions: symbolic & MacOS aspects only.
    ... has perhaps come to change CAS. ... I will keep on using Matlab at this ... than Maple where numerics are concerned. ... Mathematica, but will do so. ...
    (sci.math.symbolic)
  • Re: conversion when using solve
    ... whether it is me that is missing something or it's matlab. ... the symbolic engine was Maple. ... one invoked by the 'format rat' ...
    (comp.soft-sys.matlab)
  • Re: Large Number support in Matlab
    ... obtained by making many combinatorics calculations including factorials, ... The code was fully written using Matlab, ... Matlab to Maple because supposedly Matlab couldn't perform high accuracy ...
    (comp.soft-sys.matlab)
  • Re: Maple calls from Student Version
    ... I have MATlab version 7.1 and Maple 8. ... I understand that the symbolic part of Matlab comes in 2 flavors. ... A basic one (which is included in the student version), ... I was able to configure Maple to call MATlab by linking the libraries ...
    (comp.soft-sys.matlab)