r/Mathematica • u/Preeng • 3d ago
Telling Solve function to look in a different direction?
I have 4 equations and 8 unknowns. I provide 4 of the unknowns and solve for the other 4. Depending on which ones I provide and which ones I solve for, the computation time varies from almost instant to several seconds. This isn't an actual practical problem, I'm just wondering if it is possible to give Mathematica a hint on which direction to go in. I already add assumptions to the Solve function. By the way, that's why I don't use NSolve. It brings up all the solutions and not just within the parameters I want. Then I have to sift through it.
Thanks
EDIT: NSolve does not allow Assumptions to be added as far as I can tell, but you can just turn those into extra equations in your system for NSolve to work with. Problem is, that makes this take as long as using Solve with Assumptions.
So the solution I came up with is to use NSolve without these extra constraints, which computes almost instantly, then sift through the solutions it spits out with a For loop until I find the one (and I know there is only one) that meets all of the Assumptions I was making before.
1
u/Inst2f 3d ago
Have you tried `Reduce`? When there is a mismatch between the unknonws and number of equations it may output all possible combos.
1
u/Daniel96dsl 2d ago
Assumptions and constraints.