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

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해