<?xml-stylesheet type="text/xsl" href="/styles/mathml.xsl"?>

<?scheme

(load "../standard-6002x-procs")

(define v)
(define i)
(define r1)
(define r2)

(let ((state (make-random-state)))
  (let ((random-integer-range
	 (lambda (start end)
	   (+ start (random (- end start) state)))))
    (set! v (random-integer-range 1 6))
    (set! i (random-integer-range 1 6))
    (set! r1 (random-integer-range 1 6))
    (set! r2 (random-integer-range 1 6))))

(define i1 (/ (- v (* i r2)) (+ r1 r2)))
(define i2 (- i1))
(define i3 (+ i1 i))
(define i4 (- i))
(define v1 (- v))
(define v2 (* i2 r1))
(define v3 (* i3 r2))
(define v4 v3)

?>

<questions>
<?scheme (emit-page-prologue "Practice with KVL and KCL") ?>

<question>


<subquestion>
Here is the circuit shown in figure 1 of problem set 1:
<p />
<img src="figures/circuit1picture.gif" />

<p>
Follow the steps given in the problem set to solve for the branch
voltages and currents, using the following values for the components:
</p>

<blockquote>
<?scheme (emit-mathml `(= "V" ,v)) ?> Volts,
<?scheme (emit-mathml `(= "I" ,i)) ?> Amperes,
<?scheme (emit-mathml `(= (subscript "R" 1) ,r1)) ?> Ohms,
<?scheme (emit-mathml `(= (subscript "R" 2) ,r2)) ?> Ohms.
</blockquote>

<p>
Fill in your answers below.  Answers should be correct to two decimal places.
</p>

<?scheme (expected-number i1 "i1" (scheme->mathml '(subscript i 1)) "1.e-2") ?>
<?scheme (expected-number i2 "i2" (scheme->mathml '(subscript i 2)) "1.e-2") ?>
<?scheme (expected-number i3 "i3" (scheme->mathml '(subscript i 3)) "1.e-2") ?>
<?scheme (expected-number i4 "i4" (scheme->mathml '(subscript i 4)) "1.e-2") ?>
<?scheme (expected-number v1 "v1" (scheme->mathml '(subscript v 1)) "1.e-2") ?>
<?scheme (expected-number v2 "v2" (scheme->mathml '(subscript v 2)) "1.e-2") ?>
<?scheme (expected-number v3 "v3" (scheme->mathml '(subscript v 3)) "1.e-2") ?>
<?scheme (expected-number v4 "v4" (scheme->mathml '(subscript v 4)) "1.e-2") ?>

</subquestion>
</question>

<?scheme (emit-page-footer) ?>

<em><blockquote>
The page footer needs to be below the "submit" button.  The buttons
need to be redone in any case, so they are associated with
individual questions, not with the whole page.
</blockquote></em>

</questions>



