# 미적분(2, 4, 5, 6, 13, 19)

## 133 days ago by nim_od

#2 import random def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 global n1,n2,n3,n4 n1 = randint(-5,-1) ans = randint(-5, 5) if ans==0: ans+=1 n2=ans*n1 n3 = randint(-9,-1) n4 = randint(1,9) return ans # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 ans =problem_num() answer_list=[] answer_list.append(['수렴', ans]) answer_list.insert(0,['발산','없음']) while len(answer_list)!=5: answers=['수렴',randint(-4,4)] if answers in answer_list: continue answer_list.insert(0,answers) return answer_list select_answer_list =problem_answer_list() answer=select_answer_list[4] select_answer_list.sort() #문제 show(html("<p>수열 $a_n=\\cfrac {%s n+%s}{%s %s n}$의 수렴, 발산을 판정하고 수렴하는 경우 그 극한값을 구하시오.</p>"%(n2,n4,n3,n1))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): if select_answer_list[i][0]=='발산': show(html("<p>%s. %s</p>"%(i+1,select_answer_list[i][0]))) else: show(html("<p>%s. %s, $%s$</p>"%(i+1,select_answer_list[i][0],select_answer_list[i][1]))) #답안 확인 @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 answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> $\\lim_{n \\to \\infty} {\\cfrac {%s n+%s}{%s %s n}}=\\lim_{n \\to \\infty} {\\cfrac {\\cfrac{%s n}{n}+\\cfrac{%s}{n}}{\\cfrac{%s}{n} +\\cfrac{{%s} n}{n}}}=%s$"%(n2,n4,n3,n1,n2,n4,n3,n1,answer[1]))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '1'>")) elif answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> $\\lim_{n \\to \\infty} {\\cfrac {%s n+%s}{%s %s n}}=\\lim_{n \\to \\infty} {\\cfrac {\\cfrac{%s n}{n}+\\cfrac{%s}{n}}{\\cfrac{%s}{n} +\\cfrac{{%s} n}{n}}}=%s$"%(n2,n4,n3,n1,n2,n4,n3,n1,answer[1]))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>"))

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

#4 import random def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 global n1,n2,n3,n4 n1 = randint(6,9) n2 = randint(1, 2) n3 = randint(-9,9) n4 = randint(2,5) return n1^n2 # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 ans =problem_num() answer_list=[] answer_list.append(ans) while len(answer_list)!=5: answers=randint(n4,n1)^randint(1, 2) if answers in answer_list: continue answer_list.insert(0,answers) return answer_list select_answer_list =problem_answer_list() answer=select_answer_list[4] select_answer_list.sort() #문제 show(html("<p>극한 $\\lim_{n \\to \\infty} {\\cfrac {%s^{%s+n}+(%s)}{%s^n+%s^n}}$의 값을 구하시오.</p>"%(n1,n2,n3,n1,n4))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): show(html("<p>%s.$%s$</p>"%(i+1,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 answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> 분자, 분모를 $%s^n$으로 나누면 $\\lim_{n \\to \\infty} {\\cfrac {%s^{%s}+0}{%s+0}}=%s$"%(n1,n1,n2,n1,answer))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '1'>")) elif answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> 분자, 분모를 $%s^n$으로 나누면 $\\lim_{n \\to \\infty} {\\cfrac {%s^{%s}+0}{%s+0}}=%s$"%(n1,n1,n2,n1,answer))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>"))

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

