cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Limit to solution to Integers

ppal
17-Peridot

Limit to solution to Integers

What would be the simplest way to limit solutions to integers. Mathcad attached

muser_0-1612151086319.png

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:ppal)

Prime is not suitable for solving Diophantine equations. The algorithm used in the solve block needs to be able to change the variables in small steps and see if the overall error gets smaller or not. If you add constraints like the ones shown in the picture below, small changes will not alter the error and so Prime gives up.

Werner_E_0-1612157450861.png

 

 

You may use the symbolic solver, but it only finds the trivial solution 0/0/0. And demanding it to give all solutions (modifier "fully") gives a rather useless result.

Werner_E_1-1612157490907.png

 

So in case of your task, a brute force attack seems to be the best approach.

Werner_E_2-1612157552705.png

 

In case you also want solutions with negative integers, you should filter the solutions containing a zero as otherwise you would see too many solutions of the form -5/0/5.

View solution in original post

1 REPLY 1
Werner_E
25-Diamond I
(To:ppal)

Prime is not suitable for solving Diophantine equations. The algorithm used in the solve block needs to be able to change the variables in small steps and see if the overall error gets smaller or not. If you add constraints like the ones shown in the picture below, small changes will not alter the error and so Prime gives up.

Werner_E_0-1612157450861.png

 

 

You may use the symbolic solver, but it only finds the trivial solution 0/0/0. And demanding it to give all solutions (modifier "fully") gives a rather useless result.

Werner_E_1-1612157490907.png

 

So in case of your task, a brute force attack seems to be the best approach.

Werner_E_2-1612157552705.png

 

In case you also want solutions with negative integers, you should filter the solutions containing a zero as otherwise you would see too many solutions of the form -5/0/5.

Announcements

Top Tags