# Untitled

## 113 days ago by asddd12333

#삼각함수 #일반각과 호도법을 안다 - (1) 10번 global answer import random def problem_num(): var('x') a = randint(-3, 3) while a == 0: a = randint(-3 ,3) if a == 1: b = ">" #sin 부호 c = ">" #cos 부호 d = ">" #tan 부호 f = ">" #sinx cosx 부호 g = ">" #sinx tanx 부호 answer = 1 elif a == 2 or a == 3: b = ">" c = "<" d = "<" f = "<" g = "<" answer = 2 elif a == -2 or a == -3: b = "<" c = "<" d = ">" f = ">" g = "<" answer = 3 else: b = "<" c = ">" d = "<" f = "<" g = ">" answer = 4 return answer, a, b, c, d, f, g def problem(): prob = problem_num() answer = prob[0] a = prob[1] b = prob[2] c = prob[3] d = prob[4] f = prob[5] g = prob[6] return answer, a, b, c, d, f, g def problem_answer_list(): prob = problem() answer = prob[0] a = prob[1] b = prob[2] c = prob[3] d = prob[4] f = prob[5] g = prob[6] answer_calc_list = [] random_answer_calc = random.randint(1, 4) while random_answer_calc == answer: random_answer_calc = random.randint(1, 4) for i in range(3): while random_answer_calc in answer_calc_list: random_answer_calc = random.randint(1, 4) while random_answer_calc == answer: random_answer_calc = random.randint(1, 4) answer_calc_list.append(random_answer_calc) select_answer = [answer_calc_list[0], answer_calc_list[1], answer_calc_list[2], answer] return [select_answer, answer, [a, b, c, d, f, g]] def final_answer_list(): select_answer = problem_answer_list() select_answer_list = select_answer[0] answer = select_answer[1] problem_number_list = select_answer[2] return [select_answer_list, answer, problem_number_list] final = final_answer_list() select_answer_list = final[0] answer = final[1] problem_number_list = final[2] a = problem_number_list[0] b = problem_number_list[1] c = problem_number_list[2] d = problem_number_list[3] f = problem_number_list[4] g = problem_number_list[5] select_answer_list.sort() show(html("<p> $sinxcosx \\ %s \\ 0, \\ sinxtanx \\ %s \\ 0$ 을 동시에 만족시키는 각 $x$ 는 제 몇 사분면의 각인가?.</p>"%(latex(f), latex(g)))) sp = LatexExpr('\\quad') spp = LatexExpr('\\ ') for i in range(len(select_answer_list)): show("%s."%(i+1), sp, "제", spp, latex(expand(select_answer_list[i])), spp, "사분면") @interact def _(answers = selector([(None, ""), (select_answer_list[0], "1"), (select_answer_list[1], "2"), (select_answer_list[2], "3"), (select_answer_list[3], "4")], buttons=True), auto_update=False): if answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: if answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> $x$ 가 제 $%s$ 분면의 각일 때 $sinx \\ %s \\ 0, \\ cosx \\ %s \\ 0, \\ tanx \\ %s \\ 0$ 이다. <br> 따라서 $sinxcosx \\ %s \\ 0, \\ sinxtanx \\ %s \\ 0$ 이다."%(latex(answer), latex(b), latex(c), latex(d), latex(f), latex(g)))) fl = open("record.txt",'w') fl.write('success') fl.close() else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> $x$ 가 제 $%s$ 분면의 각일 때 $sinx \\ %s \\ 0, \\ cosx \\ %s \\ 0, \\ tanx \\ %s \\ 0$ 이다. <br> 따라서 $sinxcosx \\ %s \\ 0, \\ sinxtanx \\ %s \\ 0$ 이다."%(latex(answer), latex(b), latex(c), latex(d), latex(f), latex(g)))) fl = open("record.txt",'w') fl.write('fail') fl.close()

## Click to the left again to hide and once more to show the dynamic interactive window