#5 import random from fractions import Fraction def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 global x,k x = randint(2,9) ans=x^2 k=gcd(ans,4) return [ans/k,4/k] # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 ans =problem_num() answer_list=[] answer_list.append(ans) while len(answer_list)!=5: ans=randint(2,9)^2 _k=gcd(ans,4) answers=[ans/k,4/k] if answers in answer_list: continue answer_list.insert(0,answers) return answer_list select_answer_list =problem_answer_list() answer=select_answer_list[4] select_answer_list.sort() #문제 show(html("<p>$\\lim_{n \\to \\infty} {n(\\sqrt{n+%s}-\\sqrt n)^2}$의 값을 구하시오.</p>"%(x))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): if select_answer_list[i][1]==1: show(html("<p>%s.$%s$</p>"%(i+1,select_answer_list[i][0]))) else: show(html("<p>%s.$\\cfrac {%s} {%s}$</p>"%(i+1,select_answer_list[i][0],select_answer_list[i][1]))) #답안 확인 @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 answer == answers: if answer[1]==1: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> $\\lim_{n \\to \\infty} {n(\\sqrt{n+%s}-\\sqrt n)^2}=\\lim_{n \\to \\infty} {\\cfrac {n(n+%s-n)^2}{(\\sqrt{n+%s}+\\sqrt n)^2}}=\\lim_{n \\to \\infty} {\\cfrac {%s^2}{(\\sqrt {1+\\cfrac %s n}+\\sqrt 1)^2}}=%s$"%(x,x,x,x,x,answer[0]))) else: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> $\\lim_{n \\to \\infty} {n(\\sqrt{n+%s}-\\sqrt n)^2}=\\lim_{n \\to \\infty} {\\cfrac {n(n+%s-n)^2}{(\\sqrt{n+%s}+\\sqrt n)^2}}=\\lim_{n \\to \\infty} {\\cfrac {%s^2}{(\\sqrt {1+\\cfrac %s n}+\\sqrt 1)^2}}=\\cfrac {%s} {%s}$"%(x,x,x,x,x,answer[0],answer[1]))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '1'>")) elif 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[1]==1: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> $\\lim_{n \\to \\infty} {n(\\sqrt{n+%s}-\\sqrt n)^2}=\\lim_{n \\to \\infty} {\\cfrac {n(n+%s-n)^2}{(\\sqrt{n+%s}+\\sqrt n)^2}}=\\lim_{n \\to \\infty} {\\cfrac {%s^2}{(\\sqrt {1+\\cfrac %s n}+\\sqrt 1)^2}}=%s$"%(x,x,x,x,x,answer[0]))) else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> $\\lim_{n \\to \\infty} {n(\\sqrt{n+%s}-\\sqrt n)^2}=\\lim_{n \\to \\infty} {\\cfrac {n(n+%s-n)^2}{(\\sqrt{n+%s}+\\sqrt n)^2}}=\\lim_{n \\to \\infty} {\\cfrac {%s^2}{(\\sqrt {1+\\cfrac %s n}+\\sqrt 1)^2}}=\\cfrac {%s} {%s}$"%(x,x,x,x,x,answer[0],answer[1]))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>"))

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

#6 import random def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 n= randint(1,6) return n,[n,n+1]# 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 n,ans =problem_num() answer_list=[] answer_list.append(ans) while len(answer_list)!=5: _n,_ans =problem_num() answers=_ans if answers in answer_list: continue answer_list.insert(0,answers) return n,answer_list n,select_answer_list =problem_answer_list() answer=select_answer_list[4] select_answer_list.sort() #문제 show(html("<p>등비수열 $(x-%s)^n$이 수렴하도록 하는 모든 정수 $x$를 구하시오.</p>"%(n))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): show(html("<p>%s. $%s$, $%s$</p>"%(i+1,select_answer_list[i][0],select_answer_list[i][1]))) #답안 확인 @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 answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> 등비수열의 수렴 조건에 의하여 공비가 $-1< x-%s \\le 1$이어야 한다.<br>따라서 모든 정수 x는 $%s, %s$이다."%(n,answer[0],answer[1]))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '1'>")) elif answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> 등비수열의 수렴 조건에 의하여 공비가 $-1< x-%s \\le 1$이어야 한다.<br>따라서 모든 정수 x는 $%s, %s$이다."%(n,answer[0],answer[1]))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>"))

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

