Skip to main content
6 events
when toggle format what by license comment
Jul 6, 2021 at 4:00 vote accept algal
Jul 4, 2021 at 4:10 history edited Bob Hanlon CC BY-SA 4.0
Added approach using user-defined function
Jul 3, 2021 at 17:12 comment added algal Oh I quite agree your approach is simpler and better! I just remain curious how my kind of approach would work, since sometimes function-defined constraints will be unavoidable, and I wonder if the solver can work with them efficiently or if it can only work analytically with equations and then you have to brute force search over functions. Also, even if the solver could handle UDFs, I think it couldn’t handle mine because mine consumes symbolic arguments eagerly, before substitution rules are applied, unlike IntegerDigits apparently. This is the evaluation behavior I don’t understand.
Jul 3, 2021 at 15:07 comment added Bob Hanlon The solvers can work with user-defined functions. I just find the approach that I used simple and straightforward. You could also eliminate the redundancy of the permutations by adding a fourth constraint that the values are ordered, e.g., a < b < c. Note that the third constraint eliminates any equality.
Jul 3, 2021 at 14:58 comment added algal Thanks! Is this a better way because Mathematica’s solvers work only with equations and inequalities, and not user-defined functions? Or is it that it’s dangerous to use substitutions with user-defined functions at all? Functions are obviously a basic form of abstraction, so I’d like to understand how to use them in this sort of case because usually it becomes untenable to express everything in an inline snippet of code.
Jul 3, 2021 at 3:33 history answered Bob Hanlon CC BY-SA 4.0