#삼각함수 #일반각과 호도법을 안다 - (2) 12번 global answer import random def problem_num(): var('x, a') a = randint(-5, 5) while a == 0: a = randint(-5 ,5) answer = ((1/a)^2 - 1)/2 return answer, a, x def problem(): prob = problem_num() answer = prob[0] a = prob[1] x = prob[2] return answer, a, x def problem_answer_list(): prob = problem() answer = prob[0] a = prob[1] x = prob[2] answer_calc_list = [] random_answer_calc = QQ(random.randint(-5, 7)/(a^2)) while random_answer_calc == 0: random_answer_calc = QQ(random.randint(-5, 7)/(a^2)) for i in range(4): while random_answer_calc in answer_calc_list: random_answer_calc = QQ(random.randint(-5, 7)/(a^2)) while random_answer_calc == 0: random_answer_calc = QQ(random.randint(-5, 7)/(a^2)) answer_calc_list.append(random_answer_calc) select_answer = [answer+answer_calc_list[0], answer+answer_calc_list[1], answer+answer_calc_list[2], answer+answer_calc_list[3], answer] return [select_answer, answer, [x, a]] def final_answer_list(): select_answer = problem_answer_list() select_answer_list = select_answer[0] answer = select_answer[1] problem_number_list = select_answer[2] return [select_answer_list, answer, problem_number_list] final = final_answer_list() select_answer_list = final[0] answer = final[1] problem_number_list = final[2] x = problem_number_list[0] a = problem_number_list[1] random.shuffle(select_answer_list) show(html("<p> $sin\\theta + cos\\theta = %s$ 일 때, $sin\\theta cos\\theta$ 의 값을 구하여라.</p>"%(latex(1/a)))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') ye = LatexExpr('sin\\theta cos\\theta =') for i in range(len(select_answer_list)): show("%s."%(i+1), sp, ye, latex(expand(select_answer_list[i]))) #답안 확인 @interact def _(answers = selector([(None, ""), (select_answer_list[0], "1"), (select_answer_list[1], "2"), (select_answer_list[2], "3"), (select_answer_list[3], "4"), (select_answer_list[4], "5")], buttons=True), auto_update=False): if answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: if answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> 양변을 제곱하면 $sin^2 \\theta + cos^2 \\theta + 2sin\\theta cos\\theta = %s^{2} = %s$ 이다. <br> $sin^2 \\theta + cos^2 \\theta = 1$ 이므로 결국 $2sin \\theta cos \\theta = %s$ 이다. <br> 따라서 정답은 $%s$ 이다. "%(latex(1/a), latex(1/(a^2)), latex(1/(a^2)-1), latex(answer)))) fl = open("record.txt",'w') fl.write('success') fl.close() else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> 양변을 제곱하면 $sin^2 \\theta + cos^2 \\theta + 2sin\\theta cos\\theta = %s^{2} = %s$ 이다. <br> $sin^2 \\theta + cos^2 \\theta = 1$ 이므로 결국 $2sin \\theta cos \\theta = %s$ 이다. <br> 따라서 정답은 $%s$ 이다. "%(latex(1/a), latex(1/(a^2)), latex(1/(a^2)-1), latex(answer)))) fl = open("record.txt",'w') fl.write('fail') fl.close()

## Click to the left again to hide and once more to show the dynamic interactive window

