Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
symbolic integration problem by change from maple->mupad kernel

Subject: symbolic integration problem by change from maple->mupad kernel

From: Manuel Höger

Date: 20 Sep, 2013 08:16:37

Message: 1 of 2

Hello,
I recently had to change from an old Matlab version (2007) with symbolic
maple Kernel to a relative new one (2012) with a symbolic Mupad Kernel.

I tried to use an old m file which I wrote a few times ago. In the old
version I was able to integrate over Heaviside step funktions using a
funktion instead of normal limits.
Now matlab tells me that it is not able to find the explicit Integral.

The code I used is basicly:


syms x s smin En sigma smax eps;


smin=1.16

smax=sym('mp^2+4*eps*En');

sigma =
sym('(200*(heaviside(s-1.255)*heaviside(1.818-s))+90*(heaviside(s-1.818)*heaviside(3.131-s)))*(s-0.938^2)');

f=int(sigma,s,smin,smax)


In the old version this works without any problems. Is there any
possibility to do this symbolically with the mupad kernel too?

Greetings
Manu

Subject: symbolic integration problem by change from maple->mupad kernel

From: Christopher Creutzig

Date: 27 Sep, 2013 09:34:42

Message: 2 of 2

On 20.09.13 10:16, Manuel Hger wrote:
> syms x s smin En sigma smax eps;
>
>
> smin=1.16
>
> smax=sym('mp^2+4*eps*En');
>
> sigma =
> sym('(200*(heaviside(s-1.255)*heaviside(1.818-s))+90*(heaviside(s-1.818)*heaviside(3.131-s)))*(s-0.938^2)');

Just as a general remark: Using strings to generate symbolic expressions
is not recommended. Just use

sigma = (200*(heaviside(s-1.255)*heaviside(1.818-s))+ ...
   90*(heaviside(s-1.818)*heaviside(3.131-s)))*(s-0.938^2);

instead.

> f=int(sigma,s,smin,smax)
>
>
> In the old version this works without any problems. Is there any
> possibility to do this symbolically with the mupad kernel too?

It seems not to work well with your smax setting, but if you leave smax
abstract, you can get a piecewise defined result:

>> syms x s En sigma smax eps;
>> smin=1.16;
>> sigma = (200*(heaviside(s-1.255)*heaviside(1.818-s))+ ...
     90*(heaviside(s-1.818)*heaviside(3.131-s)))*(s-0.938^2);
>> f=int(sigma,s,smin,smax)

f =

int((s - 1981232555272083/2251799813685248)*(200*heaviside(s -
251/200)*heaviside(909/500 - s) + 90*heaviside(s -
909/500)*heaviside(3131/1000 - s)), s == 29/25..smax)

>> simplify(feval(symengine, 'rewrite', f, 'piecewise'))
Warning: Cannot check whether the integrand is defined everywhere on the
integration interval. [defint_b_gr_a]

ans =

piecewise([smax <= 251/200, 0], [3131/1000 <= smax,
7385339457149474345789/28147497671065600000], [smax in
Dom::Interval(251/200, [909/500]), ((200*smax -
251)*(28147497671065600*smax - 14205704304614747))/56294995342131200],
[smax in Dom::Interval(909/500, 3131/1000), 45*smax^2 -
(89155464987243735*smax)/1125899906842624 +
973466582639913688321/14073748835532800000])

>> vpa(ans)

ans =

piecewise([smax <= 1.255, 0.0], [3.131 <= smax,
262.37996512000003497849576206136], [smax in Dom::Interval(1.255,
[1.818]), 0.000000000000000017763568394002504646778106689453*(200.0*smax
- 251.0)*(28147497671065600.0*smax - 14205704304614747.0)], [smax in
Dom::Interval(1.818, 3.131), 45.0*smax^2 -
79.185959999999986358432124688989*smax + 69.16896087999999226674674446258])


Don't let those Dom::Interval confuse you, they just mean 1.255 < smax
<= 1.818 and 1.818 < smax < 3.131, respectively.

(To file an enhancement request for future versions, please contact
MathWorks support, as usual.)


HTH,

Christopher

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us