Re: Re: Request for Mathematica Programming help.

*To*: mathgroup at smc.vnet.net*Subject*: [mg36920] Re: [mg36893] Re: Request for Mathematica Programming help.*From*: "Hermann Schmitt" <schmitther at netcologne.de>*Date*: Wed, 2 Oct 2002 03:31:55 -0400 (EDT)*References*: <an14fb$idu$1@smc.vnet.net> <200209280834.EAA24968@smc.vnet.net> <an8si6$6ql$1@smc.vnet.net> <200210010845.EAA14400@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

See my comments in the following text! Hermann Schmitt ----- Original Message ----- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de> To: mathgroup at smc.vnet.net Subject: [mg36920] [mg36893] Re: Request for Mathematica Programming help. > Hi, > > > I agree with Mr. Kuska, that the system Mr Nagesh describes is not > > userfriendly. But I think, the suggestions of Mr. Kuska do not make it more > > userfriendly, rather the opposite is true. > > > > Mr. Nagesh asks > > > > "Is any body here have expertise or information about the capability of > > Mathematica as a system simulation tool?" > > Mr. Kuska answers: > > "Since the most "system simulation tools" are simply solving a system of > > ordinary differntial equations it is simple to do this with NDSolve[]." > > > > My comment: > > > > That is: He sees the simulation system merely as a set of differential > > equations. > > hmm, since the original poster write > > "My refrigeration system simulation package is likely to have > approximately 60 First order Differential equations." > > it seems not completly wrong to assume that the system consists of > of ode's .. > Yout should not ignore the word "merely". It is not enough to have a set 60 differential equations and a set of 200-250 numbers. That is not simulation system, which can be used by users with the exception, perhaps, of the programmer of the system himself. How does e.g. the user know what meaning a number in the set has, ought he count the numbers from the beginning? Your nice command shows only, if there is an input, which is not a number. But I think the user would like to know, which of the 200 elements are not numbers. The only good of your command is, that it looks nice and shows your knowledge! > > > > The question of Mr. Nagesh: > > > > "My 4th Objective:- How can I program the check for correctness of the > > input values supplied by the package user ?" > > The answer of Mr. Kuska is: > > "And @@ (NumericQ /@ {aListOfAllYourNumericParameters})" > > > > My comment: > > > > This is a nice command and shows the knowledge of Mr.Kuska. But does Mr. > > Nagesh understand it and is it sufficient to check, if all inputs are > > numerical? > > It seems you have a deeper knowlege about the things that Mr. Nagesh > understand. You know him personally ? It is not very polite to > make speculations *what* a other person understand. > > And "no" it is not sufficent to check that all parameters are numbers. > Typical paramters described by intervals, where the assumptions of > a model are valid. But for this checks one needs more knowlege > about the meaning of the parameters. And one needs the knowlege about > the differntial equations, to find out the eigenvalues of the jacobian > ... > > > > > Additionally I think, it is not userfriendly to see the input merely as a > > set of 200-250 numbers. > > > > My suggestion is, that JLink is used, a suggestion Mr. Kusk takes into > > consideration, too. > > That will be fast as lightning ! > > > > > But further I suggest, that classes are defined in Java, which represent the > > parts of the system. > > That is notable nonsense! When the differntial equations should be > solved with Mathematica, the parts can't be Java classes. Mathematica's > NDSolve[] need a explicit expression to integrate the equations. That's not nonsense, the Mathematica program does not fetch the classes but the numbers in the classes (or better in the objects). In a further email, I even propose to store the differential equations in the Java classes in textform. They can then be fetched from the Mathematica program and transformed into expressions by the Command "ToExpression". The aim is, to have a clear separation of the system into components, which are manageable and understandable. > > OK you can call a Java class member from Mathematica but this will > be incredible slow when the right hand side is evaluated 200-300 > times and every evaluation make several callbacks to the Java source. > More overer I'm not sure that the Mathematica Kernel can call the > Event handler of the Java main program (without some modification in > the event loop) while it is evaluating an other command. My idea is to fetch the values once from the Java objects at the beginning. 200-250 numbers is not so much.. > > > > > Constructors of the classes should build objects with default values. > > That's a great idea. If a simulation run should be documented, one > always > need the full listing of the Java source to find the actual parameter > settings. That is not my opinion. I think not every user of the simulation system should have to know Java and Mathematica. The user must look for the values in the objects. And the values are in the objects, if they come from the constructor or from the graphical user interface. I think, there should be listings of the objects including names of the variables. In the objects the values are in an meaningful environment. > > > Graphical user interfaces > > should give the opportunity to change the data fields in the objects and > > check the input for correctness. > > *and* what has a GUI for 200-250 variables to do with Mathematica ? > BTW one has typical much less variables because many parameters > are fixed and it make no sense to change, for example, material > constants of materials that can't exchanged > > > > > The system should give the opportunity, to store the objects on harddisk > > (serialization). > > > > accessed directly. > > > > Can you be so kind, to explain *how* your posting help a person that > ask "How can I build a simulation system with Mathematica" ? > > You *can* say "Don't use Mathematica, use Java!" but this has nothing > to do with the question or with my reply. It is you, who proposes to solve the problem with C/C++ and not to use Mathematica (see below!) My point of view is: Use Mathematica, for what Mathemtica is good, and Java, for what Java is good. Mathematica is not so good as Java for data entry and Java is better than Mathematica to represent the simulation system (by objects). > > But I still would suggest to use C/C++ and a numerical > ode-solver, make a fancy GUI/Script > interface and don't use Mathematica for such a simple task. > The ode-solver is the smallest part of such a simulation system. > > Regards > Jens > > > > Hi, > > > > > > > > > > > > > My name is Nagesh and pursuing research studies in Refrigeration. At > > > > present I am writing a Dynamic Refrigeration System Simulation Package. > > I > > > > am using Mathematica as a programming language for the same since last > > one > > > > year. I don't have any programming experience before this. I have > > following > > > > querries:- > > > > 1. Is any body here have expertise or information about the capability > > of > > > > Mathematica as a system simulation tool? > > > > > > Since the most "system simulation tools" are simply solving a system of > > > ordinary differntial equations it is simple to do this with NDSolve[]. > > > > > > > 2. Is is possible to program a user friendly interface for my system > > > > simulation package with Mathematica or I have to use some other > > software? > > > > > > Write a MathLink or J/Link frontend that launch the kernel. But you > > > should keep > > > in mind that the user interface is typical 80-90 % of your code. > > > If you just whant to solve some ode's it is probably easyer to > > > include one of the excelent ode-solvers from netlib in your C-code > > > than to call Mathematica to do that. As long as you dont wish to change > > > the ode's very often (than Mathematica is more flexible) you should > > > not use Mathematica. > > > > > > > 3. My refrigeration system simulation package is likely to have > > > > approximately 60 First order Differential equations. Is is possible to > > > > solve these in Mathematica ? > > > > > > Sure. > > > > If yes then can anybody here guide me about > > > > this further. > > > > > > Write down the equations and call NDSolve[]. > > > > > > > > > > > I am explaining below in short about the objectives I want to fulfill > > from > > > > coding out of my main input file > > > > > > > > 1. Example from Main Input File ( this will contain about 200-250 > > variables > > > > which will be entered by the user of this package) > > > > > > This sounds like a *very* userfiendly interface ;-) > > > > > > > > > > > Below is examples of two variables entered into this file, which will be > > > > used in other analysis files for further evaluation. > > > > > > > > 2. Example from other analysis file ( there will be about 20-25 other > > such > > > > component analysis files ) where the above mentioned variables from main > > > > input file will be used for further evaluations:- > > > > > > > > Below is one example from this file explaining how the variables from > > main > > > > input file will be used in other files. > > > > > > > > I hope that this short information will be useful for guiding me to > > solve > > > > the following problems that I am facing. I am facing follwing problems > > or > > > > objectives:- > > > > > > > > 1. My 1st Objective:- The user of this package must be able to change > > only > > > > the value of the variable in the main input file but he must not be able > > to > > > > change the name of the variable itself. For example he must be able to > > > > change the value of the variable " " but he must not be able to change > > the > > > > name of this variable itself. > > > > Here our problem is how to achieve or program it so that our objective > > will > > > > be fullfilled. > > > > > > Options with defaulf values ? or something like > > > > > > {aParam,bParam}={ODEParameter1,ODEParameter2} /. > > > userRules /. > > > {ODEParameter1->1,ODEParameter2->2} > > > > > > > > > > > 2. My 2nd Objective:- How I can program the main input file so that it > > will > > > > be user friendly in terms of its visuals and satisfying the constraint > > > > mentioned above in objective1. > > > > > > What is *userfiendly* in a file with 250 variables ??? > > > > > > > > > > > 3. My 3rd Objective:- How can I program the optional values for each > > > > variable in the main input file ? so that there will be always a value > > > > assigned to each variable listed in main input file whenever the user > > opens > > > > up this file. If user want to change the values of some variables then > > he > > > > can change them and run the simulation otherwise the simulation run will > > be > > > > done with optional values assigned to each variable in the input file. > > > > > > See above. > > > > > > > > > > > 4. My 4th Objective:- How can I program the check for correctness of the > > > > input values supplied by the package user ? > > > > > > And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) > > > > > > > > > > Regards > > > Jens > > > >

**References**:**Re: Request for Mathematica Programming help.***From:*Jens-Peer Kuska <kuska@informatik.uni-leipzig.de>

**RE: final results: creating adjacency matrices**

**RE: Accuracy and Precision**

**Re: Request for Mathematica Programming help.**

**Re: Request for Mathematica Programming help.**