Skip to content

Commit

Permalink
Merge branch 'simple-z-axis' of git@github.com:bvds/andes into simple…
Browse files Browse the repository at this point in the history
…-z-axis
  • Loading branch information
bvds committed Apr 30, 2010
2 parents e2c4da7 + 7ce52a5 commit 76030ed
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 41 deletions.
5 changes: 3 additions & 2 deletions Help/parse-andes.cl
Expand Up @@ -128,11 +128,12 @@
(cond
((not (position #\= equation))
(setf rem (make-hint-seq (list
(format nil "Entry ~a is not an equation." equation)
(format nil "Entry \"~a\" is not an equation.  If you are trying to define a scalar quantity, use ~A instead."
equation *text-tool*)
"The entry needs an = sign to be an equation."))))
((> (count #\= equation) 1)
(setf rem (make-hint-seq (list
(format nil "~a is not a single equation." equation)
(format nil "\"~a\" is not a single equation." equation)
"You may enter only one equation on a line."))))
((search "sec" equation)
(setf rem (make-hint-seq (list
Expand Down
6 changes: 0 additions & 6 deletions INSTALL
Expand Up @@ -70,14 +70,8 @@ make install-solver
# a binary release and then use that to compile the sbcl source code.
cd lisp-site-install
make get-binary # download a binary release
# Compile and install the source version:
make get-source # download and compile source
make source-install # install in /usr/local (do as superuser)

# To test for thread support, start up sbcl and enter the
# command "(find :sb-thread *features*)". If it returns ":sb-thread"
# then threading is enabled. Enter "(quit)" to exit sbcl.

cd ../ # return to Andes root directory

make sbclrc # Install the sbcl initialization file.
Expand Down
33 changes: 13 additions & 20 deletions KB/Ontology.cl
Expand Up @@ -118,7 +118,7 @@
(eval (force-types ?type))
(or
;; This should handle "force of the man acting on the crate"
(and (object ?body) (agent ?agent) (time ?time))
(and (preferred (object ?body)) (preferred (agent ?agent)) (time ?time))
;; case "the force that the man exerts on the crate"
(and ((or "that" "with which") ?agent (or "exerts on" "acts on") ?body)
(time ?time)))))
Expand Down Expand Up @@ -241,7 +241,7 @@

(def-qexp property (property ?body)
;; "for" is exceptionally used
:new-english ("of" (or (var (body ?body) :namespace :objects) ?body)))
:new-english ("of" (or (var ?body :namespace :objects) ?body)))


(def-qexp change (change ?property)
Expand Down Expand Up @@ -328,16 +328,6 @@
)
)

;; optime : time is optional
;; ex) "the net force exerted by the man at time T1"
(def-qexp property-object-optime
(property-object-optime ?property ?body :time ?time)
:new-english ((the)
?property ; "mass"
(and (preferred (property ?body)) (time ?time))
)
)

;; ex) "the mass of the crate"
;; "the crate's mass"
;; "the value of crate's mass"
Expand All @@ -359,20 +349,20 @@
:new-english (eval (when (expand-new-english ?body)
'((or "on" "acting on" "exerted on" "that acts on" "applied on"
"applied to" "against")
(or (var (body ?body) :namespace :objects) ?body)))))
(or (var ?body :namespace :objects) ?body)))))

(def-qexp agent (agent ?body)
;;+syjung
;; checking the content of ?body by (expand-new-english ..) is
;; important for the case that it is missing (in elec4b, see Bug #1676)
:new-english (eval (when (expand-new-english ?body)
'((or "due to" "by" "from" "caused by" "exerted by" "of")
(or (var (body ?body) :namespace :objects) ?body)))))
(or (var ?body :namespace :objects) ?body)))))

(def-qexp agent-with-preposition (agent ?preposition ?body)
:new-english (eval (when (expand-new-english ?body)
'(?preposition
(or (var (body ?body) :namespace :objects) ?body)))))
(or (var ?body :namespace :objects) ?body)))))