#13 import random def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 global n1,n2,n3,n4,f,f1,f2,f_list,ans n1= randint(2,9) n2 = randint(2,5) while gcd(n1,n2)!=1 or n1==n2: n2= randint(2,9) n3 = randint(1,9) n4 = randint(1,9) f(n)=(n1*n+n3)/(n2*n+n4) f1(n)=n1*n+n3 f2(n)=n2*n+n4 f_list=[[f1(i+1)/gcd(f1(i+1),f2(i+1)),f2(i+1)/gcd(f1(i+1),f2(i+1))] for i in range(3)] ans=limit(f(n), n = +oo) return ans # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 ans =problem_num() answer_list=[] answer_list.append(['발산']) answer_list.insert(0,['수렴',ans]) while len(answer_list)!=5: answers=['수렴',randint(1,8)] if answers in answer_list: continue answer_list.insert(0,answers) return answer_list select_answer_list =problem_answer_list() answer=select_answer_list[4] select_answer_list.sort() #문제 show(html("<p>다음 급수의 수렴, 발산을 조사하고, 수렴하면 그 합을 구하시오.<br> $\\cfrac {%s}{%s}+\\cfrac {%s}{%s}+\\cfrac {%s}{%s}+\\dots +\\cfrac {%s}{%s}+\\dots$</p>"%(f_list[0][0],f_list[0][1],f_list[1][0],f_list[1][1],f_list[2][0],f_list[2][1],latex(f1(n)),latex(f2(n)) ))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): if select_answer_list[i][0]=='발산': show(html("<p>%s. %s</p>"%(i+1,select_answer_list[i][0]))) else: show(html("<p>%s. %s, $%s$</p>"%(i+1,select_answer_list[i][0],select_answer_list[i][1]))) #답안 확인 @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 answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> 위 식을 일반화하면 $\\cfrac {%s}{%s}+\\cfrac {%s}{%s}+\\cfrac {%s}{%s}+\\dots +\\cfrac {%s}{%s}+\\dots=\\Sigma^{\\infty}_{n=1} \\cfrac {%s}{%s}$<br>$\\lim_{n \\to \\infty} \\cfrac {%s}{%s}=\\cfrac %s %s\\ne 0$이므로 해당 급수는 발산한다. "%(f_list[0][0],f_list[0][1],f_list[1][0],f_list[1][1],f_list[2][0],f_list[2][1],latex(f1(n)),latex(f2(n)),latex(f1(n)),latex(f2(n)),latex(f1(n)),latex(f2(n)),n1,n2))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '1'>")) elif answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> 위 식을 일반화하면 $\\cfrac {%s}{%s}+\\cfrac {%s}{%s}+\\cfrac {%s}{%s}+\\dots +\\cfrac {%s}{%s}+\\dots=\\Sigma^{\\infty}_{n=1} \\cfrac {%s}{%s}$<br>$\\lim_{n \\to \\infty} \\cfrac {%s}{%s}=\\cfrac %s %s\\ne 0$이므로 해당 급수는 발산한다. "%(f_list[0][0],f_list[0][1],f_list[1][0],f_list[1][1],f_list[2][0],f_list[2][1],latex(f1(n)),latex(f2(n)),latex(f1(n)),latex(f2(n)),latex(f1(n)),latex(f2(n)),n1,n2))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>"))

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

#19 import random def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 global n1,n2 n1 = randint(5,7) n2 = randint(2, 4) return 1 # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 ans =problem_num() answer_list=[n1,n2,n1*n2,ans] while len(answer_list)!=5: answers=randint(2,n1*n2) if answers in answer_list: continue answer_list.insert(0,answers) return answer_list select_answer_list =problem_answer_list() answer=select_answer_list[4] select_answer_list.sort() #문제 show(html("<p>$\\lim_{n \\to \\infty} {\\cfrac {%s^x-%s^{-x}}{%s^x+%s^{-x}}}$의 값을 구하시오.</p>"%(n1,n2,n1,n2))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): show(html("<p>%s.$%s$</p>"%(i+1,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 answer == answers: show(html("<p><span style='color:blue'>Correct(정답)</span></p><p>Answer(답안): <br> $\\lim_{n \\to \\infty} {\\cfrac {%s^x-%s^{-x}}{%s^x+%s^{-x}}}=\\lim_{n \\to \\infty} {\\cfrac {%s^x-1}{%s^x+1}}=1$"%(n1,n2,n1,n2,n1*n2,n1*n2))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '1'>")) elif answers == None: show(html("<p><span style='color:blue'>Please input your answer in the spaces above.</span></p><p>(위의 빈칸에 답을 입력하고 [Update(확인)] 버튼을 클릭하세요.)</p>")) else: show(html("<p><span style='color:red'>Incorrect(오답)</span></p><p>Answer(답안): <br> $\\lim_{n \\to \\infty} {\\cfrac {%s^x-%s^{-x}}{%s^x+%s^{-x}}}=\\lim_{n \\to \\infty} {\\cfrac {%s^x-1}{%s^x+1}}=1$"%(n1,n2,n1,n2,n1*n2,n1*n2))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>"))

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