수학2(17,19,21,22,23)

152 days ago by nim_od

#17 import random def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 global n1,X,f1,f2,df n1 = randint(2, 9) #x 계수 n2= randint(1, 5) #상수 X = randint(1, 2) #X var('a,b') f1(x)=n1*x+n2 f2(x)=a*x^2+b*x df(x)=diff(f2(x),x) A,B=solve([f1(X)==f2(X),n1==df(X)],a,b)[0] A=A.rhs() B=B.rhs() return [A,B] # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 ans =problem_num() answer_list=[] answer_list.append(ans) while len(answer_list)!=5: a=randint(-5,-1) b=randint(3,10) answers=[a,b] 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>함수 $f(x)=\\begin{cases} %s \\ \\ {\\rm } (x < %s) \\\\ %s \\ \\ \\ {\\rm } (x \\ge %s) \\end{cases}$가 $x=%s$에서 연속일 때, 상수 $a,b$의 값은 얼마인가?</p>"%(latex(f1(x)),X,latex(f2(x)),X,X))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): show(html("<p>$%s.$ $a=%s,\\ b=%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>함수 $f(x)$가 $x=%s$에서 미분가능하면 연속이므로<br>$f(%s)=a+b$, 즉 $a+b=%s$<br>$f'(x)\\begin{cases} %s \\ \\ {\\rm } (x < %s) \\\\ %s \\ \\ \\ {\\rm } (x \\ge %s) \\end{cases}$이고, <br>함수$f(x)$는 $x=%s$에서 미분가능하므로, $%s=%s$<br>$\\therefore a=%s$, $b=%s$"%(X,X,f1(X),n1,X,latex(df(x)),X,X,latex(df(X)),n1,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:blue'>Correct(정답)</span></p><p>Answer(답안): <br>함수 $f(x)$가 $x=%s$에서 미분가능하면 연속이므로<br>$f(%s)=a+b$, 즉 $a+b=%s$<br>$f'(x)\\begin{cases} %s \\ \\ {\\rm } (x < %s) \\\\ %s \\ \\ \\ {\\rm } (x \\ge %s) \\end{cases}$이고, <br>함수$f(x)$는 $x=%s$에서 미분가능하므로, $%s=%s$<br>$\\therefore a=%s$, $b=%s$"%(X,X,f1(X),n1,X,latex(df(x)),X,X,latex(df(X)),n1,answer[0],answer[1]))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>")) 
       

함수 에서 연속일 때, 상수 의 값은 얼마인가?

answers 

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,f,df,X n1 = randint(1, 9) X=randint(1,4) n2=randint(1,5) var('a') f(x)=x^3+a*x^2+n1 df(x)=diff(f(x),x) ans=solve(df(X)==n2,a)[0].rhs() return ans # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 ans =problem_num() answer_list=[] answer_list.append(ans) while len(answer_list)!=5: answers=randint(-10,5) if answers in answer_list or answers==0: 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>함수 $f(x)=x^3+ax^2+%s$에 대하여 $f'(%s)=%s$일때, 상수 $a$의 값을 구하여라.</p>"%(n1,X,n2))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): show(html("<p>$%s.$ $%s$</p>"%(i+1,latex(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>$f'(x)=(x^3+ax^2+%s)'=%s$ 이므로 $f'(%s)=%s=%s=%s$이다.<br>$\\therefore a=%s$"%(n1,latex(df(x)),X,latex(df(x)),latex(df(X)),n2,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>$f'(x)=(x^3+ax^2+%s)'=%s$ 이므로 $f'(%s)=%s=%s=%s$이다.<br>$\\therefore a=%s$"%(n1,latex(df(x)),X,latex(df(x)),latex(df(X)),n2,answer))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>")) 
       

함수 에 대하여 일때, 상수 의 값을 구하여라.

answers 

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

#21 import random def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 global f1,f2,f3 n1 = randint(1, 9) n2 = randint(1, 9) n3 = randint(1, 9) var('a') f1(x)=n1*x+1 f2(x)=n2*x+1 f3(x)=n3*x+1 f1f2=f1*f2 f2f3=f2*f3 f1f3=f1*f3 df(x)=diff(f1*f2*f3).simplify_full() return n1,n2,n3,f1,f2,f3,df,f1f2,f2f3,f1f3 # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 n1,n2,n3,f1,f2,f3,df,f1f2,f2f3,f1f3 =problem_num() answer_list=[] answer_list.append(df(x)) while len(answer_list)!=5: _n1,_n2,_n3,_f1,_f2,_f3,_df,_f1f2,_f2f3,_f1f3 =problem_num() answers=_df(x) if answers in answer_list or answers==0: continue answer_list.insert(0,answers) return answer_list,n1,n2,n3,f1,f2,f3,df,f1f2,f2f3,f1f3 select_answer_list,n1,n2,n3,f1,f2,f3,df,f1f2,f2f3,f1f3 =problem_answer_list() answer=select_answer_list[4] random.shuffle(select_answer_list) #문제 show(html("<p>함수 $y=(%s)(%s)(%s)$를 미분하시오.</p>"%(latex(f1(x)),latex(f2(x)),latex(f3(x))))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): show(html("<p>$%s.$ $y'=%s$</p>"%(i+1,latex(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>$y'=(%s)'(%s)(%s)+(%s)(%s)'(%s)+(%s)(%s)(%s)'$<br>$=%s(%s)(%s)+%s(%s)(%s)+%s(%s)(%s)'$<br>$=%s(%s)+%s(%s)+%s(%s)$<br>$=%s$"%(latex(f1(x)),latex(f2(x)),latex(f3(x)),latex(f1(x)),latex(f2(x)),latex(f3(x)),latex(f1(x)),latex(f2(x)),latex(f3(x)),n1,latex(f2(x)),latex(f3(x)),n2,latex(f1(x)),latex(f3(x)),n3,latex(f1(x)),latex(f2(x)),n1,latex(f2f3(x).simplify_full()),n2,latex(f1f3(x).simplify_full()),n3,latex(f1f2(x).simplify_full()),latex(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>$y'=(%s)'(%s)(%s)+(%s)(%s)'(%s)+(%s)(%s)(%s)'$<br>$=%s(%s)(%s)+%s(%s)(%s)+%s(%s)(%s)'$<br>$=%s(%s)+%s(%s)+%s(%s)$<br>$=%s$"%(latex(f1(x)),latex(f2(x)),latex(f3(x)),latex(f1(x)),latex(f2(x)),latex(f3(x)),latex(f1(x)),latex(f2(x)),latex(f3(x)),n1,latex(f2(x)),latex(f3(x)),n2,latex(f1(x)),latex(f3(x)),n3,latex(f1(x)),latex(f2(x)),n1,latex(f2f3(x).simplify_full()),n2,latex(f1f3(x).simplify_full()),n3,latex(f1f2(x).simplify_full()),latex(answer)))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>")) 
       
