MATLAB: Symbolic toolbox (Maple) – weird behavior

complexintegrationmapleMATLABsymbolicSymbolic Math Toolbox

I am using the Maple symbolic engine to evaluate the following expressions:
  1. expand(subs(int('(1-i+s*i+t*i)^p','s',0,1),'p',1))
  2. expand(subs(int('(1 -s*i+t*i)^p','s',0,1),'p',1))
The result should be exactly the same. However, the second one give the completely wrong result "1/2 i", which does not even depend on 't' as it should.
  • It is essential for my purposes to first integrate and only then substitute 'p'.
  • The same problem happens for any integer p>0 (not just p=1).
  • If I repeat the same experiment with 't' instead of 't*i' in the original expressions, everything calculates alright:
  1. expand(subs(int('(1-i+s*i+ t )^p','s',0,1),'p',1)) gives exactly the same result as
  2. expand(subs(int('(1 -s*i+ t )^p','s',0,1),'p',1))
Is this a bug? Any ideas?
[using Matlab 2011b and Maple 15.00 — the problem occurs with newer versions as well…]
Thanks, Shahar.

Best Answer

My understand, perhaps incorrect, is that all support for Maple as the symbolic engine after R2010b was supplied by Maplesoft -- e.g., symengine cannot be set in current versions.
I confirm the integration oddity in Maple 15; later today I will test in a newer Maple version and will report a bug if it happens in that version as well.
I have a good idea of what the response will be probably be, though: that it is a boundary-condition issue. Definite integration works by extrapolating the function from s and s+deltas and taking the difference and working that back to expression form for the indefinite integral, and then substituting in the actual limits supplied; that algorithm is known to produce odd results when the behavior of the function changes significantly with increasing values.