#삼각함수 #삼각함수의 뜻을 알고, 사인함수, 코사인함수, 탄젠트함수의 그래프를 그릴 수 있다 - 15번 global answer import random def problem_num(): var('x, a, b, c') a = randint(1, 3) b = randint(1, 2) c = randint(-3, 3) d = pi*randint(3, 6) e = randint(6, 12) f = a*cos(b*x) + c answer = f(x = d/e) return answer, a, b, c, d, e, f, x def problem(): prob = problem_num() answer = prob[0] a = prob[1] b = prob[2] c = prob[3] d = prob[4] e = prob[5] f = prob[6] x = prob[7] return answer, a, b, c, d, e, f, x def problem_answer_list(): prob = problem() answer = prob[0] a = prob[1] b = prob[2] c = prob[3] d = prob[4] e = prob[5] f = prob[6] x = prob[7] answer_calc_list = [] random_answer_calc = f(x = (d+pi*random.randint(-3, 3))/e) while random_answer_calc == answer: random_answer_calc = f(x = (d+pi*random.randint(-3, 3))/e) for i in range(4): while random_answer_calc in answer_calc_list: random_answer_calc = f(x = (d+pi*random.randint(-3, 3))/e) while random_answer_calc == answer: random_answer_calc = f(x = (d+pi*random.randint(-3, 3))/e) answer_calc_list.append(random_answer_calc) select_answer = [answer_calc_list[0], answer_calc_list[1], answer_calc_list[2], answer_calc_list[3], answer] return [select_answer, answer, [x, a, b, c, d, e, f]] def final_answer_list(): select_answer = problem_answer_list() select_answer_list = select_answer[0] answer = select_answer[1] problem_number_list = select_answer[2] return [select_answer_list, answer, problem_number_list] final = final_answer_list() select_answer_list = final[0] answer = final[1] problem_number_list = final[2] x = problem_number_list[0] a = problem_number_list[1] b = problem_number_list[2] c = problem_number_list[3] d = problem_number_list[4] e = problem_number_list[5] f = problem_number_list[6] fp = plot(f, -pi, 2*pi, color = "black") random.shuffle(select_answer_list) show(html("<p>세 상수 $a, b, c$ 에 대하여 $f(x) = a cosbx + c$ 의 그래프가 다음과 같을 때, $f(%s)$ 의 값을 구하여라.</p>"%(latex(d/e)))) fp.show(ticks=pi, tick_formatter=[pi, 1]) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') ye = LatexExpr('f(%s) ='%(latex(d/e))) for i in range(len(select_answer_list)): show("%s."%(i+1), sp, ye, latex(expand(select_answer_list[i]))) @interact def _(answers = selector([(None, ""), (select_answer_list[0], "1"), (select_answer_list[1], "2"), (select_answer_list[2], "3"), (select_answer_list[3], "4"), (select_answer_list[4], "5")], buttons=True), auto_update=False): if answers == None: show(html("<p><span style='color:blue'>Please input your answaer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: if answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br>함수의 최댓값과 최솟값의 차( $2\\times$ 진폭)가 $%s$ 이므로 $a = \\frac {%s} {2} = %s$ 이고, <br> 최댓값에서 다른 최댓값까지의 거리(파장)가 $%s = \\frac {2 \\pi} {%s}$ 이므로 $b = %s$이다. <br> 또한, 함수의 최대값과 최소값의 평균(축)이 $%s$ 이므로 $c = %s$ 이다. <br> 따라서 함수의 방정식은 $%s$ 이고, $f(%s) = %s$ 이다."%(latex(2*a), latex(a), latex(a), latex(2*pi/b), latex(b), latex(b), latex(c), latex(c), latex(f), latex(d/e), latex(answer)))) fl = open("record.txt",'w') fl.write('success') fl.close() else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br>함수의 최댓값과 최솟값의 차( $2\\times$ 진폭)가 $%s$ 이므로 $a = \\frac {%s} {2} = %s$ 이고, <br> 최댓값에서 다른 최댓값까지의 거리(파장)가 $%s = \\frac {2 \\pi} {%s}$ 이므로 $b = %s$이다. <br> 또한, 함수의 최대값과 최소값의 평균(축)이 $%s$ 이므로 $c = %s$ 이다. <br> 따라서 함수의 방정식은 $%s$ 이고, $f(%s) = %s$ 이다."%(latex(2*a), latex(a), latex(a), latex(2*pi/b), latex(b), latex(b), latex(c), latex(c), latex(f), latex(d/e), latex(answer)))) fl = open("record.txt",'w') fl.write('fail') fl.close()

## Click to the left again to hide and once more to show the dynamic interactive window

#등차수열과 등비수열 #등차수열의 뜻을 알고, 일반항이나 첫째항부터 제 n항까지의 합을 구할 수 있다 - 19번 global answer import random def problem_num(): var('a, b, r') a = randint(-5, 5) b = randint(-2, 2) while b == 0: b = randint(-2, 2) r = randint(7, 11) answer = a for i in range(1, r): answer += b^i return answer, a, b, r def problem(): prob = problem_num() answer = prob[0] a = prob[1] b = prob[2] r = prob[3] return answer, a, b, r def problem_answer_list(): prob = problem() answer = prob[0] a = prob[1] b = prob[2] r = prob[3] answer_calc_list = [] random_answer_calc = random.randint(-10, 10) while random_answer_calc == 0: random_answer_calc = random.randint(-10, 10) for i in range(4): while random_answer_calc in answer_calc_list: random_answer_calc = random.randint(-10, 10) while random_answer_calc == 0: random_answer_calc = random.randint(-10, 10) answer_calc_list.append(random_answer_calc) select_answer = [answer+answer_calc_list[0], answer+answer_calc_list[1], answer+answer_calc_list[2], answer+answer_calc_list[3], answer] return [select_answer, answer, [a, b, r]] def final_answer_list(): select_answer = problem_answer_list() select_answer_list = select_answer[0] answer = select_answer[1] problem_number_list = select_answer[2] return [select_answer_list, answer, problem_number_list] final = final_answer_list() select_answer_list = final[0] answer = final[1] problem_number_list = final[2] a = problem_number_list[0] b = problem_number_list[1] r = problem_number_list[2] random.shuffle(select_answer_list) show(html("<p>$a_{1} = %s, \\ a_{n+1} = a_{n} + (%s)^{n} \\quad (n = 1, 2, 3, \\ \\cdots)$ 라고 할 때, $a_{%s}$ 의 값을 구하여라.</p>"%(latex(a), latex(b), latex(r)))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') ye = LatexExpr('a_{%s}='%(latex(r))) for i in range(len(select_answer_list)): show("%s."%(i+1), sp, ye, latex(expand(select_answer_list[i]))) @interact def _(answers = selector([(None, ""), (select_answer_list[0], "1"), (select_answer_list[1], "2"), (select_answer_list[2], "3"), (select_answer_list[3], "4"), (select_answer_list[4], "5")], buttons=True), auto_update=False): if answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: if answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br>주어진 점화식에 따라 $a_{2} = a_{1} + (%s)^{1} = %s + %s = %s, a_{3} = a_{2} + (%s)^{2} = %s + %s = %s,$ <br> $a_{4} = a_{3} + (%s)^{3} = %s + %s = %s, \\cdots$ 를 반복하면 정답 $a_{%s} = %s$ 가 나온다 ."%(latex(b), latex(a), latex(b), latex(a+b), latex(b), latex(a+b), latex(b^2), latex(a+b+b^2), latex(b), latex(a+b+b^2), latex(b^3), latex(a+b+b^2+b^3), latex(r), latex(answer)))) fl = open("record.txt",'w') fl.write('success') fl.close() else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br>주어진 점화식에 따라 $a_{2} = a_{1} + (%s)^{1} = %s + %s = %s, a_{3} = a_{2} + (%s)^{2} = %s + %s = %s,$ <br> $a_{4} = a_{3} + (%s)^{3} = %s + %s = %s, \\cdots$ 를 반복하면 정답 $a_{%s} = %s$ 가 나온다 ."%(latex(b), latex(a), latex(b), latex(a+b), latex(b), latex(a+b), latex(b^2), latex(a+b+b^2), latex(b), latex(a+b+b^2), latex(b^3), latex(a+b+b^2+b^3), latex(r), latex(answer)))) fl = open("record.txt",'w') fl.write('fail') fl.close()

