← 수업 제작 도구
홈 › Index › mathFunction (type)

mathFunction (type) (타입 mathFunction)

원본: Computation Layer 문서(mathFunction (type))

코드 안의 회색 줄은 원문 영어 주석이고, 파란 줄은 그 영어 주석의 번역이며, 연분홍 줄은 코드가 하는 일의 설명이다. 항목 설명은 번역이 아니라 해석이며 원문은 접어 둔 "원문(영어) 보기"에 있다.

계산할 수 있는 수학 함수를 나타낸다.

원문(영어) 보기

Represents a mathematical function that can be evaluated.

만들기(Creating)

simpleFunction function:simpleFunction

latex 글자를 받아, 예를 들어 계산기의 function sink에 넘길 수 있는 함수를 돌려준다. 첫 인자는 latex 글자이고, 나머지 인자는 입력 변수로 다룰 변수의 이름이다(지정하지 않으면 x에 관한 한 변수 함수가 된다).

원문(영어) 보기

Takes a latex string and returns a function which can, for example, be passed into the function sink of a calculator The first argument is the latex string, and additional arguments are The names of the variables to treat as input variables (defaults to one-variable function in terms of x if not specified

# Get the latex string from "equationInput" and assign
# it to f in the calculator.
▷ "equationInput"에서 latex 글자를 가져와 계산기의 f에 정한다.

function("f"): simpleFunction(equationInput.latex, "x")
▶ 그래프의 함수 f는 수식 답변 equationInput에 입력된 latex를 x에 관한 함수로 만든 값(simpleFunction(equationInput.latex, "x"))으로 한다.
function("이름")은 simpleFunction()의 결과를 그래프에 정의된 변수에 정하고, simpleFunction(…)은 latex 글자를 받아 함수를 돌려주고, 첫 인자는 latex 글자, 나머지 인자는 입력 변수 이름이다.

속성(Attributes)

evaluateAt type:mathFunction:evaluateAt

주어진 인자로 함수를 계산한다.

원문(영어) 보기

evaluate function with given arguments

# Create some simpleFunctions. we'll use them to help find
# our missing values
▷ simpleFunction 몇 개를 만든다. 빠진 값을 찾는 데 쓴다.
hypLength = simpleFunction("\sqrt{a^{2}+b^{2}}","a","b")
▶ 변수 hypLength는 latex 글자 "\sqrt{a^{2}+b^{2}}"를 입력 변수 "a", "b"에 대한 함수로 만든 값(simpleFunction("\sqrt{a^{2}+b^{2}}","a","b"))으로 한다.
simpleFunction(…)은 latex 글자를 받아 함수를 돌려주고, 첫 인자는 latex 글자, 나머지 인자는 입력 변수 이름이다. 글자 안의 \는 latex 명령(\sqrt)이 시작됨을 나타내는 역슬래시이다.
legLength = simpleFunction("\sqrt{c^{2}-a^{2}}","a","c") ▶ 변수 legLength는 latex 글자 "\sqrt{c^{2}-a^{2}}"를 입력 변수 "a", "c"에 대한 함수로 만든 값(simpleFunction("\sqrt{c^{2}-a^{2}}","a","c"))으로 한다.
글자 안의 \는 latex 명령(\sqrt)이 시작됨을 나타내는 역슬래시이다.
# Set the content of cells (1,3) and (2,2) ▷ 셀 (1,3)과 (2,2)의 내용을 정한다. cellContent(1,3): # If either of the two inputs are undefined, don't show anything. ▷ 두 입력 중 하나라도 정의되지 않았으면 아무것도 보여 주지 않는다. when isUndefined(this.cellNumericValue(1,1)) or isUndefined(this.cellNumericValue(1,2)) "" # Create a simpleFunction that sums the squares of the two legs # and takes the square root. Define those two variables "a" and "b" # evaluate the function at the two editable cells. The output is a number. ▷ 두 변(다리)의 제곱의 합에 제곱근을 취하는 simpleFunction을 만든다. 변수 "a"와 "b"를 정의하고, 두 편집 가능한 셀의 값에서 함수를 계산한다. 결과는 숫자이다. otherwise "${hypLength.evaluateAt(this.cellNumericValue(1,1),this.cellNumericValue(1,2))}" ▶ 1행 3열 셀의 내용(cellContent)은 이 표의 1행 1열 셀과 1행 2열 셀 중 하나라도 숫자 값이 정의되지 않았으면 빈 글자, 그렇지 않으면 "${hypLength.evaluateAt(this.cellNumericValue(1,1),this.cellNumericValue(1,2))}"로 한다.
cellContent(행, 열)은 지정한 셀의 내용을 정하고, evaluateAt(…)는 주어진 인자로 함수를 계산한다. cellNumericValue(행, 열)은 그 셀을 계산한 숫자 값을 가져오고, isUndefined(…)는 값이 정의되지 않았는지를 돌려준다. or는 둘 중 하나라도 참이면 참이고, ${ }는 글자 안에 변수의 값을 끼워 넣는 표기이다. when은 조건을 차례로 확인해 처음 맞는 값을 쓴다.
cellContent(2,2): # If either of the two inputs are undefined, don't show anything. ▷ 두 입력 중 하나라도 정의되지 않았으면 아무것도 보여 주지 않는다. when isUndefined(this.cellNumericValue(2,1)) or isUndefined(this.cellNumericValue(2,3)) "" # Create a simplefunction that subtracts the squares of a leg and the # hypotenuse and takes the square root. Define those two variables "a" and "c" # evaluate the function at the two editable cells. The output is a number. ▷ 한 변과 빗변의 제곱의 차에 제곱근을 취하는 simpleFunction을 만든다. 변수 "a"와 "c"를 정의하고, 두 편집 가능한 셀의 값에서 함수를 계산한다. 결과는 숫자이다. otherwise "${legLength.evaluateAt(this.cellNumericValue(2,1),this.cellNumericValue(2,3))}" ▶ 2행 2열 셀의 내용(cellContent)은 2행 1열 셀과 2행 3열 셀 중 하나라도 숫자 값이 정의되지 않았으면 빈 글자, 그렇지 않으면 "${legLength.evaluateAt(this.cellNumericValue(2,1),this.cellNumericValue(2,3))}"로 한다.
legLength.evaluateAt(…)는 legLength 함수를 두 셀의 숫자 값으로 계산한다.