Error in symengine for symbolic integration

조회 수: 6 (최근 30일)
vahid s
vahid s 2021년 8월 18일
댓글: vahid s 2021년 8월 20일
I want to calculate a symbolic integration like below:
syms z
hc=2.5e-9;
hp=1e-9;
e31=-2.2;
z1=z-hc-(hp/2);
z2=z+hc+(hp/2);
B31_1=double(int(e31*(pi/hp)*(sin(pi*z2/hp))*(z^1),'z',-hc-hp,-hc)+int(e31*(pi/hp)*(sin(pi*z1/hp))*(z^1),'z',hc,hc+hp));
But I get this error:
Error using symengine
Out of memory.
Error in sym/int (line 167)
rSym = mupadmex('symobj::intdef',f.s,x.s,a.s,b.s,options);
Note: For z^0 there is no error, but when z has power, this error appears.
What is solution for this? Thanks in advance.
  댓글 수: 4
Walter Roberson
Walter Roberson 2021년 8월 19일
편집: Walter Roberson 2021년 8월 19일
On my system, in R2020a, it does not even use as much as 1 gigabyte between MATLAB itself and the MuPAD process to do the integration. No hint of a problem at all. MacOS.
vahid s
vahid s 2021년 8월 19일
I have 4 GB RAM, and also matlab doesn't freeze to use memory. It shows error immediately. Since I prefer using "syms" instead of "@fun", I reported this problem.
Thanks for your answer.

댓글을 달려면 로그인하십시오.

채택된 답변

Wan Ji
Wan Ji 2021년 8월 19일
This is a bug in matlab. A good way to avoid this bug is just to predefine symbols rather than use constants in the symbolic process. When symbolic formula is derived, use subs and eval function to obtain the final results.
syms z hc hp e31
z1=z-hc-(hp/2);
z2=z+hc+(hp/2);
p = e31*(pi/hp)*(sin(pi*z2/hp))*z^1;
q = e31*(pi/hp)*(sin(pi*z1/hp))*z^1;
B31_1 = int(p,z,-hc-hp,-hc)+int(q,z,hc,hc+hp)
B31_1_val = eval(subs(B31_1,[hc,hp,e31],[2.5e-9, 1e-9, -2.2]))
The result in this
B31_1 =
(4*e31*hp)/pi
B31_1_val =
-2.801126998417358e-09
Since you observed this bug, I suggest you report it to MATHWORKS. You will be really appreciated. ovo
  댓글 수: 1
vahid s
vahid s 2021년 8월 20일
Thank you so much for solution.
I think this bug is solved in newest version R2021a, so maybe there is no point for reporting this bug since it is solved.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by