## Click to the left again to hide and once more to show the dynamic interactive window

#등차수열과 등비수열 #등차수열의 뜻을 알고, 일반항이나 첫째항부터 제 n항까지의 합을 구할 수 있다 - 21번 global answer import random def problem_num(): var('a, d') a = randint(-5, 5) while a == 0: a = randint(-5, 5) d = randint(1, 5) answer = (a-d)*a + a*(a+d) + (a-d)*(a+d) return answer, a, d def problem(): prob = problem_num() answer = prob[0] a = prob[1] d = prob[2] return answer, a, d def problem_answer_list(): prob = problem() answer = prob[0] a = prob[1] d = prob[2] answer_calc_list = [] random_answer_calc = random.randint(-5, 5) while random_answer_calc == 0: random_answer_calc = random.randint(-5, 5) for i in range(4): while random_answer_calc in answer_calc_list: random_answer_calc = random.randint(-5, 5) while random_answer_calc == 0: random_answer_calc = random.randint(-5, 5) answer_calc_list.append(random_answer_calc) select_answer = [answer+answer_calc_list[0], answer+answer_calc_list[1], answer+answer_calc_list[2], answer+answer_calc_list[3], answer] return [select_answer, answer, [a, d]] def final_answer_list(): select_answer = problem_answer_list() select_answer_list = select_answer[0] answer = select_answer[1] problem_number_list = select_answer[2] return [select_answer_list, answer, problem_number_list] final = final_answer_list() select_answer_list = final[0] answer = final[1] problem_number_list = final[2] a = problem_number_list[0] d = problem_number_list[1] random.shuffle(select_answer_list) show(html("<p> 삼차방정식 $x^{3} + %s x^{2} + k x + %s = 0$ 의 세 근이 등차수열을 이룰 때, 상수 $k$ 의 값을 구하여라.</p>"%(latex(3*a), latex((a-d)*a*(a+d))))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') ye = LatexExpr('k=') for i in range(len(select_answer_list)): show("%s."%(i+1), sp, ye, latex(expand(select_answer_list[i]))) @interact def _(answers = selector([(None, ""), (select_answer_list[0], "1"), (select_answer_list[1], "2"), (select_answer_list[2], "3"), (select_answer_list[3], "4"), (select_answer_list[4], "5")], buttons=True), auto_update=False): if answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: if answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> 등차수열을 이루는 세 근을 $a-d,\\ a,\\ a+d$라고 하면 $(d\\ >\\ 0)$ <br> 근과 계수와의 관계에 의해 $x^{2}$ 의 계수 $%s = (a-d)+a+(a+d) = 3a$ 이므로 $a=%s$ 이다. <br> 또한, 상수항 $%s = (a-d)a(a+d) = a^3-ad^2 = %s-%s d^2$ 이므로 양수 $d = %s$ 이다. <br> 따라서 $k = (a-d)a + a(a+d) + (a-d)(a+d) = %s + %s + %s = %s$ 이다."%(latex(3*a), latex(a), latex((a-d)*a*(a+d)), latex(a^3), latex(a), latex(d), latex((a-d)*a), latex(a*(a+d)), latex((a-d)*(a+d)), latex(answer)))) fl = open("record.txt",'w') fl.write('success') fl.close() else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> 등차수열을 이루는 세 근을 $a-d,\\ a,\\ a+d$라고 하면 $(d\\ >\\ 0)$ <br> 근과 계수와의 관계에 의해 $x^{2}$ 의 계수 $%s = (a-d)+a+(a+d) = 3a$ 이므로 $a=%s$ 이다. <br> 또한, 상수항 $%s = (a-d)a(a+d) = a^3-ad^2 = %s-%s d^2$ 이므로 양수 $d = %s$ 이다. <br> 따라서 $k = (a-d)a + a(a+d) + (a-d)(a+d) = %s + %s + %s = %s$ 이다."%(latex(3*a), latex(a), latex((a-d)*a*(a+d)), latex(a^3), latex(a), latex(d), latex((a-d)*a), latex(a*(a+d)), latex((a-d)*(a+d)), latex(answer)))) fl = open("record.txt",'w') fl.write('fail') fl.close()

