Symbolic toolbox (Maple) - weird behavior
1 view (last 30 days)
Show older comments
I am using the Maple symbolic engine to evaluate the following expressions:
- expand(subs(int('(1-i+s*i+t*i)^p','s',0,1),'p',1))
- 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:
- expand(subs(int('(1-i+s*i+ t )^p','s',0,1),'p',1)) gives exactly the same result as
- 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.
0 Comments
Accepted Answer
Walter Roberson
on 15 Mar 2012
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.
2 Comments
Walter Roberson
on 15 Mar 2012
I have confirmed the problem in a newer Maple version, and have submitted a Maple bug report. I would not expect there to be a correction until at least Maple 17.
The work-around is to work at the Maple level and use Int() instead of int(), holding off evaluation of the integral as long as possible, and using value() against the Int() when it is time to get the result.
evalin(symengine, 'value(eval(Int((1-I*s+I*t)^p, s = 0 .. 1), p = 1))')
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!