“Unable to prove `expr` literally…” error when trying to compare a symbol inside a function
up vote
1
down vote
favorite
I just started learning MATLAB and I'm trying to normalize a bump
function given by
function b = bump(x)
region1 = abs(x) < 1
b(region1) = (exp(-1./(1 - x(region1).^2)))
region2 = abs(x) >= 1
b(region2) = 0
end
To do this, I need to divide by the definite integral from -1 to 1. However, when I input
syms x;
int(bump(x), -1, 1)
I get a long error message, which says
Error using symengine (line 58)
Unable to prove 'abs(x) < 1' literally. To test the statement mathematically, use isAlways.
Error in sym/subsindex (line 1554)
X = find(mupadmex('symobj::logical',A.s,9)) - 1;
Error in sym>privformat (line 2357)
x = subsindex(x)+1;
Error in sym/subsref (line 1578)
[inds{k},refs{k}] = privformat(inds{k});
Error in bump (line 3)
b(region1) = (exp(-1./(1 - x(region1).^2)))
I tried replacing abs(x)<1
with what I think is the suggested isAlways(abs(x)<1)
, and that removes the error, although it gives the wrong answer (it says the integral is zero).
I don't understand what does the error message means.
matlab symbolic-math
add a comment |
up vote
1
down vote
favorite
I just started learning MATLAB and I'm trying to normalize a bump
function given by
function b = bump(x)
region1 = abs(x) < 1
b(region1) = (exp(-1./(1 - x(region1).^2)))
region2 = abs(x) >= 1
b(region2) = 0
end
To do this, I need to divide by the definite integral from -1 to 1. However, when I input
syms x;
int(bump(x), -1, 1)
I get a long error message, which says
Error using symengine (line 58)
Unable to prove 'abs(x) < 1' literally. To test the statement mathematically, use isAlways.
Error in sym/subsindex (line 1554)
X = find(mupadmex('symobj::logical',A.s,9)) - 1;
Error in sym>privformat (line 2357)
x = subsindex(x)+1;
Error in sym/subsref (line 1578)
[inds{k},refs{k}] = privformat(inds{k});
Error in bump (line 3)
b(region1) = (exp(-1./(1 - x(region1).^2)))
I tried replacing abs(x)<1
with what I think is the suggested isAlways(abs(x)<1)
, and that removes the error, although it gives the wrong answer (it says the integral is zero).
I don't understand what does the error message means.
matlab symbolic-math
Are you using symbolic objects on purpose?
– Eitan T
Sep 23 '13 at 19:03
@EitanT: if he's just learning MATLAB, then I'd guess "no".
– nneonneo
Sep 23 '13 at 19:04
@nneonneo I'm trying not to put words in the OP's mouth, that's why I'm asking.
– Eitan T
Sep 23 '13 at 19:06
Eitan is right. My learning MATLAB consists of my Googling "matlab integrate" and seeing what comes up. So, this probably isn't what I want.
– Alexander Sibelius
Sep 23 '13 at 19:08
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I just started learning MATLAB and I'm trying to normalize a bump
function given by
function b = bump(x)
region1 = abs(x) < 1
b(region1) = (exp(-1./(1 - x(region1).^2)))
region2 = abs(x) >= 1
b(region2) = 0
end
To do this, I need to divide by the definite integral from -1 to 1. However, when I input
syms x;
int(bump(x), -1, 1)
I get a long error message, which says
Error using symengine (line 58)
Unable to prove 'abs(x) < 1' literally. To test the statement mathematically, use isAlways.
Error in sym/subsindex (line 1554)
X = find(mupadmex('symobj::logical',A.s,9)) - 1;
Error in sym>privformat (line 2357)
x = subsindex(x)+1;
Error in sym/subsref (line 1578)
[inds{k},refs{k}] = privformat(inds{k});
Error in bump (line 3)
b(region1) = (exp(-1./(1 - x(region1).^2)))
I tried replacing abs(x)<1
with what I think is the suggested isAlways(abs(x)<1)
, and that removes the error, although it gives the wrong answer (it says the integral is zero).
I don't understand what does the error message means.
matlab symbolic-math
I just started learning MATLAB and I'm trying to normalize a bump
function given by
function b = bump(x)
region1 = abs(x) < 1
b(region1) = (exp(-1./(1 - x(region1).^2)))
region2 = abs(x) >= 1
b(region2) = 0
end
To do this, I need to divide by the definite integral from -1 to 1. However, when I input
syms x;
int(bump(x), -1, 1)
I get a long error message, which says
Error using symengine (line 58)
Unable to prove 'abs(x) < 1' literally. To test the statement mathematically, use isAlways.
Error in sym/subsindex (line 1554)
X = find(mupadmex('symobj::logical',A.s,9)) - 1;
Error in sym>privformat (line 2357)
x = subsindex(x)+1;
Error in sym/subsref (line 1578)
[inds{k},refs{k}] = privformat(inds{k});
Error in bump (line 3)
b(region1) = (exp(-1./(1 - x(region1).^2)))
I tried replacing abs(x)<1
with what I think is the suggested isAlways(abs(x)<1)
, and that removes the error, although it gives the wrong answer (it says the integral is zero).
I don't understand what does the error message means.
matlab symbolic-math
matlab symbolic-math
edited Nov 21 at 11:27
Bebs
6413923
6413923
asked Sep 23 '13 at 18:46
Alexander Sibelius
1204
1204
Are you using symbolic objects on purpose?
– Eitan T
Sep 23 '13 at 19:03
@EitanT: if he's just learning MATLAB, then I'd guess "no".
– nneonneo
Sep 23 '13 at 19:04
@nneonneo I'm trying not to put words in the OP's mouth, that's why I'm asking.
– Eitan T
Sep 23 '13 at 19:06
Eitan is right. My learning MATLAB consists of my Googling "matlab integrate" and seeing what comes up. So, this probably isn't what I want.
– Alexander Sibelius
Sep 23 '13 at 19:08
add a comment |
Are you using symbolic objects on purpose?
– Eitan T
Sep 23 '13 at 19:03
@EitanT: if he's just learning MATLAB, then I'd guess "no".
– nneonneo
Sep 23 '13 at 19:04
@nneonneo I'm trying not to put words in the OP's mouth, that's why I'm asking.
– Eitan T
Sep 23 '13 at 19:06
Eitan is right. My learning MATLAB consists of my Googling "matlab integrate" and seeing what comes up. So, this probably isn't what I want.
– Alexander Sibelius
Sep 23 '13 at 19:08
Are you using symbolic objects on purpose?
– Eitan T
Sep 23 '13 at 19:03
Are you using symbolic objects on purpose?
– Eitan T
Sep 23 '13 at 19:03
@EitanT: if he's just learning MATLAB, then I'd guess "no".
– nneonneo
Sep 23 '13 at 19:04
@EitanT: if he's just learning MATLAB, then I'd guess "no".
– nneonneo
Sep 23 '13 at 19:04
@nneonneo I'm trying not to put words in the OP's mouth, that's why I'm asking.
– Eitan T
Sep 23 '13 at 19:06
@nneonneo I'm trying not to put words in the OP's mouth, that's why I'm asking.
– Eitan T
Sep 23 '13 at 19:06
Eitan is right. My learning MATLAB consists of my Googling "matlab integrate" and seeing what comes up. So, this probably isn't what I want.
– Alexander Sibelius
Sep 23 '13 at 19:08
Eitan is right. My learning MATLAB consists of my Googling "matlab integrate" and seeing what comes up. So, this probably isn't what I want.
– Alexander Sibelius
Sep 23 '13 at 19:08
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
syms x
defines x
as a symbolic variable, invoking symbolic computation on x
. This probably isn't what you want.
Instead, define x
as some kind of input matrix, e.g. x = zeros(3);
. Or, to do numeric integration, use the integral
function:
integral(@bump, -1, 1)
I changedx
tox = -2:.01:2
, but now it saysUndefined function 'int' for input arguments of type 'double'.
What does this mean?
– Alexander Sibelius
Sep 23 '13 at 19:13
1
Ah. I see now. You want an integral, which requires a function. You saw the symbolic documentation first so you didn't see the numeric integration function right after that. I added an example forintegral
.
– nneonneo
Sep 23 '13 at 20:03
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
syms x
defines x
as a symbolic variable, invoking symbolic computation on x
. This probably isn't what you want.
Instead, define x
as some kind of input matrix, e.g. x = zeros(3);
. Or, to do numeric integration, use the integral
function:
integral(@bump, -1, 1)
I changedx
tox = -2:.01:2
, but now it saysUndefined function 'int' for input arguments of type 'double'.
What does this mean?
– Alexander Sibelius
Sep 23 '13 at 19:13
1
Ah. I see now. You want an integral, which requires a function. You saw the symbolic documentation first so you didn't see the numeric integration function right after that. I added an example forintegral
.
– nneonneo
Sep 23 '13 at 20:03
add a comment |
up vote
2
down vote
accepted
syms x
defines x
as a symbolic variable, invoking symbolic computation on x
. This probably isn't what you want.
Instead, define x
as some kind of input matrix, e.g. x = zeros(3);
. Or, to do numeric integration, use the integral
function:
integral(@bump, -1, 1)
I changedx
tox = -2:.01:2
, but now it saysUndefined function 'int' for input arguments of type 'double'.
What does this mean?
– Alexander Sibelius
Sep 23 '13 at 19:13
1
Ah. I see now. You want an integral, which requires a function. You saw the symbolic documentation first so you didn't see the numeric integration function right after that. I added an example forintegral
.
– nneonneo
Sep 23 '13 at 20:03
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
syms x
defines x
as a symbolic variable, invoking symbolic computation on x
. This probably isn't what you want.
Instead, define x
as some kind of input matrix, e.g. x = zeros(3);
. Or, to do numeric integration, use the integral
function:
integral(@bump, -1, 1)
syms x
defines x
as a symbolic variable, invoking symbolic computation on x
. This probably isn't what you want.
Instead, define x
as some kind of input matrix, e.g. x = zeros(3);
. Or, to do numeric integration, use the integral
function:
integral(@bump, -1, 1)
edited Sep 23 '13 at 20:02
answered Sep 23 '13 at 19:03
nneonneo
124k25192296
124k25192296
I changedx
tox = -2:.01:2
, but now it saysUndefined function 'int' for input arguments of type 'double'.
What does this mean?
– Alexander Sibelius
Sep 23 '13 at 19:13
1
Ah. I see now. You want an integral, which requires a function. You saw the symbolic documentation first so you didn't see the numeric integration function right after that. I added an example forintegral
.
– nneonneo
Sep 23 '13 at 20:03
add a comment |
I changedx
tox = -2:.01:2
, but now it saysUndefined function 'int' for input arguments of type 'double'.
What does this mean?
– Alexander Sibelius
Sep 23 '13 at 19:13
1
Ah. I see now. You want an integral, which requires a function. You saw the symbolic documentation first so you didn't see the numeric integration function right after that. I added an example forintegral
.
– nneonneo
Sep 23 '13 at 20:03
I changed
x
to x = -2:.01:2
, but now it says Undefined function 'int' for input arguments of type 'double'.
What does this mean?– Alexander Sibelius
Sep 23 '13 at 19:13
I changed
x
to x = -2:.01:2
, but now it says Undefined function 'int' for input arguments of type 'double'.
What does this mean?– Alexander Sibelius
Sep 23 '13 at 19:13
1
1
Ah. I see now. You want an integral, which requires a function. You saw the symbolic documentation first so you didn't see the numeric integration function right after that. I added an example for
integral
.– nneonneo
Sep 23 '13 at 20:03
Ah. I see now. You want an integral, which requires a function. You saw the symbolic documentation first so you didn't see the numeric integration function right after that. I added an example for
integral
.– nneonneo
Sep 23 '13 at 20:03
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18966576%2funable-to-prove-expr-literally-error-when-trying-to-compare-a-symbol-insi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you using symbolic objects on purpose?
– Eitan T
Sep 23 '13 at 19:03
@EitanT: if he's just learning MATLAB, then I'd guess "no".
– nneonneo
Sep 23 '13 at 19:04
@nneonneo I'm trying not to put words in the OP's mouth, that's why I'm asking.
– Eitan T
Sep 23 '13 at 19:06
Eitan is right. My learning MATLAB consists of my Googling "matlab integrate" and seeing what comes up. So, this probably isn't what I want.
– Alexander Sibelius
Sep 23 '13 at 19:08