## Click to the left again to hide and once more to show the dynamic interactive window

#등차수열과 등비수열 #등비수열의 뜻을 알고, 일반항이나 첫째항부터 제 n항까지의 합을 구할 수 있다 - 18번 global answer import random def problem_num(): var('a, r') a = randint(-5, 5) while a == 0: a = randint(-5, 5) r = randint(-7, 7) while r == -1 or r == 0 or r == 1: r = randint(-7, 7) answer = a return answer, a, r def problem(): prob = problem_num() answer = prob[0] a = prob[1] r = prob[2] return answer, a, r def problem_answer_list(): prob = problem() answer = prob[0] a = prob[1] r = prob[2] answer_calc_list = [] random_answer_calc = random.randint(-30, 30) while random_answer_calc == 0: random_answer_calc = random.randint(-30, 30) for i in range(4): while random_answer_calc in answer_calc_list: random_answer_calc = random.randint(-30, 30) while random_answer_calc == 0: random_answer_calc = random.randint(-30, 30) answer_calc_list.append(random_answer_calc) select_answer = [answer+answer_calc_list[0], answer+answer_calc_list[1], answer+answer_calc_list[2], answer+answer_calc_list[3], answer] return [select_answer, answer, [a, r]] def final_answer_list(): select_answer = problem_answer_list() select_answer_list = select_answer[0] answer = select_answer[1] problem_number_list = select_answer[2] return [select_answer_list, answer, problem_number_list] final = final_answer_list() select_answer_list = final[0] answer = final[1] problem_number_list = final[2] a = problem_number_list[0] r = problem_number_list[1] random.shuffle(select_answer_list) show(html("<p> 등비수열을 이루는 세 수의 합이 $%s$ 이고, 곱이 $%s$ 일 때, 세 수 중에 절대값이 가장 작은 수를 구하시오.</p>"%(latex(a+a*r+a*r^2), latex((a*r)^3)))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(len(select_answer_list)): show("%s."%(i+1), sp, latex(expand(select_answer_list[i]))) @interact def _(answers = selector([(None, ""), (select_answer_list[0], "1"), (select_answer_list[1], "2"), (select_answer_list[2], "3"), (select_answer_list[3], "4"), (select_answer_list[4], "5")], buttons=True), auto_update=False): if answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: if answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> 공비를 $r$ 이라고 하면 세 수는 $a, ar, ar^2$ 이다. <br> 세 수의 합 $a+ar+ar^2 = a(1+r+r^2) = %s$와 세 수의 곱 $a*ar*ar^2 = (ar)^3 = (%s)^3$ 을 연립하면, <br> 세 수 $%s, \\ %s, \\ %s$ 를 구할 수 있다. 따라서 절대값이 가장 작은 수는 $%s$ 이다."%(latex(a+a*r+a*r^2), latex(a*r), latex(a), latex(a*r), latex(a*r^2), latex(answer)))) fl = open("record.txt",'w') fl.write('success') fl.close() else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> 공비를 $r$ 이라고 하면 세 수는 $a, ar, ar^2$ 이다. <br> 세 수의 합 $a+ar+ar^2 = a(1+r+r^2) = %s$와 세 수의 곱 $a*ar*ar^2 = (ar)^3 = (%s)^3$ 을 연립하면, <br> 세 수 $%s, \\ %s, \\ %s$ 를 구할 수 있다. 따라서 절대값이 가장 작은 수는 $%s$ 이다."%(latex(a+a*r+a*r^2), latex(a*r), latex(a), latex(a*r), latex(a*r^2), latex(answer)))) fl = open("record.txt",'w') fl.write('fail') fl.close()

