Does the Symbolic Toolbox Support 0- and 0+ ?
2 次查看(过去 30 天)
显示 更早的评论
syms s
syms t real
f = int(exp(-s*t),t,-inf,0)
Is the second term in the second condition a notation for (though I'm not exactly sure what int is returning for that case)? I'm not sure because doesn't really make sense if s is complex, and if it really means then that condition would make 0 < real(s) unneccesary in the joint condition. If so, is there a way for the user to enter and in expressions, particluarly as one or both bounds of int?
Exploring a bit further, the second term in the second expression is
c = children(f);
c = children(c{2,2});
c(2)
Looks like the NOT (~) symbol is involved.
c = c{2}
Interestingly, the children of c, which looks like an ordinary symbolic expression, can't be obtained
whos c
children(c)
I was expecting to be able to do this:
children(0 < s)
Because it appear that ~0 is a symbolic thing for , I tried this:
nzero = ~sym(0)
But does that mean ?
This integral returns 1/2
int(dirac(t),0,1)
Actually, I was shocked when I saw this. This result is different than what I see in 2022a
though I found nothing in the release notes (including bug fixes) to indicate this change in behavior. Having said that, I can kind of see the appeal in the 2023b result, though I'm not sure it's a rigorous result.
Anyway, the next thing I tried is
int(dirac(t),t,~0,1)
I guess that makes sense because ~0 is logical true, which I guess is converted to numerical (or symbolic) 1 for int. But using nzero results in an error
try
int(dirac(t),t,nzero,1)
catch ME
ME.message
end
I was hoping this result would be 1.
What exactly is nzero and for what can it be used?
回答(1 个)
Walter Roberson
2024-2-25
posZ = sym(0);
negZ = sym(-0);
negZ2 = -sym(0);
1/posZ
1/negZ
1/negZ2
So, no, there is no negative 0 -- if there were then one of the answers would have been -inf
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Variables, Expressions, Functions, and Preferences 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!