[LON-CAPA-users] web tags not working

Stefan Bisitz st.bisitz at ostfalia.de
Fri Jun 8 04:57:03 EDT 2012


Hi Seema,

The problem works fine for me in the web and the print version. Just 
tested on a 2.10.1 production server and also on a development server 
(CVS HEAD).

There are quite a bit maxima calls in your problem which - of course - 
need some time to be processed. What is the current server load and what 
error (message?) to you get?

Stefan Bisitz


On 08.06.2012 06:44, Seema Ali wrote:
> I have a problem, listed below that is running ok as a web question, but
> crashes when I try to convert it to Tex. I thought of just having the
> table tags within web tags. When I put the web tags in the textboxes
> wouldn't show up. The question also tends to run to long when marking
> the question. I'm not sure why, unless it might be that the server is
> busy with other processes.
>
> Should I scrap the problem or could I salvage it?
>
>
>
>
>
>
>
>
>
>
>
> <problem>
>
> <script type="loncapa/perl">$base = &random(2,6,1);
> $exponent = &random(2,3,1);
>
> $firstterm = &random(-1,1,2)* $base;
> $numterms = &random(5,9,1);
> $termstyle = &random(0,1,1); #determine if the term is base^n(-1)^m, or
> mn(-1)^p
>
> $termstyle = 0; #learning outcomes restricts for geometric series only =[
>
> $term = $firstterm;
> $sumdisplay = $term;
> $total = $firstterm;
> #$total = 0;
> #$total is reset in the answer algorithm
> below###############################
>
> $removetotal = "$total,";
>
>
> #calculate the answer
> $answer = &choose($termstyle+1,
> "sum((-$base)^n,n,1,$numterms)","sum($base*n*(-1)^n,n,1,$numterms)");
>
>
> if($firstterm>0)
> {
> $answer = "-1*".$answer;
> }
>
>
>
> for($i=1; $i<$numterms-1; $i++)
> {
> if($term>0)
> {
> $sumdisplay .= ' - ';
> }
> else
> {
> $sumdisplay .= ' + ';
> }
> if($termstyle==0)
> {
> $term*= -1 * $base; #term = base^n
> }
> else
> {
> #$term = (-1)**($i) * $base *($i+1 ); #term = mn(-1)^n
> if($firstterm>0)
> {
> $term =(-1)**($i) * $base *($i+1 ); #term = mn(-1)^n
>
> }
> else
> {
> $term =(-1)**($i+1) * $base *($i+1 ); #term = mn(-1)^n
> }
>
>
> }
> $total += $term;
> $sumdisplay .= abs($term);
> $removetotal .= "$total, ";
> }
>
> if($term>0)
> {
> $sumdisplay .= ' - ';
> }
> else
> {
> $sumdisplay .= ' + ';
> }
>
> if($termstyle==0)
> {
> #$term = (-1*$base)**($numterms); #term = base^n
> $term *= -1*$base;
> }
> else
> {
> $term = (-1)**($numterms) * $base*($numterms); #term = mn(-1)^n
> }
>
> $sumdisplay .= abs($term);
> $total += $term;
> $removetotal .="$total";
>
>
>
> #stuff that was in the HTML for decoding:
> #<br /><br />
> #base=$base <br />
> #numterm=$numterms <br />
> #total = $total<br />
> #totalsteps = $removetotal<br />
> #style = $termstyle<br />
> #answer = $answer<br /></script>
>
> <startouttext />
> <instructions></instructions><endouttext /><startouttext />Write the
> following sum using sigma notation.
>
>
> <m eval="on">\[ \Large $sumdisplay \]</m>
> <endouttext />
>
> <customresponse answerdisplay="$sample" id="11">
> <startouttext />
> <table><tr><td align="center"><endouttext />
> <textline readonly="no" size="3" />
> <startouttext /></td><td></td></tr>
>
> <tr><td align="center"><font size="+6">Σ</font></td><td><endouttext />
> <textline readonly="no" />
> <startouttext /></td></tr><tr><td><endouttext />
> <textline readonly="no" size="1" />
> <startouttext />=<endouttext />
> <textline readonly="no" size="3" />
> <startouttext /></td><td></td></tr></table><endouttext />
> <answer type="loncapa/perl">$upper=$$submission[0];
> $term=$$submission[1];
> $vari=$$submission[2];
> $lower=$$submission[3];
>
> $position = $lower + &random(100,200,1);
>
>
> #correct number of terms
> if($upper - $lower != $numterms-1) { return 'INCORRECT'; }
>
> #alternating series
> $termNsign =
> &cas('maxima',"ev($term,$vari=$position)/abs(ev($term,$vari=$position))");
> $termN1sign=
> &cas('maxima',"ev($term,$vari=$position+1)/abs(ev($term,$vari=$position+1))");
> if($termNsign=~/^Error/ || $termN1sign=~/^Error/) { return 'BAD_FORMULA'; }
> elsif($termNsign==$termN1sign) { return 'INCORRECT'; }
>
> #not a constant term formula
> $termN = &cas('maxima', "abs(ev($term,$vari=$position))");
> $termN1 = &cas('maxima', "abs(ev($term,$vari=$position+1))");
> if($termN == $termN1) { return 'INCORRECT'; }
>
>
> #term has correct properties, eg geometric, arithmetic, etc
> if($termstyle==0) #geometric
> {
> $case1 = &cas('maxma', "ev($term,$vari=$lower+1) / ev($term,$vari=$lower)");
> $case2 = &cas('maxma', "ev($term,$vari=$position+1)/
> ev($term,$vari=$position)");
> }
> #elsif($termstyle==1) #arithmetic-ish
> else
> {
> $case1 = &cas('maxima', "abs(ev($term,$vari=$lower+1)) - abs(ev($term,
> $vari=$lower))");
> $case2 = &cas('maxima', "abs(ev($term,$vari=$position+1)) -
> abs(ev($term, $vari=$position))");
>
> }
> if($case1 != $case2) { return 'INCORRECT'; }
>
>
> $total = &cas('maxima',"$answer");
>
> $sum=&cas('maxima',"sum($term,$vari,$lower,$upper)");
> if ($sum=~/^Error/) { return 'BAD_FORMULA'; }
> if ($sum==$total) { return 'EXACT_ANS'; }
> return 'INCORRECT';</answer>
>
> </customresponse><startouttext /><endouttext />
> </problem>
>
>
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users


More information about the LON-CAPA-users mailing list