Matlab - Why does including positive assumption disqualify positive answers?Why is MATLAB so fast in matrix multiplication?Sort Coordinates Points in MatlabStoring data in matrix format in simulink3D image plottingI would like to loop over a specific combination of 2 variables. How can I achieve this?Why matlab returns wrong answerHow to apply additional constraints on fsolve?Matlab--Applying and reversing operations on a matrixMultidimensional arrays of 3-D objects: how to vectorise inner productsHow to solve overdetermined quadratic system in Circle Packing

How can I reorder triggered abilities in Arena?

Prevent use of CNAME record for untrusted domain

What does "rel" in `mathrel` and `stackrel` stands for?

How to respectfully refuse to assist co-workers with IT issues?

Could George I (of Great Britain) speak English?

“T” in subscript in formulas

Need to number each equation in an optimization problem

Cooking Scrambled Eggs

Can a giant mushroom be used as a material to build watercraft or sailing ships?

What is a natural problem in theory of computation?

How many birds in the bush?

What is the coil voltage of this contactor?

How to make onclick function execute only once?

Who was the most successful German spy against Great Britain in WWII, from the contemporary German perspective?

Deciphering 1910 Russian city name?

Read file lines into shell line separated by space

Non-visual Computers - thoughts?

Solve System of equation using elimination?

Is there any way to keep a player from killing an NPC?

What should come first—characters or plot?

Filling a listlineplot with a texture

To get so rich that you are not in need of anymore money

If an earthquake can destroy buildings why it cant kill us according to physics?

Redacting URLs as an email-phishing preventative?



Matlab - Why does including positive assumption disqualify positive answers?


Why is MATLAB so fast in matrix multiplication?Sort Coordinates Points in MatlabStoring data in matrix format in simulink3D image plottingI would like to loop over a specific combination of 2 variables. How can I achieve this?Why matlab returns wrong answerHow to apply additional constraints on fsolve?Matlab--Applying and reversing operations on a matrixMultidimensional arrays of 3-D objects: how to vectorise inner productsHow to solve overdetermined quadratic system in Circle Packing






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5















Running the code below results in two sets of solutions being given. For one set of solutions, the z-values will both be >=0 (39.4962 and 0). For the other set of solutions, one z-value will be <0 (-39.4962 and 0).



If I include the "assumeAlso" lines that are currently commented out, no solutions are given. This is not what I expected; I assumed only the second set of solutions would be disqualified, since the first solution does not contradict the assumptions.



Can anyone enlighten me as to why this is happening? Thanks in advance.



points = [0.368,0.02,2.3 ; -0.536,-0.108,2.3];
d = 40;

syms x1 y1 z1 x2 y2 z2 real


% assumeAlso(z1 >= 0)
% assumeAlso(z2 >= 0)


% Conditions L1 must satisfy
line1 = [
x1/points(1,1) == y1/points(1,2)
y1/points(1,2) == z1/points(1,3)
];

% Conditions L2 must satisfy
line2 = [
x2/points(2,1) == y2/points(2,2)
y2/points(2,2) == z2/points(2,3)
];


distance = [
( (x1-x2).^2 + (y1-y2).^2 + (z1-z2).^2 ) == d.^2
];

solved = solve([line1,line2,distance],[x1,y1,z1,x2,y2,z2]);


disp([
eval([solved.x1 solved.y1 solved.z1])
eval([solved.x2 solved.y2 solved.z2])
])









share|improve this question





















  • 1





    Just to be sure, can you please try assumeAlso(... >= -1e-9) instead of >= 0?

    – dyukha
    Mar 27 at 19:09












  • Unfortunately, this produces the same results.

    – Jolene_F
    Mar 27 at 23:25

















5















Running the code below results in two sets of solutions being given. For one set of solutions, the z-values will both be >=0 (39.4962 and 0). For the other set of solutions, one z-value will be <0 (-39.4962 and 0).



If I include the "assumeAlso" lines that are currently commented out, no solutions are given. This is not what I expected; I assumed only the second set of solutions would be disqualified, since the first solution does not contradict the assumptions.



Can anyone enlighten me as to why this is happening? Thanks in advance.



points = [0.368,0.02,2.3 ; -0.536,-0.108,2.3];
d = 40;

syms x1 y1 z1 x2 y2 z2 real


% assumeAlso(z1 >= 0)
% assumeAlso(z2 >= 0)


% Conditions L1 must satisfy
line1 = [
x1/points(1,1) == y1/points(1,2)
y1/points(1,2) == z1/points(1,3)
];

% Conditions L2 must satisfy
line2 = [
x2/points(2,1) == y2/points(2,2)
y2/points(2,2) == z2/points(2,3)
];


