Hi Mark,

A couple of comments:

1.  You can create a pille of Sage variables as illustrated.  Not sure
how they will behave in SageTeX.

sage: for i in range(6):
            var('a'+str(i))
a0
a1
a2
a3
a4
a5
sage: a1=6
sage: latex(a1)
6
sage: a2=5
sage: latex(a1+a2)
11

2.  Harald's suggestion to set the random seed is a great idea, so
your exercise sheets are reproducible.  LaTeX has an "ifthen"
package.  Wrap your solutions in an \ifthenelse command so on your
first pass the solutions do not print.  Then change the value of a
boolean (in LaTeX) so on the second pass the solutions to the same
"random" problems are included.  I do this when I write an exam -
first pass is the questions, second pass is the questions with the
answers.  But I don't use any randomness.  ;-)

Rob


On Aug 4, 7:58 am, "M.Olson" <[email protected]> wrote:
> Thanks everyone for your comments of goodness.
>
> I have been using Dan Drake's SageTeX for a couple weeks now ... and
> it is nothing short of incredulous!  I will be sure to share all my
> working examples once I get them going.
>
> I have made some progress this weekend after playing around a bit.  I
> am very confident that I can generate the randomly generated
> worksheets, but I am having a problem creating the solution sheets.  I
> am sure my method of generating the sheets is not elegant nor
> optimized.
>
> I have a very SIMPLE example of generating random dyadic
> operations ... let's use addition.  I am using tables, so that the
> layout looks consistent.
>
> %Define the greatest term, t, to be used.  In this example it will be
> 44
>
> \begin{sagesilent}
> t=44
> \end{sagesilent}
>
> \begin{tabular}{|c|c|c|c|c|}
> \hline $\sage{ZZ.random_element(t)}$ & + & $\sage{ZZ.random_element(t)}
> $ &$ =\\\hline
> \hline $\sage{ZZ.random_element(t)}$ & + & $\sage{ZZ.random_element(t)}
> $ &$ =\\\hline
> \hline $\sage{ZZ.random_element(t)}$ & + & $\sage{ZZ.random_element(t)}
> $ &$ =\\\hline
> \hline $\sage{ZZ.random_element(t)}$ & + & $\sage{ZZ.random_element(t)}
> $ &$ =\\\hline
> \hline $\sage{ZZ.random_element(t)}$ & + & $\sage{ZZ.random_element(t)}
> $ &$ =\\\hline
> \hline $\sage{ZZ.random_element(t)}$ & + & $\sage{ZZ.random_element(t)}
> $ &$ =\\\hline
> .
> .
> .
>  \end{tabular}
>
> This works brilliantly!  Awesome ... I can now create awesome sheets
> of goodness using this method.  The problem is if I want to provide
> answers and in more complicated problems ... solutions.  They only way
> that I have come up with is defining the operands in the sagesilent.
> The reason is that I can manipulate my defined operands, in this case
> sum them. More specifically, the problem is that I can only define
> alpha constants, which are random numbers, a-z.  If I define a
> constant as "aa" or "a0", it does not compile?  It would be a little
> work to assign all the constants, but I am sure it would be worth it.
> I can't figure out why this won't work.  Is the following syntax
> incorrect?
>
> \begin{sagesilent}
> t=43
> a=ZZ.random_element(t)  --- >this works
> a0=ZZ.random_element(t) ---> this does not work
> \end{sagesilent}
>
> Any ideas on how to assign random numbers to constants?
> Any ideas on how to simplify this procedure?
>
> Here is an example that I could use to generate the worksheet and the
> answer sheet by using defined constants:
>
> \begin{sagesilent}
> t=44
> a=ZZ.random_element(t)
> b=ZZ.random_element(t)
> c=ZZ.random_element(t)
> d=ZZ.random_element(t)
> .
> .
> .
> I run out of constants :(
> \end{sagesilent}
>
> \begin{tabular}{|c|c|c|c|c|}
> \hline $\sage{a}$ & + & $\sage{b}$ &$ =$ & $\sage{a+b}$\\\hline
> \hline $\sage{c}$ & + & $\sage{d}$ &$ =$ & $\sage{c+d}$\\\hline
> .
> .
> .
>
> \end{tabular}
>
> Thank you everyone for your comments ... much appreciated :D
>
> Mark
>
> On Aug 1, 11:47 am, "M.Olson" <[email protected]> wrote:
>
> > I am a Sage Newbie and looking to create randomly generated exercise
> > worksheets (not a sage worksheet) using both LaTeX and Sage.  I create
> > random arithmetic sheets using OpenOffice Calc, but they are not very
> > aesthetic. However, with the power to be able to incorporate the power
> > of Sage into LaTeX - I was hoping to be able create random worksheets
> > for my students that look good too.
>
> > Well, it is not just about looks.  It would be great to generate
> > random
>
> > - polynomial expressions that need to simplified OR equations that
> > need to be solved.  I am sure the possibilities are endless.  Of
> > course, one might also be able to use Sage to create the answer sheet
> > as well.  This is most likely possible as as one can do it in
> > Mathematica ... just need a little help.  Really what I am looking to
> > be able to do is something similar to 
> > this:http://www.wolfram.com/broadcast/screencasts/generateexerc/
>
> > Any help to steer me in the right direction would be greatly
> > appreciated.
>
> > //Mark
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-edu?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to