## Click to the left again to hide and once more to show the dynamic interactive window

#등차수열과 등비수열 #등비수열의 뜻을 알고, 일반항이나 첫째항부터 제 n항까지의 합을 구할 수 있다 - 20번 global answer import random def problem_num(): var('a, r, m, n') a = randint(-5, 5) while a == 0: a = randint(-5, 5) r = randint(2, 7) m = randint(3, 5) n = randint(7, 9) answer = r return answer, a, r, m, n def problem(): prob = problem_num() answer = prob[0] a = prob[1] r = prob[2] m = prob[3] n = prob[4] return answer, a, r, m, n def problem_answer_list(): prob = problem() answer = prob[0] a = prob[1] r = prob[2] m = prob[3] n = prob[4] answer_calc_list = [] random_answer_calc = random.randint(-2, 4) while random_answer_calc == 0: random_answer_calc = random.randint(-2, 4) for i in range(4): while random_answer_calc in answer_calc_list: random_answer_calc = random.randint(-2, 4) while random_answer_calc == 0: random_answer_calc = random.randint(-2, 4) answer_calc_list.append(random_answer_calc) select_answer = [answer+answer_calc_list[0], answer+answer_calc_list[1], answer+answer_calc_list[2], answer+answer_calc_list[3], answer] return [select_answer, answer, [a, r, m, n]] def final_answer_list(): select_answer = problem_answer_list() select_answer_list = select_answer[0] answer = select_answer[1] problem_number_list = select_answer[2] return [select_answer_list, answer, problem_number_list] final = final_answer_list() select_answer_list = final[0] answer = final[1] problem_number_list = final[2] a = problem_number_list[0] r = problem_number_list[1] m = problem_number_list[2] n = problem_number_list[3] random.shuffle(select_answer_list) show(html("<p> 공비가 $r$ 인 등비수열 $\\{a_n\\}$ 의 제 $%s$ 항이 $%s$ , 제 $%s$ 항이 $%s$ 일 때 공비 $r$ 을 구하여라. (단, $\\ r\\ >\\ 0$)</p>"%(latex(m), latex(a*r^(m-1)), latex(n), latex(a*r^(n-1))))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(len(select_answer_list)): show("%s."%(i+1), sp, latex(expand(select_answer_list[i]))) @interact def _(answers = selector([(None, ""), (select_answer_list[0], "1"), (select_answer_list[1], "2"), (select_answer_list[2], "3"), (select_answer_list[3], "4"), (select_answer_list[4], "5")], buttons=True), auto_update=False): if answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: if answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> 초항을 $a$ , 공비를 $r$ 이라고 하면 $%s$ 번 째 항 $ar^{%s -1} = ar^{%s} = %s$ 이고, $%s$ 번 째 항 $ar^{%s -1} = ar^{%s} = %s$ 이다. <br> 이 때 두 수를 나누면 $\\frac {ar^{%s}} {ar^{%s}} = r^{%s} = %s$ 이고, 따라서 $r = %s$ 이다."%(latex(m), latex(m), latex(m-1), latex(a*r^(m-1)), latex(n), latex(n), latex(n-1), latex(a*r^(n-1)), latex(n-1), latex(m-1), latex(n-m), latex(r^(n-m)), latex(answer)))) fl = open("record.txt",'w') fl.write('success') fl.close() else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> 초항을 $a$ , 공비를 $r$ 이라고 하면 $%s$ 번 째 항 $ar^{%s -1} = ar^{%s} = %s$ 이고, $%s$ 번 째 항 $ar^{%s -1} = ar^{%s} = %s$ 이다. <br> 이 때 두 수를 나누면 $\\frac {ar^{%s}} {ar^{%s}} = r^{%s} = %s$ 이고, 따라서 $r = %s$ 이다."%(latex(m), latex(m), latex(m-1), latex(a*r^(m-1)), latex(n), latex(n), latex(n-1), latex(a*r^(n-1)), latex(n-1), latex(m-1), latex(n-m), latex(r^(n-m)), latex(answer)))) fl = open("record.txt",'w') fl.write('fail') fl.close()

## Click to the left again to hide and once more to show the dynamic interactive window