(def-qexp time (time ?time)
:new-english (eval (when ?time
Expand Down Expand Up @@ -401,8 +391,8 @@
:units |kg|
:restrictions positive
;; "ball's mass" problem s2e
:new-english (property-object-optime "mass" ?body :time ?time)
)
:new-english ((the) "mass"
(and (preferred (property ?body)) (time ?time))))

;; the magnitude of the change of mass of ~A per unit time due to ~A~@[ ~A~]"
;; (nlg ?body) (nlg ?agent 'agent) (nlg ?time 'pp)
Expand Down Expand Up @@ -431,8 +421,7 @@
:units |m|
:new-english ((the) (or "distance" "dist." "dist")
(or ((or "traveled" "travelled" "travels" "moves" "moved")
(and ("by" (or (var (body ?body) :namespace :objects)
?body))
(and ("by" (or (var ?body :namespace :objects) ?body))
(time ?time)))
((property-object "distance" ?body)
(and (allowed (or "traveled" "travelled" "travels"
Expand Down Expand Up @@ -471,7 +460,11 @@
:short-name "coef. of friction"
:units NIL ;; dimensionless
:new-english ((the) "coefficient of" ?static-or-kinetic "friction"
(and (preferred ("between" (or (var ?body1 :namespace :objects) ?body1) "and" (or (var ?body2 :namespace :objects) ?body2)))
(and (preferred
("between"
(or (var ?body1 :namespace :objects) ?body1)
"and"
(or (var ?body2 :namespace :objects) ?body2)))
(time ?time))))

;; "coefficient of drag for ~A moving through ~A"
Expand Down
12 changes: 8 additions & 4 deletions KB/circuit-ontology.cl
Expand Up @@ -25,11 +25,13 @@
:units |V|
:new-english ((the) "voltage across" (component ?comp) (time ?time)))

;; BobShelby (epow2): "resistance of R1"
;; "resistance of resistor R2"
(def-qexp resistance (resistance ?name)
:symbol-base |R|
:short-name "resistance"
:units |$W|
:new-english ((the) "resistance of" (component ?name)))
:new-english ((the) "resistance of" (allowed "resistor") (component ?name)))

(def-qexp current (current-thru ?component :time ?time)
:symbol-base |I|
Expand All @@ -44,7 +46,8 @@
:symbol-base |C|
:short-name "capacitance"
:units |F|
:new-english ((the) "capacitance of" (component ?name)))
:new-english ((the) "capacitance of" (allowed "capacitor")
(component ?name)))

;;; in the workbench, the time slot is added if feature changing-voltage
;;; is included.
Expand All @@ -58,7 +61,7 @@
;; Generally components are a single symbol or a list for
;; a compound component.
;; Sometimes the component can be defined with the body tool.
:new-english (or (var (body ?a) :namespace :objects)
:new-english (or (var ?a :namespace :objects)
(eval (if (consp ?a) `(conjoin (or "and" "&") . ,?a) ?a))))

;;; in the workbench, the time slot is added if feature changing-voltage
Expand All @@ -85,13 +88,14 @@
(component ?name) (time ?time)))

;; ind3a "self-inductance"
;; from resitance: "the inductance of inductor L1"
(def-qexp self-inductance (self-inductance ?inductor)
:symbol-base |L|
:short-name "self-inductance"
:units |H|
:new-english ((the) (or ((preferred "self") "inductance")
"self-inductance")
(preferred "of" (component ?inductor))))
"of" (allowed "inductor") (component ?inductor)))

(def-qexp mutual-inductance (mutual-inductance orderless . ?inductors)
:symbol-base |M|
Expand Down
1 change: 1 addition & 0 deletions KB/circuits.cl
Expand Up @@ -662,6 +662,7 @@
)
:hint(
;;(point (string "Apply Kirchhoff's Loop Rule to the circuit."))
;; See bug #1729
(point (string "You can apply Kirchoff's Loop Rule to the loop containing ~A." (?p1 conjoined-names)))
;;(point (string "Write an equation that sets the sum of the voltage across each component around the closed circuit loop to zero."))
(teach (string "Kirchoff's Loop Rule states that the sum of the voltages around any closed circuit loop must be equal to zero."))
Expand Down
5 changes: 3 additions & 2 deletions KB/dynamics.cl
Expand Up @@ -740,9 +740,10 @@
(given (dir (force ?b ?medium drag :time ?t)) ?drag-dir)
(implicit-eqn (= ?dir-var ?dir-var-value) (dir (force ?b ?medium drag :time ?t))))
:hint
((point (string "Notice that ~a is moving in a fluid medium ~a." ?b ?medium))
((point (string "Notice that ~a is moving in a fluid medium (~a)."
?b ?medium))
(teach (string "When an object is moving in a fluid medium, the fluid offers resistance to the motion of the object. This is represented by a drag force directed opposite to the direction of motion."))
(bottom-out (string "Because ~a is moving in fluid medium ~a, draw ~a at ~a."
(bottom-out (string "Because ~a is moving in ~a, draw ~a at ~a."
?b ?medium ((force ?b ?medium drag :time ?t) def-np) (?drag-dir adj) ))
))

Expand Down
3 changes: 2 additions & 1 deletion KB/kinematics.cl
Expand Up @@ -1574,8 +1574,9 @@
(kcd "draw_accel_straight_speeding_up")
(string "When a body is moving in a straight line and speeding up, its acceleration is parallel to the line of motion."))
(bottom-out (string "Because ~a is speeding up while moving in a straight line with direction ~a, you should use ~A to draw an acceleration for it ~a at direction ~a."
?b ?dir
(*vector-tool* eval)
?b ?dir (?t pp) ?dir))
(?t pp) ?dir))
))

(defoperator draw-accel-potential (?b ?t)
Expand Down
10 changes: 4 additions & 6 deletions KB/principles.cl
Expand Up @@ -1057,8 +1057,7 @@
;; so nested data structures can exceed the signal
;; recursion limit in lisp.
#+sbcl (SB-KERNEL:*MAXIMUM-ERROR-DEPTH* 20)
(Stream (open
(merge-pathnames file *Andes-Path*)
(Stream (open file
:direction :output :if-exists :supersede
:external-format #+sbcl :utf-8 #-sbcl :default)))
;; Assume stream has UTF-8 encoding (default for sbcl)
Expand Down Expand Up @@ -1101,8 +1100,7 @@
;; recursion limit in lisp.
#+sbcl (SB-KERNEL:*MAXIMUM-ERROR-DEPTH* 20)
(json:*lisp-identifier-name-to-json* #'string-downcase)
(stream (open
(merge-pathnames file *Andes-Path*)
(stream (open file
:direction :output :if-exists :supersede
:external-format #+sbcl :utf-8 #-sbcl :default)))
;; Assume stream has UTF-8 encoding (set for sbcl)
Expand Down Expand Up @@ -1248,7 +1246,7 @@
))


(defun problem-html-files (&optional (path *andes-path*))
(defun problem-html-files (&optional path)
"construct html files for all problems"
(dolist (prob (listprobs))
(when (problem-graphic prob) (format t "~A~%" (problem-graphic prob)))
Expand Down Expand Up @@ -1283,7 +1281,7 @@ F-8\">~%"
(when (streamp stream) (close stream)))))


(defun problem-xml-files (&optional (path *andes-path*))
(defun problem-xml-files (&optional path)
"construct xml files for all problems"
(dolist (prob (listprobs))
(let ((*print-pretty* NIL) ;disble line breaks
Expand Down

0 comments on commit 76030ed

Please sign in to comment.