← 수업 제작 도구
홈 › Components › Math Response (수식 답변) › 화면 9

화면 9. Math Input.initialLatex [sink]

원본: Computation Layer 문서(Math Response (수식 답변)) · Try It (원본 화면)

화면 번호9 / 28
문서 항목 설명 (원문)initialLatex Sets the initial value of the expression input. Should be a valid LaTeX string.

1. 화면 캡처 (빨간 번호 = 아래 표의 번호)

화면 9 캡처

화면에 적힌 영어 문구(원문):

2. CL이 입력된 곳

코드 안의 회색 줄은 원문 영어 주석이고, 파란 줄은 그 영어 주석의 번역이며, 연분홍 줄은 코드가 하는 일의 설명이다.

번호이름종류CL 코드 원문, 번역, 설명
1레이블 없는 그래프그래프
# Here we use simpleFunction and the function sink to defined a function in the graph
# Note here that we only use the student's expresison if they have pressesed  "submit"
▷ 여기서는 simpleFunction과 function sink를 써서 그래프에 함수를 정의한다. 학생이 "submit"을 눌렀을 때만 학생의 식을 쓴다는 점에 주의하라.

latex = 
  when expInput2.submitted expInput2.latex
  otherwise ""
▶ 변수 latex는 expInput2가 제출되었으면 그 입력의 LaTeX 글자(expInput2.latex), 그렇지 않으면 빈 글자로 한다.
submitted는 수식 답변이 제출되었는지를 참 또는 거짓으로 알려 주고, latex는 입력한 식의 LaTeX 글자를 가져온다. when은 조건을 차례로 확인해 처음 맞는 값을 쓴다.
function("f"): simpleFunction(latex,"x") ▶ 그래프의 함수 f는 변수 latex의 글자를 x에 관한 함수로 만든 simpleFunction(latex,"x")로 한다.
simpleFunction은 latex 글자를 받아 함수를 돌려주는 함수이고, 첫 인자는 latex 글자, 나머지 인자는 입력 변수 이름이다. 계산기의 function 항목에 넘길 수 있다. function("f")는 simpleFunction()의 결과를 그래프에 정의된 변수에 정한다.
2expInput2수식 답변
# This sink uses the LaTeX representation for "f(x)="
# which will display in the expression input.
# Note that we have enclosed the LaTeX in quotes so that it's a string.
▷ 이 sink는 수식 답변에 표시될 "f(x)="의 LaTeX 표현을 쓴다. LaTeX를 큰따옴표로 감싸 글자(string)로 만들었음에 주의하라.

initialLatex: "f\left(x\right)="
▶ 수식 답변의 처음 값(initialLatex)은 "f\left(x\right)="로 한다.
initialLatex는 수식 답변의 처음 값을 정하며 올바른 LaTeX 글자여야 한다.