[Tutor] Evaluate my script?

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Oct 24 17:15:13 CEST 2006


On Mon, 23 Oct 2006, Adam Gomaa wrote:

> Hello, -tutor. I wrote this script in chemistry class, which gets the 
> user's input for various parts of the PV=nRT ideal gas law, then 
> calculates the missing variable, which you indicate by putting in an 
> 'x'.

Hi Adam,

I haven't looked at your program in-depth yet, but nothing I've skimmed so 
far raises any terribly crimson red alarms yet.


A side comment: what you've done is something that a "constraint-based" 
system helps with.  You've written a program to handle the missing unknown 
by writing explicitely what to do in each case.  But a constraint-based 
system tries to do this hard work without your intervention.  For example, 
see:

http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-22.html#%_sec_3.3.5

which discusses the design of a constraint system.  Translating this code 
from Scheme to Python isn't too bad.  Perhaps someone here would like to 
give it a shot?


Best of wishes!


More information about the Tutor mailing list