Is it possible to simplify 'piecewise' expressions by preimposing conditions?
2 次查看(过去 30 天)
显示 更早的评论
I am solving a problem involving integration of the expression 'K' defined over 'r' and 'z' in symbolics, along with parameters 'a' and 'b', also symbolic. Now, when I integrate 'K' as follows:
K = 1/b^2 + z^2/(b^2*r^2) ;
K_integration = int( int(K*2*pi*r,r,z,a) ,z,0,b ) ;
I get the following solution:
K_integration =
piecewise([0 <= a & b == 0, 0], [0 <= a & b ~= 0, (pi*a^2)/b - (pi*b*(6*log(b) - 6*log(a) + 1))/9])
Here piecewise function imposes the conditions, if satisfied, for which the integral evaluates to respective expressions. Can I somehow pre-impose these conditions, for example,
0 <= a & b ~= 0
and get the final expression directly.
(pi*a^2)/b - (pi*b*(6*log(b) - 6*log(a) + 1))/9
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!