Skip to content

Instantly share code, notes, and snippets.

@serithemage
Created April 6, 2019 01:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serithemage/5da785940532e4763038b13c26faa53f to your computer and use it in GitHub Desktop.
Save serithemage/5da785940532e4763038b13c26faa53f to your computer and use it in GitHub Desktop.
2017_CSAT_Mathematics_Type_GA.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "2017_CSAT_Mathematics_Type_GA.ipynb",
"version": "0.3.2",
"provenance": [],
"include_colab_link": true
},
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/serithemage/5da785940532e4763038b13c26faa53f/2017_csat_mathematics_type_ga.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"metadata": {
"id": "PArEc4A8M5vO",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"# 파이썬으로 풀어보는 2017학년도 대학수학능력시험 수학영역\n",
"\n",
"## [github](https://github.com/serithemage/2017_CSAT_Mathematics_Type_GA)을 통해 누구나 참여하실 수 있습니다.\n",
"\n",
"- [jupyter notebook](http://jupyter.org/)을 이용해서 풀고 있습니다.\n",
"- jupyter notebook은 [Anaconda](https://www.continuum.io/downloads)를 통해 손쉽게 설치할 수 있습니다.\n",
"- 실행결과는 [이쪽](https://anaconda.org/ymath/2017_csat_mathematics_type_ga/notebook)에서 확인 하실 수 있습니다.\n",
"- 풀이에 대한 의견은 [issues](https://github.com/serithemage/2017_CSAT_Mathematics_Type_GA/issues)에 적어주세요.\n",
"- **제 자신은 수학도 파이썬도 허접해서 상당히 애를 먹고 있습니다. 능력자 분들의 Pull request 환영합니다!**\n"
]
},
{
"metadata": {
"id": "OKcKD6lcM5vU",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$1.\\space 두\\space 백터\\space \\overrightarrow{a}=(1,3),\\space \\overrightarrow{b}=(5,-6)에\\space 대하여\\space 벡터 \\overrightarrow{a}-\\overrightarrow{b}의\\space 모든\\space 성분의\\space 합은?$"
]
},
{
"metadata": {
"id": "OMSlkzqEM5vW",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
"import numpy as np"
],
"execution_count": 0,
"outputs": []
},
{
"metadata": {
"id": "jeuqddReM5vc",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "b01d2c1c-2df0-4131-ee52-bc4aa04dd69d"
},
"cell_type": "code",
"source": [
"a = np.matrix([1,3])\n",
"b = np.matrix([5,-6])\n",
"np.sum(a-b)"
],
"execution_count": 2,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"5"
]
},
"metadata": {
"tags": []
},
"execution_count": 2
}
]
},
{
"metadata": {
"collapsed": false,
"id": "9saQ0FIzM5vm",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$2.\\space\\lim_{x \\to 0}\\frac{e^{6x}-1}{ln(1+3x)}의\\space값은?$"
]
},
{
"metadata": {
"id": "BsqN8kAPM5vp",
"colab_type": "code",
"colab": {},
"outputId": "9f7a86c1-9644-4a71-fc98-c679da930307"
},
"cell_type": "code",
"source": [
"from mpmath import *\n",
"limit(lambda x: (exp(6*x)-1)/(ln(1+3*x)), 0)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"mpf('2.0')"
]
},
"metadata": {
"tags": []
},
"execution_count": 6
}
]
},
{
"metadata": {
"collapsed": true,
"id": "S7954FCsM5v1",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$3.\\space \\int_{0}^{\\frac{\\pi}{2}}2\\sin \\space x \\space dx 의 값은?$"
]
},
{
"metadata": {
"id": "i8jIfY1oM5v4",
"colab_type": "code",
"colab": {},
"outputId": "cb70e411-716c-4ea9-e87a-3132547098c3"
},
"cell_type": "code",
"source": [
"from scipy import integrate\n",
"f = lambda x: 2*sin(x)\n",
"integrate.quad(f,0,pi/2)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"(1.9999999999999998, 2.2204460492503128e-14)"
]
},
"metadata": {
"tags": []
},
"execution_count": 10
}
]
},
{
"metadata": {
"id": "ve_kiXd9M5wM",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$4.\\space 두\\space 사건\\space A와\\space B는\\space 서로\\space 독립이고\\\\\n",
"P(B^{C})=\\frac{1}{3}, P(A|B)=\\frac{1}{2} \\\\\n",
"일\\space 때,\\space P(A)P(B)의 값은?\\space (단, B^{C}은\\space B의\\space 여사건이다.)$\n",
"> A,B가 서로 독립일때 P(A)P(B)=P(A) 이 성립한다 ([출처:위키피디아](https://ko.wikipedia.org/wiki/%EC%A1%B0%EA%B1%B4%EB%B6%80_%ED%99%95%EB%A5%A0))"
]
},
{
"metadata": {
"id": "0CJ6CCvmM5wo",
"colab_type": "code",
"colab": {},
"outputId": "001cff36-e0b1-484b-8da0-6fe23a42e03a"
},
"cell_type": "code",
"source": [
"PB = 1 - (1/3)\n",
"PA = 1/2\n",
"PA * PB"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"0.33333333333333337"
]
},
"metadata": {
"tags": []
},
"execution_count": 12
}
]
},
{
"metadata": {
"id": "9L5jflj5M5wu",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"5.숫자 1,2,3,4,5 중에서 중복을 허락하여 네 개를 택해 일렬로 나열하여 만든 네 자리의 자연수가 5의 배수인 경우의 수는?\n",
"\n",
"> 5의 배수가 될 수 있는 수는 끝자리가 0 아니면 5가 되어야 하는데 제시된 5개의 숫자중에 0이 없다. 따라서 5x5x5x1"
]
},
{
"metadata": {
"id": "NIh9nyx1M5ww",
"colab_type": "code",
"colab": {},
"outputId": "5f15cf2a-da83-4b5e-8831-c7788ebc5148"
},
"cell_type": "code",
"source": [
"5*5*5*1"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"125"
]
},
"metadata": {
"tags": []
},
"execution_count": 13
}
]
},
{
"metadata": {
"id": "BUJ0i5bkM5xA",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$6.\\space함수\\space f(x)=x^3+x+1의\\space 역함수를\\space g(x)라\\space 할때,\\space g'(1)의\\space 값은?$\n",
"\n",
"> 역함수의 미분은 원래 함수를 미분한 값의 역과 같음. 출전: http://j1w2k3.tistory.com/316"
]
},
{
"metadata": {
"id": "n9i1RXGwM5xD",
"colab_type": "code",
"colab": {},
"outputId": "f7729e40-0fa3-4314-ba47-d00a376580fa"
},
"cell_type": "code",
"source": [
"from sympy import *\n",
"x = symbols('x') # 심볼 정의\n",
"fx = x**3+x+1 # 식 정의\n",
"1 / diff(fx).doit().subs({x:0})"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"1"
]
},
"metadata": {
"tags": []
},
"execution_count": 2
}
]
},
{
"metadata": {
"id": "8xh8NpuDM5xV",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"7.한 개의 주사위를 3 번 던질 때, 4 의 눈이 한 번만 나올 확률은?\n",
"\n",
"> 4이외의 주사위가 두번 그리고 4가 한번 나올 확률이므로 \n",
"\n",
"$\\frac{5*5*1*3}{6^3} = \\frac{25}{72}$"
]
},
{
"metadata": {
"id": "jLiiNFNpM5xd",
"colab_type": "code",
"colab": {},
"outputId": "88c1d3a0-8360-468d-f1d6-c23a8e5d28f3"
},
"cell_type": "code",
"source": [
"from math import gcd\n",
"a = 5*5*1*3 # 4 이외의 주사위가 2번 그리고 4가 1번 나올 확률\n",
"b = 6**3 # 주사위를 3번 던졌을때 모든 확률\n",
"c = gcd(a,b) # 최대 공약수\n",
"a / c # 분자"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"25.0"
]
},
"metadata": {
"tags": []
},
"execution_count": 18
}
]
},
{
"metadata": {
"id": "0cfimSjCM5xp",
"colab_type": "code",
"colab": {},
"outputId": "8a2998d9-7506-4d8b-aa63-1012a2d96721"
},
"cell_type": "code",
"source": [
"b / c # 분모"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"72.0"
]
},
"metadata": {
"tags": []
},
"execution_count": 16
}
]
},
{
"metadata": {
"collapsed": true,
"id": "fHqL6hzjM5xx",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$8.\\ 좌표공간의\\ 두\\ 점\\ A(1,\\space a,\\space-6),\\space B(-3,\\space2,\\space b)에\\space대하여\\\\\n",
"\\space선분\\space AB를\\space3:2로\\space외분하는\\space점이\\space x축\\space위에\\space있을\\space때,\\space a+b의\\space값은?$\n",
"> 외분점의 y, z좌표가 0이어야만 한다."
]
},
{
"metadata": {
"id": "Z_DLkGPNM5xz",
"colab_type": "code",
"colab": {},
"outputId": "014cce6e-257d-4f3a-8e9b-96d2e0f086fe"
},
"cell_type": "code",
"source": [
"from sympy.solvers import solve\n",
"from sympy import Symbol\n",
"a = Symbol(\"a\")\n",
"b = Symbol(\"b\")\n",
"fa = solve((3*2 - 2*a)/(3-2), a).pop()\n",
"fb = solve((3*b - 2*-6)/(3-2), b).pop()\n",
"print(\"a : {}, b : {}, a+b = {}\".format(fa, fb, fa+fb))"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"a : 3, b : -4, a+b = -1\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "CEtdWtCcM5yM",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$9.\\ \\int_{1}^{e}\\ln \\frac{x}{e} \\ dx 의\\ 값은?$"
]
},
{
"metadata": {
"id": "-5bwjePEM5yO",
"colab_type": "code",
"colab": {},
"outputId": "9c528d7b-fd01-4f80-b3ee-7daa39e3c6f7"
},
"cell_type": "code",
"source": [
"from scipy import integrate, log, e\n",
"f = lambda x: log(x/e)\n",
"result = integrate.quad(f, 1, e)\n",
"print(result)\n",
"print(result[0], \"= 2-e\")"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"(-0.7182818284590452, 7.97453024125089e-15)\n",
"-0.7182818284590452 = 2-e\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "IS2MaDeFM5yg",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$10.\\ 좌표평면\\ 위를\\ 움직이는\\ 점\\ P의\\ 시각\\ t\\ (t>0)에서의\\ 위치\\ (x,\\ y)가\\\\\n",
"x=t-\\frac{2}{t},\\ y=2t+\\frac{1}{t}\\\\\n",
"이다.\\ 시각\\ t=1에서\\ 점\\ P의\\ 속력은?$"
]
},
{
"metadata": {
"id": "QTfQneynM5yh",
"colab_type": "code",
"colab": {},
"outputId": "6690c940-fd51-45cc-9f91-df3cd0266117"
},
"cell_type": "code",
"source": [
"from mpmath import *\n",
"fx = lambda t: t-2/t\n",
"fy = lambda t: 2*t+1/t\n",
"dfx = diff(fx, 1)\n",
"dfy = diff(fy, 1)\n",
"result = root(dfx**2 + dfy**2, n=2)\n",
"print(result, \"= sqrt(10)\")"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"3.16227766016838\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "U1SoBqSpM5y1",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$11.\\ 그림과\\ 같이\\ 곡선\\ y=\\sqrt{x}+1과\\ x축,\\ y축\\ 및\\ 직선\\ x=1로\\\\\n",
"둘러싸인\\ 도형을\\ 밑면으로\\ 하는\\ 입체도형이\\ 있다.\\ 이\\ 입체도형을\\\\\n",
"x축에\\ 수직인\\ 평면으로\\ 자른\\ 단면이\\ 모두\\ 정사각형일\\ 때,\\\\\n",
"이\\ 입체도형의\\ 부피는?$\n",
"![11번 문제](https://github.com/serithemage/2017_CSAT_Mathematics_Type_GA/blob/master/img/11.png?raw=1)"
]
},
{
"metadata": {
"id": "0N9RCnH_M5zH",
"colab_type": "code",
"colab": {},
"outputId": "5ce44cb1-4c9d-4a0b-b312-79ef86eb3ba9"
},
"cell_type": "code",
"source": [
"import scipy.integrate as integrate\n",
"import math\n",
"from fractions import Fraction\n",
"\n",
"def length_of_side(x):\n",
" return math.sqrt(x)+1\n",
"def area_of_one(x):\n",
" return length_of_side(x)**2\n",
"\n",
"volume = integrate.quad(area_of_one, 0, 1)\n",
"\n",
"# convert a decimal num into fraction\n",
"volume = Fraction(volume[0]).limit_denominator()\n",
"\n",
"print(volume)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"17/6\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "K04erfUvM5zU",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$12.\\ 좌표공간에서\\ 평면\\ 2x+2y-z+5=0과\\ xy평면이\\ 이루는\\\\\n",
"예각의\\ 크기를\\ \\theta 라\\ 할\\ 때, \\cos{\\theta}의\\ 값은?$\n",
"> 두 법선벡터의 내적을 이용한다.\n",
"> 단, 두 평면이 이루는 예각을 구하기 때문에 절대값이다."
]
},
{
"metadata": {
"id": "6iAmpPscM5zY",
"colab_type": "code",
"colab": {},
"outputId": "a07005eb-5c6d-4eaa-ac9e-53daf134a8ea"
},
"cell_type": "code",
"source": [
"import numpy as np\n",
"\n",
"a = np.array([2, 2, -1])\n",
"b = np.array([0, 0, 1])\n",
"numerator = np.dot(a, b)\n",
"\n",
"norm_a = np.linalg.norm(a)\n",
"norm_b = np.linalg.norm(b)\n",
"denominator = norm_a * norm_b\n",
"\n",
"abs(numerator / denominator)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"0.33333333333333331"
]
},
"metadata": {
"tags": []
},
"execution_count": 7
}
]
},
{
"metadata": {
"id": "x2slqTxsM5z3",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$13.\\ 정규분포\\ N(0,\\ 4^2)을\\ 따르는\\ 모집단에서\\ 크기가\\ 9인\\ 표본을\\ 임의추출하여\\ 구한\\\\\n",
"표본평균을\\ \\overline{X},\\ 정규분포\\ N(3,\\ 2^2)을\\ 따르는\\ 모집단에서\\ 크기가\\ 16인\\ 표본을\\ 임의추출하여\\ 구한\\\\\n",
"표본평균을\\ \\overline{Y}라\\ 하자.\\\\\n",
"P(\\overline{X}\\ge 1)\\ =\\ P(\\overline{Y}\\le a)를\\ 만족시키는\\ 상수\\ a의\\ 값은?\\\\$\n",
"> X와\\ Y를\\ 정규분포화\\ 하여\\ 비교한다.$"
]
},
{
"metadata": {
"id": "Ah4FtddCM5z4",
"colab_type": "code",
"colab": {},
"outputId": "904228a6-1704-47f0-bc70-8e827b114217"
},
"cell_type": "code",
"source": [
"from sympy.solvers import solve\n",
"from sympy import Symbol\n",
"\n",
"a = Symbol(\"a\")\n",
"\n",
"X_bar_mean = 0\n",
"X_bar_var = 4/3\n",
"Y_bar_mean = 3\n",
"Y_bar_var = 1/2\n",
"\n",
"solve((2*a - 2*Y_bar_mean + (1-0)/X_bar_var), a)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[2.62500000000000]"
]
},
"metadata": {
"tags": []
},
"execution_count": 8
}
]
},
{
"metadata": {
"id": "OxTU4PasM5z9",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$14.\\ 그림과\\ 같이\\ 반지름의\\ 길이가\\ 1이고\\ 중심각의\\ 크기가\\ \\frac{\\pi}{2}인\\ 부채꼴\\ OAB가\\ 있다.\\\\\n",
"호\\ AB\\ 위의\\ 점\\ P에서\\ 선분\\ OA에\\ 내린\\ 수선의\\ 발을\\ H,\\ 선분\\ PH와\\ 선분\\ AB의\\ 교점을\\ Q라\\ 하자.\\\\\n",
"\\angle{POH}=\\theta 일\\ 때,\\ 삼각형\\ AQH의\\ 넓이를\\ S(\\theta )라\\ 하자.\\\\\n",
"\\lim_{\\theta\\to0+}\\frac{S(\\theta)}{\\theta^4}의\\ 값은?\\ (단,\\ 0\\lt\\theta\\lt\\frac{\\pi}{2})$\n",
"![14번 문제](https://github.com/serithemage/2017_CSAT_Mathematics_Type_GA/blob/master/img/14.png?raw=1)\n",
"> 삼각형 AQH가 이등변삼각형임을 이용"
]
},
{
"metadata": {
"id": "rBLTjDOqM50A",
"colab_type": "code",
"colab": {},
"outputId": "28b33bbe-b145-4398-9497-5c50f22315bd"
},
"cell_type": "code",
"source": [
"from sympy import Symbol, Limit, cos\n",
"\n",
"th = Symbol('th')\n",
"s = (1-cos(th))**2/2\n",
"Limit(s/pow(th,4), th, 0).doit()"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"1/8"
]
},
"metadata": {
"tags": []
},
"execution_count": 11
}
]
},
{
"metadata": {
"id": "iy4BhJlHM50h",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$15.\\ 곡선\\ y=2e^{-x}\\ 위의\\ 점\\ P(t,\\ 2e^{-t})\\ (t\\gt0)에서\\ y축에\\ 내린\\ 수선의\\ 발을\\ A라\\ 하고,\\\\\n",
"점\\ P에서의\\ 접선이\\ y축과\\ 만나는\\ 점을\\ B라\\ 하자.\\\\\n",
"삼각형\\ APB의\\ 넓이가\\ 최대가\\ 되로록\\ 하는\\ t의\\ 값은?$\n",
"![15번 문제](https://github.com/serithemage/2017_CSAT_Mathematics_Type_GA/blob/master/img/15.png?raw=1)\n",
">P에서 접선을 구하여 B를 구하여 AB의 길이를 구한 뒤, AP의 길이 t와 곱한 값을 미분하여 0이 되는 값을 찾는다."
]
},
{
"metadata": {
"id": "taE6mx7SM50i",
"colab_type": "code",
"colab": {},
"outputId": "118c39d5-9263-416f-e1f6-555a517634c5"
},
"cell_type": "code",
"source": [
"from scipy import e\n",
"from sympy.solvers import solve\n",
"from sympy import Symbol, Limit, Derivative\n",
"\n",
"t = Symbol('t')\n",
"AP = t\n",
"AB = 2 * t * e**(-t)\n",
"\n",
"s = AP * AB / 2\n",
"d = Derivative(s, t).doit()\n",
"solve(d, t)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[0.0, 2.00000000000000]"
]
},
"metadata": {
"tags": []
},
"execution_count": 23
}
]
},
{
"metadata": {
"id": "r7Pus00jM50o",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$16.\\ 좌표공간에서\\ 원점에\\ 대한\\ 세\\ 점\\ A,\\ B,\\ C의\\ 위치벡터를\\ 차례로\\ \\overrightarrow{a},\\ \\overrightarrow{b},\\ \\overrightarrow{c}라\\ 할\\ 때,\\\\\n",
"이들\\ 벡터\\ 사이의\\ 내적을\\ 표로\\ 나타내면\\ 다음과\\ 같다.\\\\$\n",
"![16번 문제](https://github.com/serithemage/2017_CSAT_Mathematics_Type_GA/blob/master/img/16.png?raw=1)\n",
"$예를\\ 들어,\\ \\overrightarrow{a}\\cdot\\overrightarrow{c}=-\\sqrt{2}이다.\\ 세\\ 점\\ A,\\ B,\\ C에\\ 대하여\\\\\n",
"두\\ 점\\ 사이의\\ 거리의\\ 대소\\ 관계로\\ 옳은\\ 것은?$\n",
"> a, b, c의 크기는 같다. 각 벡터가 이루는 각으로 비교해야 하는데, b와 c는 내적이 0이기에 직각을 이루고, a와 b는 내적 값이 양수이기에 예각, a와 c는 내적 값이 음수이기에 둔각을 이룬다. 따라서 둔각을 이루고 있는 AC의 길이가 가장 길고, 직각을 이루고 있는 BC의 길이가 그 다음으로 길고, 예각을 이루고 있는 AB의 길이가 가장 짧다."
]
},
{
"metadata": {
"id": "90lk62-hM50r",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
""
],
"execution_count": 0,
"outputs": []
},
{
"metadata": {
"id": "SLGuv499M50z",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"$17.\\ 좌표평면\\ 위의\\ 한\\ 점\\ (x,\\ y)에서\\ 세\\ 점\\ (x+1,\\ y),\\ (x,\\ y+1),\\ (x+1,\\ y+1)\\ 중\\ 한\\ 점으로\\ 이동하는\\ 것을\\ 점프라\\ 하자.\\\\\n",
"점프를\\ 반복하여\\ 점\\ (0, 0)에서\\ 점\\ (4, 3)까지\\ 이동하는\\ 모든\\ 경우\\ 중에서,\\ 임의로\\ 한\\ 경우를\\ 선택할\\ 때\\ 나오는\\ 점프의\\ 횟수를\\ 확률변수\\ X라\\ 하자.\\\\ 다음은\\ 확률변수\\ X의\\ 평균\\ E(X)를\\ 구하는\\ 과정이다.\\ (단,\\ 각\\ 경우가\\ 선택되는\\ 확률은\\ 동일하다.)\\\\$\n",
"![17번 문제](https://github.com/serithemage/2017_CSAT_Mathematics_Type_GA/blob/master/img/17.png?raw=1)\n",
"$위의\\ (가),\\ (나),\\ (다)에\\ 알맞은\\ 수를\\ 각각\\ a,\\ b,\\ c라\\ 할\\ 때,\\ a+b+c의\\ 값은?\\\\$\n",
">$(가):\\ 확률변수\\ X가\\ 가질\\ 수\\ 있는\\ 값\\ 중\\ 가장\\ 작은\\ 값을\\ k라\\ 하면\\ k는\\ 대각선으로\\ 3번,\\ 가로로\\ 1번\\ 가는\\ 경우인\\ 4의\\ 값을\\ 갖는다.\\\\\n",
"(나):\\ 대각선으로\\ 1번,\\ 가로로\\ 3번,\\ 위로\\ 2번\\ 가야한다.\\\\\n",
"(다):\\ 위의\\ 확률을\\ 다\\ 더해서\\ 1이\\ 나와야\\ 한다.\\\\$"
]
},
{
"metadata": {
"id": "KgaPp_LyM500",
"colab_type": "code",
"colab": {},
"outputId": "48e426ab-00e6-410f-e92c-052e66ad006a"
},
"cell_type": "code",
"source": [
"from sympy.solvers import solve\n",
"from sympy import Symbol\n",
"\n",
"def factorial (item):\n",
" if(item == 0):\n",
" return(1)\n",
" else:\n",
" return (item * factorial(item-1))\n",
" \n",
"a = 4\n",
"b = factorial(6)/(factorial(3)*factorial(2))\n",
"N = Symbol(\"N\")\n",
"c = solve((4+30+b+35)/N -1, N)\n",
"print(a+b+float(c[0]))"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"193.0\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "DIkROfnRM506",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment