Subject: RE: [LON-CAPA-dev] Installing Modules for LON-CAPA

From: "GARRETT, DONNELL MAZON" <[email-masked]>
Date: Mon, 26 Sep 2005 15:33:03 -0400

Hi

That was an example... maybe one that is too simple to show what I'm
trying to do.

Let's say we want to solve for x and y, and if we randomly generate A,
B, C, D, E, and F, then

xA + yB = C
xD + yE = F

how can we find x and y using an algorithm that we don't have to cut and
paste into each and every problem..  that's where I was trying to go
with that.. haha

Thanks
Donnell
-----Original Message-----
From: [email-masked]
[mailto:[email-masked]] On Behalf Of Gerd
Kortemeyer
Sent: Monday, September 26, 2005 3:26 PM
To: [email-masked]
Subject: Re: [LON-CAPA-dev] Installing Modules for LON-CAPA

Hi Donnell,

On Sep 26, 2005, at 12:29 PM, GARRETT, DONNELL MAZON wrote:
>
> Now, this is what I'm trying to do.  We want to solve simultaneous
> equations.  For example, if:
>
> x + y = 10
> x - y = 2

Frankly, I would do this the other way around - much less computing  
intensive.

Determine x and y randomly. Then make your equations.

- Gerd.

_______________________________________________
LON-CAPA-dev mailing list
[email-masked]
http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev

---

From: Gerd Kortemeyer <[email-masked]>
Date: Mon, 26 Sep 2005 16:10:47 -0400

Hi Donnell,

On Sep 26, 2005, at 3:33 PM, GARRETT, DONNELL MAZON wrote:

> paste into each and every problem.

Yep, you can use the .library mechanism (as Guy explained) to write  
routines that you can then <import> into any problem.

But, what I was trying to suggest is building your problem the other  
way around, i.e., randomly determine the solution first.

$x=&random(-4,4,3);
$y=&random(-4,7,3);

Then generate your coefficients:

$a=&random(4,8,1);
$b=&random(4,8,1);
$d=&random(5,9,1);

Now, when determining your $e, you just need to make sure that the  
second equation is not a multiple of the first:

$e=$d/$a*$b+&random(4,8,1);

Then calculate your $c and $f:

$c=$a*$x+$b*$y;
$f=$d*$x+$e*$y;

To your students, you just give $a, $b, $c, $d, $e, and $f, of  
course. Solving an equation system is computing-intensive,  
constructing one is not - and there is no reason why LON-CAPA needs  
to do the same work that the students do.

But maybe the example is really too simple.

- Gerd.