Closed cchuang2009 closed 2 years ago
$answer[2] doesn't even have a factorial in it, so factorials aren't the issue.
The issue here is that (-1)^n is undefined for non integer n. Imathas will mark any answer right if the $answer is undefined at all test points, as is happening here. This isn't a system issue, but an error in the question coding.
To fix this, you need to restrict n to integer values. With $variables="x,n" you could do this using $domain="-10,10,0,10,integers". That will set the x domain to real values -10 to 10, and the n domain to 0 to 10 integers.
Sorry to close by accidentally. Here an example:
Here the example as follows:
whatever the answer was input, it always is treated as correct, for example: in answer[2], input e, it was treated as correct answer:
$anstypes=array("numfunc","calcinterval","numfunc","calcinterval","numfunc","calcinterval","calcinterval","numfunc","numfunc","calcinterval")
$variables="x,n"
$a=rand(2,4) $b=rand(1,4) $c=rand(1,5) $d=rand(1,4) $e=rand(2,9)
$question1=" Consider $a/($b+x), expandeded at x=0, is \sum_{n=0}^oo a_n x^n."
$answer[0]="$a*(-1)^n/$b^(n+1)" $answer[1]="(-$b,$b)"
$question2=" Consider 1/x, expandeded at x=$c, is \sum_{n=0}^oo a_n (x-$c)^n."
$answer[2]="(-1)^n/$c^(n+1)" $answer[3]="(0,2*$c)"
$question3=" Consider 1/($d+x)^2, expandeded at x=0, is \sum_{n=0}^oo a_n x^n."
$answer[4]="(-1)^n*(n+1)/$d^(n+2)" $answer[5]="(-$d,$d)"
$question4=" Infinite series, (1+x)^p where p\lt0, is called binary series,"
$answer[6]="(-1,1)" $answer[7]="n(2*n-2)!"
$answer[8]="(2 n)!" $answer[9]="(-$e,$e)"
As well known result:
1/(1-x)=\sum_{n=0}^oo x^n for |x|<1.
Consider the following questions:
$question1 coefficient,
a_n
, is $answerbox[0]; the series is convergent ifx
in interval,I
, andI=
$answerbox[1]. $question2 coefficient,a_n
, is $answerbox[2]; the series is convergent ifx
in interval,I
, andI=
$answerbox[3]. $question3 coefficient,a_n
, is $answerbox[4]; the series is convergent ifx
in interval,I
, andI=
$answerbox[5]. $question4 the binary series is convergent ifx
in interval,I
, andI=
$answerbox[6]. Forp=1/2
, and the series is expandand atx=0
is\sum_{n=0}^oo (-1)^n{a_n}/{2^(2n-1)(n!)^2} x^n
wherea_n
is $answerbox[7]. Forp=-1/2
, and the series is expandand atx=0
is\sum_{n=0}^oo (-1)^n{a_n}/{2^(2n)(n!)^2} x^n
wherea_n
is $answerbox[8]. Consider thef(x)=1/{($e+x)^(1/3)}
. Its binaray series is convergent forx\in I
, i.e.I
= $answerbox[9]. Note:Euler number,
e
, input by e, for example: e^2 =e^2
= exp(2), Open interval,\{x \in\mathbb{R} ∣ a \lt x \lt b\}
, input by (a,b), closed interval,\{x \in\mathbb{R} ∣ a \le x \le b\}
, input by [a,b],n!
, factorial of n, input by n!.oo
, positive infinty, input by oo.