Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Solve Block question:
Hi All,
I am trying to setup the following system of equalities with Solve Block function, below, and to see if it is possible to find one or more (Integer ONLY) results to this equality. ( Please see attachment. )
I know it needs constraints to search for ONLY Integers, but I don’t know how to set this up.
Please could someone review the following equality to see if it is possible to find one or more Integer results to this equality.
Any help or advice gratefully received.
Best regards,
Lea…
PS - I am using Mathcad version 15.
Solved! Go to Solution.
Using "floor" you can get time1 to be an integer. More than that the solve block fails.
Either my computer has issues, or your attachment is blank.
HI Fred,
I have just re-submitted the attachment.
I don't know what happened before.
Many thanks for your attention.
Lea...
Using "floor" you can get time1 to be an integer. More than that the solve block fails.
Hi Fred,
That's great, thanks. I will use Floor next time.
So on this particular example, are you saying that there is NO solutuion for BOTH values being integers?
It's important for what I am working on.
My thinking is that if there is any number , OR even infinate number, of integers available then surely there must be a solution where BOTH values are integers.
What do you think? Can they be found?
Lea...
There is no reliable way to solve for integers only in Mathcad. There used to be an extension pack with a solver that could do that, but it's no longer supported.
Many thanks for your help.
Your equation (there is really only one - multiplying throughout by 2 on top and bottom doesn't give you a different equation) can be rewritten so that timeV2 is a linear function of timeV1. Using your values for the constants this becomes:
I don't think you are going to get integer values for timeV2 from integer values of timeV1 from this!
Alan
Many thanks for your help.
As Alan pointed out you only have one linear equation to consider. What I don't understand is, that in your original worksheet the values given by your solve block change if you omit one of your two equivalent equations.
Solving for integers, as it was already said, really is not easy with Mathcad.
Sometimes you can have success with a little program and brute force, but in case of your equation it was not able to find a solution, at least not for timeV1 in the range from 0 to 1000000.
Maybe the .... if y=floor(y) does not trigger because of precision matters and so you could try changing TOL and/or writing your numbers as exact fractions, but I think it will not really help.
See attched file.
WR
Correction: Just played around with higher values and found some solutions. Attachment changed.
The solution with the smallest values is timeV1=1 826 996 and timeV2=1 196 686. But be aware that I have limited the values to only 6 decimal places. No idea if a precision of 20 decimals is really vital to your problem. I guess you would have really go high up with the values of timeV1 to get a solution with the coefficients with more decimal places and maybe you will run into other accuracy problems that way. Good luck.
Message and attachment changed by winfrod rager
Hi Winfrod,
I really appreciate your excellent help here. Thanks so much.
I will try your worksheet & see what results I get.
Best regards,
Lea...
See also
http://communities.ptc.com/message/188050#188050
BUt this problem has not one (20 112 - the maximize solution) bur two solution 20 - 112 and 17 -114
See