# Does the Symbolic Toolbox Support 0- and 0+ ?

6 views (last 30 days)
Paul on 25 Feb 2024
Edited: Paul on 25 Feb 2024
syms s
syms t real
f = int(exp(-s*t),t,-inf,0)
f =
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)
ans = 1×1 cell array
{[~0 < s]}
Looks like the NOT (~) symbol is involved.
c = c{2}
c =
Interestingly, the children of c, which looks like an ordinary symbolic expression, can't be obtained
whos c
Name Size Bytes Class Attributes c 1x1 8 sym
children(c)
ans = 1×1 cell array
{[0 < s]}
I was expecting to be able to do this:
children(0 < s)
ans = 1×2 cell array
{[0]} {[s]}
Because it appear that ~0 is a symbolic thing for , I tried this:
nzero = ~sym(0)
nzero =
But does that mean ?
This integral returns 1/2
int(dirac(t),0,1)
ans =
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)
ans =
0
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
ans = 'Invalid argument.'
I was hoping this result would be 1.
What exactly is nzero and for what can it be used?
Paul on 25 Feb 2024
Paul on 25 Feb 2024
Edited: Paul on 25 Feb 2024
Complete misunderstanding on my part. Looks like it really is a logical NOT applied to the inequality. I guess I got thrown off by no parentheses.
syms s
~(sym(0) < s)
ans =
Is that the same as?
sym(0) >= s
ans =
Returning to the original problem
syms s
syms t real
f = int(exp(-s*t),t,-inf,0)
f =
c = children(f)
c = 3x2 cell array
{[Inf ]} {[0 < s ]} {[limit(exp(-s*t), t, -Inf)/s - 1/s]} {[0 < real(s) & ~0 < s ]} {[-1/s ]} {[s ~= 0 & angle(-s) in Dom::Interval(-pi/2, pi/2) | real(s) < 0]}
h(s) = c{2,2}
h(s) =
simplify(h(s),10)
ans =
Are there any values of s s.t. h(s) is true?
h([-1, 0, 1, 1i])
ans =
simplify(ans)
ans =
If not, why is that solution returned from int?
Further confusing things for me is that this expression
~(sym(0) < 5)
ans =
is displayed without parentheses, suggesting that the SMT uses an order of operations where < is evaluated before ~. But this expression seems to indicate the opposite (though I'm not sure what this epxression means mathematically).
~sym(0) < 5
ans =

Walter Roberson on 25 Feb 2024
posZ = sym(0);
negZ = sym(-0);
negZ2 = -sym(0);
1/posZ
ans =
1/negZ
ans =
1/negZ2
ans =
So, no, there is no negative 0 -- if there were then one of the answers would have been -inf
Paul on 25 Feb 2024
I didn't mean negative zero. I meant which loosely means a very, very small number that's less than 0, often used in Laplace transform stuff (example)

### Categories

Find more on Symbolic Variables, Expressions, Functions, and Preferences in Help Center and File Exchange

R2023b

### Community Treasure Hunt

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

Start Hunting!