#수열의 합 #여러가지 수열의 첫째항부터 제 n항까지의 합을 구할 수 있다. - (1) global answer import random def problem_num(): var('a, b') a = randint(-5, 5) while a == 0: a = randint(-5 ,5) b = randint(4, 8) c = b*(b+1)*(2*b+1)/6 d = b*(b+1)/2 answer = a*(c+d)/2 return answer, a, b, c, d def problem(): prob = problem_num() answer = prob[0] a = prob[1] b = prob[2] c = prob[3] d = prob[4] return answer, a, b, c, d def problem_answer_list(): prob = problem() answer = prob[0] a = prob[1] b = prob[2] c = prob[3] d = prob[4] answer_calc_list = [] random_answer_calc = random.randint(-30, 30) while random_answer_calc == 0: random_answer_calc = random.randint(-30, 30) for i in range(4): while random_answer_calc in answer_calc_list: random_answer_calc = random.randint(-30, 30) while random_answer_calc == 0: random_answer_calc = random.randint(-30, 30) answer_calc_list.append(random_answer_calc) select_answer = [answer+answer_calc_list[0], answer+answer_calc_list[1], answer+answer_calc_list[2], answer+answer_calc_list[3], answer] return [select_answer, answer, [a, b, c, d]] def final_answer_list(): select_answer = problem_answer_list() select_answer_list = select_answer[0] answer = select_answer[1] problem_number_list = select_answer[2] return [select_answer_list, answer, problem_number_list] final = final_answer_list() select_answer_list = final[0] answer = final[1] problem_number_list = final[2] a = problem_number_list[0] b = problem_number_list[1] c = problem_number_list[2] d = problem_number_list[3] random.shuffle(select_answer_list) show(html("<p> $\\qquad \\qquad \\displaystyle \\sum_{m=1}^{%s} \\sum_{l=1}^{m} \\sum_{k=1}^{l} %s \\quad$ 의 값을 구하여라.</p>"%(latex(b), latex(a)))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') ye = LatexExpr('') for i in range(len(select_answer_list)): show("%s."%(i+1), sp, ye, latex(expand(select_answer_list[i]))) @interact def _(answers = selector([(None, ""), (select_answer_list[0], "1"), (select_answer_list[1], "2"), (select_answer_list[2], "3"), (select_answer_list[3], "4"), (select_answer_list[4], "5")], buttons=True), auto_update=False): if answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: if answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> 가장 안쪽 $\\sum$ 의 일반항이 상수항이므로 그대로 $l$ 을 곱한다. <br> 그러면 $\\displaystyle \\sum_{m=1}^{%s} \\sum_{l=1}^{m} %s l = %s \\sum_{m=1}^{%s} \\sum_{l=1}^{m} l$ <br> $\\displaystyle \\qquad \\qquad \\qquad = %s \\sum_{m=1}^{%s} \\frac{m(m+1)}{2} = \\frac{%s}{2} \\sum_{m=1}^{%s} (m^2+m)$ <br> $\\displaystyle \\qquad \\qquad \\qquad = %s ( \\frac{%s ( %s +1)(2 \\times %s +1)}{6} + \\frac{%s ( %s +1)}{2}) = %s ( %s + %s) = %s$ 이다."%(latex(b), latex(a), latex(a), latex(b), latex(a), latex(b), latex(a), latex(b), latex(a/2), latex(b), latex(b), latex(b), latex(b), latex(b), latex(a/2), latex(c), latex(d), latex(answer)))) fl = open("record.txt",'w') fl.write('success') fl.close() else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> 가장 안쪽 $\\sum$ 의 일반항이 상수항이므로 그대로 $l$ 을 곱한다. <br> 그러면 $\\displaystyle \\sum_{m=1}^{%s} \\sum_{l=1}^{m} %s l = %s \\sum_{m=1}^{%s} \\sum_{l=1}^{m} l$ <br> $\\displaystyle \\qquad \\qquad \\qquad = %s \\sum_{m=1}^{%s} \\frac{m(m+1)}{2} = \\frac{%s}{2} \\sum_{m=1}^{%s} (m^2+m)$ <br> $\\displaystyle \\qquad \\qquad \\qquad = %s ( \\frac{%s ( %s +1)(2 \\times %s +1)}{6} + \\frac{%s ( %s +1)}{2}) = %s ( %s + %s) = %s$ 이다."%(latex(b), latex(a), latex(a), latex(b), latex(a), latex(b), latex(a), latex(b), latex(a/2), latex(b), latex(b), latex(b), latex(b), latex(b), latex(a/2), latex(c), latex(d), latex(answer)))) fl = open("record.txt",'w') fl.write('fail') fl.close()

