RE: FindUnknowns[ ] (Mathematica wish list)

*To*: mathgroup at smc.vnet.net*Subject*: [mg71313] RE: [mg71286] FindUnknowns[ ] (Mathematica wish list)*From*: "David Park" <djmp at earthlink.net>*Date*: Tue, 14 Nov 2006 05:06:48 -0500 (EST)

I don't know how 'solvable' your system is for all cases, especially since you seem to be using FindRoot, which requires approximate guesses. But yes, assuming your system is well behaved and solvable you should be able to write a routine that will do what you want. You can't expect Mathematica to automatically have routines for doing this because there are too many particular applications. I am always claiming that Mathematica is not a 'tool for doing mathematics' but instead a metatool for constructing the tools you need in your particular field or application. Mathematica, of necessity, has many gaps and it is worthwhile filling them. For example, in the free ConicSections package at my web site I have a routine for solving for the various parameters of an ellipse, given two of them. The usage message is as follows: Needs["ConicSections`ConicSections`"] ?SolveStandardEllipse SolveStandardEllipse[unknowns, knowns, vars:{a,b,c,d,e}] will solve for a list of unknows among the variables and then substitute the known variables given by a list of rules. a = semimajor axis, b = semiminor axis, c = center-to-focus distance, d = center-to-directrix distance, e = eccentricity. Alternative variables may be specified by giving the optional last argument. As an example... SolveStandardEllipse[{b, c, d}, {a -> 3, e -> 1/2}] {{d -> a/e, b -> Sqrt[a^2 - a^2*e^2], c -> a*e}, {a -> 3, b -> (3*Sqrt[3])/2, c -> 3/2, d -> 6, e -> 1/2}} The first list gives the unknowns in terms of the knows, and the second list gives all the values. So one can do things like that, but unfortunately one has to actually write the routine. The good news is that after you build up the routines you have the makings of a good package. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: AES [mailto:siegman at stanford.edu] You have a set of E not too complicated equations which contain/connect/constrain V variables/symbols. You want to assign values to V - E of those variables/symbols and then solve for the remaining E values -- but, making *different* choices of which are the V - E "input" variables and which are the E "output" variables on different runs of your numerical routine. (This is a common situation in design calculations, where you want to vary the values of different variables of your problem at different times, and have the remaining values be calculated). So, you just put all your equations into a list; assign values to any V - E of the variables for a particular run; and call {InputList, OutputList} := FindUnknowns[eqns] which is a sort of FindRoot on steroids. That is, when called, FindUnknowns will: * Go thru eqns and identify all the symbols * Identify all of those symbols that presently have a value, and put them into InList (more for user convenience than anything else) * Put the remaining symbols into OutList * Run FindRoot[eqns, OutList] Mathematica *could* do *all* these tasks, totally automatically, not so? (At least, for not too pathological situations.)