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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

How to constrain the solution as an integer in Solve Block?

sfan
1-Visitor

How to constrain the solution as an integer in Solve Block?

Hi, everyone,

Is there a way to have an integer constraint in solve block?

Say, the solution is in form of sin(t) or cos(t), I want to check the maximum values after several periods.

Please see attachment.

Thank you very much.

Shawn

7 REPLIES 7
RichardJ
19-Tanzanite
(To:sfan)

Is there a way to have an integer constraint in solve block?

No. This used to be possible in MC11 using an extension pack, but it was not compatible with MC12, and was never ported.

AndyWesterman
12-Amethyst
(To:sfan)

Unfortunately I only have Prime 2, so I can't read your sheet.

There are a few symbols in the ribbon menu that may help :

Capture.PNG

gives a test for T {is a member of} (set of all integers}

adding Capture.PNG to a simple solve block will force it to fail if the answer is not an integer.

Whether it is possible for the solve block to always find alternate solutions I don't know, but the attached shows an instance where it can.

Hope this is helpful

Regards

   Andy

I admit I'm not sure how the Knitro solvers in Prime handle integer constraints, but most solvers don't like them. Most solvers head downhill on the error surface, and if the error surface is not smooth they can't handle it. Asking for integer solutions makes it very non-smooth, with many local minima that are singularities at the integer solution points.

tried a few different options , including a sin(...) & it doesn't seem to work.

Either its not exactly an integer or it doesn't manage the guess value to find the next iteration of the solution.

The first attempt worked fine - just unlucky I guess???

Regards

   Andy

Werner_E
25-Diamond I
(To:sfan)

Unfortunately my P3.0 can't read your 3.1 file, either, as PTC has decided, that even every subversion should get its own incompatible file format and no one should be able to read newer formats nor be able to save in older file formats.

Sometime (while not often) the symbolic "assume, t=integer" helps as here with Andy's example

But unlike Mathcad 15 and below you can't combine symbolic evaluation with a solve block in Prime. So this may not be an option either.

Please find in attachment this worksheet in PDF and XPS file formats.

VladimirN
24-Ruby II
(To:sfan)

Hi,

Please find some solution in attachment.

Announcements

Top Tags