“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.










share|improve this question
























  • 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















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.










share|improve this question
























  • 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













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.










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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












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)





share|improve this answer























  • 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




    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











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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

























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)





share|improve this answer























  • 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




    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















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)





share|improve this answer























  • 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




    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













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)





share|improve this answer














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)






share|improve this answer














share|improve this answer



share|improve this answer








edited Sep 23 '13 at 20:02

























answered Sep 23 '13 at 19:03









nneonneo

124k25192296




124k25192296












  • 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




    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


















  • 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




    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
















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


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks