Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
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
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.
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 :
gives a test for T {is a member of} (set of all integers}
adding 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
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.
Hi,
Please find some solution in attachment.