## Click to the left again to hide and once more to show the dynamic interactive window

#수열의 합 #여러가지 수열의 첫째항부터 제 n항까지의 합을 구할 수 있다. - (2) global answer import random def problem_num(): var('x') a = randint(-2, 2) b = randint(-4, 4) c = randint(-6, 6) k = randint(4, 10) while a == b == c == 0: a = randint(-2 ,2) b = randint(-4, 4) c = randint(-6, 6) f(x) = a*x^2 + b*x + c answer = sum([f(x) for x in range(1,k + 1)]) return answer, a, b, c, k, f(x) def problem(): prob = problem_num() answer = prob[0] a = prob[1] b = prob[2] c = prob[3] k = prob[4] f(x) = prob[5] return answer, a, b, c, k, f(x) def problem_answer_list(): prob = problem() answer = prob[0] a = prob[1] b = prob[2] c = prob[3] k = prob[4] f(x) = prob[5] answer_calc_list = [] random_answer_calc = random.randint(-50, 50) while random_answer_calc == 0: random_answer_calc = random.randint(-50, 50) for i in range(4): while random_answer_calc in answer_calc_list: random_answer_calc = random.randint(-50, 50) while random_answer_calc == 0: random_answer_calc = random.randint(-50, 50) answer_calc_list.append(random_answer_calc) select_answer = [answer+answer_calc_list[0], answer+answer_calc_list[1], answer+answer_calc_list[2], answer+answer_calc_list[3], answer] return [select_answer, answer, [a, b, c, k, f(x)]] def final_answer_list(): select_answer = problem_answer_list() select_answer_list = select_answer[0] answer = select_answer[1] problem_number_list = select_answer[2] return [select_answer_list, answer, problem_number_list] final = final_answer_list() select_answer_list = final[0] answer = final[1] problem_number_list = final[2] a = problem_number_list[0] b = problem_number_list[1] c = problem_number_list[2] k = problem_number_list[3] f(x) = problem_number_list[4] random.shuffle(select_answer_list) show(html("<p> 식 $\\displaystyle \\sum_{x=1} ^{%s} (%s)$ 의 값을 구하여라.</p>"%(latex(k), latex(f(x))))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') ye = LatexExpr('') for i in range(len(select_answer_list)): show("%s."%(i+1), sp, ye, latex(expand(select_answer_list[i]))) @interact def _(answers = selector([(None, ""), (select_answer_list[0], "1"), (select_answer_list[1], "2"), (select_answer_list[2], "3"), (select_answer_list[3], "4"), (select_answer_list[4], "5")], buttons=True), auto_update=False): if answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: if answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> 자연수의 거듭제곱의 합 공식 $\\displaystyle \\sum_{x=1}^{n}x \\ = \\ \\frac{n(n+1)}{2}, \\ \\sum_{x=1} ^{n} x^2 \\ = \\ \\frac{n(n+1)(2n+1)}{6}$ 을 이용하면, <br> $\\displaystyle \\sum_{x=1} ^{%s} (%s) \\ = \\ %s \\times \\frac{%s (%s +1)(2 \\times %s +1)}{6} + %s \\times \\frac{%s (%s +1)}{2} + %s \\times %s = %s + %s + %s = %s$ 이다."%(latex(k), latex(f(x)), latex(a), latex(k), latex(k), latex(k), latex(b), latex(k), latex(k), latex(c), latex(k), latex(a*k*(k+1)*(2*k+1)/6), latex(b*k*(k+1)/2), latex(c*k), latex(answer)))) fl = open("record.txt",'w') fl.write('success') fl.close() else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> 자연수의 거듭제곱의 합 공식 $\\displaystyle \\sum_{x=1}^{n}x \\ = \\ \\frac{n(n+1)}{2}, \\ \\sum_{x=1} ^{n} x^2 \\ = \\ \\frac{n(n+1)(2n+1)}{6}$ 을 이용하면, <br> $\\displaystyle \\sum_{x=1} ^{%s} (%s) \\ = \\ %s \\times \\frac{%s (%s +1)(2 \\times %s +1)}{6} + %s \\times \\frac{%s (%s +1)}{2} + %s \\times %s = %s + %s + %s = %s$ 이다."%(latex(k), latex(f(x)), latex(a), latex(k), latex(k), latex(k), latex(b), latex(k), latex(k), latex(c), latex(k), latex(a*k*(k+1)*(2*k+1)/6), latex(b*k*(k+1)/2), latex(c*k), latex(answer)))) fl = open("record.txt",'w') fl.write('fail') fl.close()

## Click to the left again to hide and once more to show the dynamic interactive window