192*x^2 + 112*x + 14

함수 를 미분하시오.

answers 

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

#22 import random def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 n1 = randint(3, 9) n2 = randint(1, 9) n3 = randint(4, 9) while n1%2==n2%2 or n1%3==n2%3: n2 = randint(1, 9) f(x)=(n1*x-n2)^n3 df(x)=diff(f(x)) return n1,n2,n3,f,df # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 n1,n2,n3,f,df =problem_num() answer_list=[] answer_list.append(factor(df(x))) while len(answer_list)!=5: k=randint(1,5) m=randint(-2,0) _df(x)=k*n3*(n1*x-n2)^(n3+m) answers=factor(_df(x)) if answers in answer_list or answers==0: continue answer_list.insert(0,answers) return answer_list,n1,n2,n3,f,df select_answer_list,n1,n2,n3,f,df =problem_answer_list() answer=select_answer_list[4] random.shuffle(select_answer_list) #문제 show(html("<p>함수 $y=%s$를 미분하시오.</p>"%(latex(f(x))))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): show(html("<p>$%s.$ $y'=%s$</p>"%(i+1,latex(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(답안): $y'=%s (%s x-%s)^{%s}(%s x-%s)'=%s (%s x-%s)^{%s}%s=%s$"%(n3,n1,n2,n3-1,n1,n2,n3,n1,n2,n3-1,n1,latex(factor(df(x)))))) 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(답안): $y'=%s (%s x-%s)^{%s}(%s x-%s)'=%s (%s x-%s)^{%s}%s=%s$"%(n3,n1,n2,n3-1,n1,n2,n3,n1,n2,n3-1,n1,latex(factor(df(x)))))) show(html("<input type = 'hidden' name = 'checking' class = 'val_chk' value = '0'>")) 
       
(4, 3)

함수 를 미분하시오.

answers 

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

#23 import random def problem_num(): #문제에 들어갈 값 범위 랜덤 함수 n1 = randint(1, 5) X=randint(1,4) n2=randint(1,5) f(x)=x^3+n1*x+n2 df(x)=diff(f(x)) Y=f(X) y(x)=df(X)*(x-X)+Y return n1,n2,f,df,X,Y,y(x) # 답과 문제 랜덤 값 반환 def problem_answer_list(): # 답안과 결합될 숫자(랜덤화 및 중복 값 제거)를 생성하는 함수 n1,n2,f,df,X,Y,y =problem_num() answer_list=[] answer_list.append(y) while len(answer_list)!=5: _n1,_n2,_f,_df,_X,_Y,_y =problem_num() answers=_y if answers in answer_list or answers==0: continue answer_list.insert(0,answers) return answer_list,n1,n2,f,df,X,Y,y select_answer_list,n1,n2,f,df,X,Y,y =problem_answer_list() answer=select_answer_list[4] random.shuffle(select_answer_list) #문제 show(html("<p>함수 $f(x)=x^3+%sx+%s$ 위의 점 $(%s,%s)$에서의 접선의 방정식을 구하여라.</p>"%(n1,n2,X,Y))) sp = LatexExpr('\\quad') spp = LatexExpr('\\qquad') for i in range(5): show(html("<p>$%s.$ $y=%s$</p>"%(i+1,latex(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>$f(x)=%s$이라 하면, $f'(x)=%s$이다.<br>이 곡선 위의 점 $(%s,%s)$에서의 접선의 기울기는 $f'(%s)=%s$이므로, <br>기울기가 $%s$이고, 점 $(%s,%s)$을 지나는 접선의 방정식은 <br>$y-%s=%s(x-%s) \\ \\\\ \\therefore y=%s$"%(latex(f(x)),latex(df(x)),X,Y,X,df(X),df(X),X,Y,Y,df(X),X,latex(y)))) 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>$f(x)=%s$이라 하면, $f'(x)=%s$이다.<br>이 곡선 위의 점 $(%s,%s)$에서의 접선의 기울기는 $f'(%s)=%s$이므로, <br>기울기가 $%s$이고, 점 $(%s,%s)$을 지나는 접선의 방정식은 <br>$y-%s=%s(x-%s) \\ \\\\ \\therefore y=%s$"%(latex(f(x)),latex(df(x)),X,Y,X,df(X),df(X),X,Y,Y,df(X),X,latex(y)))) 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