distance = [
( (x1-x2).^2 + (y1-y2).^2 + (z1-z2).^2 ) == d.^2
];

solved = solve([line1,line2,distance],[x1,y1,z1,x2,y2,z2]);


disp([
eval([solved.x1 solved.y1 solved.z1])
eval([solved.x2 solved.y2 solved.z2])
])









share|improve this question





















  • 1





    Just to be sure, can you please try assumeAlso(... >= -1e-9) instead of >= 0?

    – dyukha
    Mar 27 at 19:09












  • Unfortunately, this produces the same results.

    – Jolene_F
    Mar 27 at 23:25













5












5








5








Running the code below results in two sets of solutions being given. For one set of solutions, the z-values will both be >=0 (39.4962 and 0). For the other set of solutions, one z-value will be <0 (-39.4962 and 0).



If I include the "assumeAlso" lines that are currently commented out, no solutions are given. This is not what I expected; I assumed only the second set of solutions would be disqualified, since the first solution does not contradict the assumptions.



Can anyone enlighten me as to why this is happening? Thanks in advance.



points = [0.368,0.02,2.3 ; -0.536,-0.108,2.3];
d = 40;

syms x1 y1 z1 x2 y2 z2 real


% assumeAlso(z1 >= 0)
% assumeAlso(z2 >= 0)


% Conditions L1 must satisfy
line1 = [
x1/points(1,1) == y1/points(1,2)
y1/points(1,2) == z1/points(1,3)
];

% Conditions L2 must satisfy
line2 = [
x2/points(2,1) == y2/points(2,2)
y2/points(2,2) == z2/points(2,3)
];


distance = [
( (x1-x2).^2 + (y1-y2).^2 + (z1-z2).^2 ) == d.^2
];

solved = solve([line1,line2,distance],[x1,y1,z1,x2,y2,z2]);


disp([
eval([solved.x1 solved.y1 solved.z1])
eval([solved.x2 solved.y2 solved.z2])
])









share|improve this question
















Running the code below results in two sets of solutions being given. For one set of solutions, the z-values will both be >=0 (39.4962 and 0). For the other set of solutions, one z-value will be <0 (-39.4962 and 0).



If I include the "assumeAlso" lines that are currently commented out, no solutions are given. This is not what I expected; I assumed only the second set of solutions would be disqualified, since the first solution does not contradict the assumptions.



Can anyone enlighten me as to why this is happening? Thanks in advance.



points = [0.368,0.02,2.3 ; -0.536,-0.108,2.3];
d = 40;

syms x1 y1 z1 x2 y2 z2 real


% assumeAlso(z1 >= 0)
% assumeAlso(z2 >= 0)


% Conditions L1 must satisfy
line1 = [
x1/points(1,1) == y1/points(1,2)
y1/points(1,2) == z1/points(1,3)
];

% Conditions L2 must satisfy
line2 = [
x2/points(2,1) == y2/points(2,2)
y2/points(2,2) == z2/points(2,3)
];


distance = [
( (x1-x2).^2 + (y1-y2).^2 + (z1-z2).^2 ) == d.^2
];

solved = solve([line1,line2,distance],[x1,y1,z1,x2,y2,z2]);


disp([
eval([solved.x1 solved.y1 solved.z1])
eval([solved.x2 solved.y2 solved.z2])
])






matlab






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 18:54







Jolene_F

















asked Mar 27 at 4:20









Jolene_FJolene_F

355 bronze badges




355 bronze badges










  • 1





    Just to be sure, can you please try assumeAlso(... >= -1e-9) instead of >= 0?

    – dyukha
    Mar 27 at 19:09












  • Unfortunately, this produces the same results.

    – Jolene_F
    Mar 27 at 23:25












  • 1





    Just to be sure, can you please try assumeAlso(... >= -1e-9) instead of >= 0?

    – dyukha
    Mar 27 at 19:09












  • Unfortunately, this produces the same results.

    – Jolene_F
    Mar 27 at 23:25







1




1





Just to be sure, can you please try assumeAlso(... >= -1e-9) instead of >= 0?

– dyukha
Mar 27 at 19:09






Just to be sure, can you please try assumeAlso(... >= -1e-9) instead of >= 0?

– dyukha
Mar 27 at 19:09














Unfortunately, this produces the same results.

– Jolene_F
Mar 27 at 23:25





Unfortunately, this produces the same results.

– Jolene_F
Mar 27 at 23:25












1 Answer
1






active

oldest

votes


















2















You are trying to solve a problem that has infinite solutions. In other words, there is an independency between the variables x1 y1 z1 x2 y2 z2 you are solving for. The solver seems to find this independency only when constraining the variable (and confusingly so only outputs a finite number of solutions if you don't): you will find that you get the same warning even when specifying something silly like



assumeAlso(z1>=-inf)
assumeAlso(z2>=-inf)


An inequality constraint like assumeAlso(z1>=0) does not remove the independency. Instead, imposing an equality constraint like assumeAlso(z2==0) will solve the problem. You can then specify assumeAlso(z1>=0) to find the one specific solution you are looking for. I.e., specify:



assumeAlso(z1>=0)
assumeAlso(z2==0)


However, note that, for example, you will find another feasible solution for the constraint assumeAlso(z2==1), or even assumeAlso(z2==2*z1), etc...






share|improve this answer


























    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',
    autoActivateHeartbeat: false,
    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%2f55369761%2fmatlab-why-does-including-positive-assumption-disqualify-positive-answers%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









    2















    You are trying to solve a problem that has infinite solutions. In other words, there is an independency between the variables x1 y1 z1 x2 y2 z2 you are solving for. The solver seems to find this independency only when constraining the variable (and confusingly so only outputs a finite number of solutions if you don't): you will find that you get the same warning even when specifying something silly like



    assumeAlso(z1>=-inf)
    assumeAlso(z2>=-inf)


    An inequality constraint like assumeAlso(z1>=0) does not remove the independency. Instead, imposing an equality constraint like assumeAlso(z2==0) will solve the problem. You can then specify assumeAlso(z1>=0) to find the one specific solution you are looking for. I.e., specify:



    assumeAlso(z1>=0)
    assumeAlso(z2==0)


    However, note that, for example, you will find another feasible solution for the constraint assumeAlso(z2==1), or even assumeAlso(z2==2*z1), etc...






    share|improve this answer































      2















      You are trying to solve a problem that has infinite solutions. In other words, there is an independency between the variables x1 y1 z1 x2 y2 z2 you are solving for. The solver seems to find this independency only when constraining the variable (and confusingly so only outputs a finite number of solutions if you don't): you will find that you get the same warning even when specifying something silly like



      assumeAlso(z1>=-inf)
      assumeAlso(z2>=-inf)


      An inequality constraint like assumeAlso(z1>=0) does not remove the independency. Instead, imposing an equality constraint like assumeAlso(z2==0) will solve the problem. You can then specify assumeAlso(z1>=0) to find the one specific solution you are looking for. I.e., specify:



      assumeAlso(z1>=0)
      assumeAlso(z2==0)


      However, note that, for example, you will find another feasible solution for the constraint assumeAlso(z2==1), or even assumeAlso(z2==2*z1), etc...






      share|improve this answer





























        2














        2










        2









        You are trying to solve a problem that has infinite solutions. In other words, there is an independency between the variables x1 y1 z1 x2 y2 z2 you are solving for. The solver seems to find this independency only when constraining the variable (and confusingly so only outputs a finite number of solutions if you don't): you will find that you get the same warning even when specifying something silly like



        assumeAlso(z1>=-inf)
        assumeAlso(z2>=-inf)


        An inequality constraint like assumeAlso(z1>=0) does not remove the independency. Instead, imposing an equality constraint like assumeAlso(z2==0) will solve the problem. You can then specify assumeAlso(z1>=0) to find the one specific solution you are looking for. I.e., specify:



        assumeAlso(z1>=0)
        assumeAlso(z2==0)


        However, note that, for example, you will find another feasible solution for the constraint assumeAlso(z2==1), or even assumeAlso(z2==2*z1), etc...






        share|improve this answer















        You are trying to solve a problem that has infinite solutions. In other words, there is an independency between the variables x1 y1 z1 x2 y2 z2 you are solving for. The solver seems to find this independency only when constraining the variable (and confusingly so only outputs a finite number of solutions if you don't): you will find that you get the same warning even when specifying something silly like



        assumeAlso(z1>=-inf)
        assumeAlso(z2>=-inf)


        An inequality constraint like assumeAlso(z1>=0) does not remove the independency. Instead, imposing an equality constraint like assumeAlso(z2==0) will solve the problem. You can then specify assumeAlso(z1>=0) to find the one specific solution you are looking for. I.e., specify:



        assumeAlso(z1>=0)
        assumeAlso(z2==0)


        However, note that, for example, you will find another feasible solution for the constraint assumeAlso(z2==1), or even assumeAlso(z2==2*z1), etc...







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 28 at 9:37

























        answered Mar 28 at 9:15









        JJM DriessenJJM Driessen

        3812 silver badges12 bronze badges




        3812 silver badges12 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369761%2fmatlab-why-does-including-positive-assumption-disqualify-positive-answers%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

            Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

            밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

            1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