chatGPT

데이터 문해력

저자
소속

데이터 문해력에 “중학수학 - 연립방정식” 사례를 통해 적용 방향을 살펴보자.

1 중2 수학 커리큘럼

2 연립방정식

  1. 질문을 한글로 입력
  2. 질문을 영어로 번역
  3. 영어번역된 질문을 chatGPT에 문의
  4. 영문으로 작성된 chatGPT결과를 한글로 번역
  5. 최종 한글 번역결과를 출력결과로 표시

2.1 한글질문 준비

library(tidyverse)
library(openai)

korean_question <- "중학교에서 수학에서 나오는 연립방정식을 설명해줘"
korean_question
#> [1] "중학교에서 수학에서 나오는 연립방정식을 설명해줘"

2.2 질문번역


korean_question_input <- glue::glue("translate it into English: {korean_question}")

question_model <- create_completion(
    model="text-davinci-003",
    prompt = korean_question_input,
    max_tokens=1024,
    openai_api_key = Sys.getenv("OPEN_AI_KEY")
)

translated_questions <- str_extract(question_model$choices$text, "\\b[^\\W].+\\b")

translated_questions
#> [1] "Explain the system of linear equations that comes from middle school math"

2.3 chatGPT 영문 답변


answer_model <- create_completion(
    model="text-davinci-003",
    prompt = translated_questions,
    max_tokens=1024,
    openai_api_key = Sys.getenv("OPEN_AI_KEY")
)

chatGPT_answer <- answer_model$choices$text
cat(chatGPT_answer)
#> 
#> 
#> A system of linear equations is a set of two or more linear equations that contains the same variables. The equations are usually referred to as simultaneous equations, as they are usually solved together.
#> 
#> In the context of middle school math, a linear equation generally consists of two variables, and the equations are primarily used to solve problems involving rate, distance, and time. The general form of a linear equation is y=mx+b, where m is the slope of the line, x is the independent variable, and b is the y-intercept. The slope and y-intercept can be found by plotting the points that make up the equation on a graph. 
#> 
#> Once the slope and y-intercept have been determined, other linear equations can be written by substituting different values for the slope and y-intercept. For example, if the slope of a linear equation is m=5 and the y-intercept is b=3, then the equation can be written as y=5x+3. Different values can also be plugged into the equation to solve for either x or y.
#> 
#> In a system of linear equations, two equations are combined to form one equation. By solving both equations simultaneously, a more general solution can be found. This process is usually done by using elimination, substitution, or graphing. Once the solution has been found, it can be used to answer questions about the relationships between the variables.

2.4 chatGPT 답변 번역


chatGPT_answer_request <- glue::glue("한국어로 번역해주세요: {chatGPT_answer}")

return_model <- create_completion(
    model="text-davinci-003",
    prompt = chatGPT_answer_request,
    max_tokens=1024,
    openai_api_key = Sys.getenv("OPEN_AI_KEY")
)

cat(return_model$choices$text)
#> 
#> 
#> 회귀방정식은 동일한 변수를 포함하는 두 개 이상의 선형방정식들의 시스템입니다. 이 방정식들은 일반적으로 동시 방정식으로 불리며, 같이 풀릴 때가 많습니다.
#> 
#> 중학교 수학에서의 선형방정식은 일반적으로 두 개의 변수를 가지며, 이 방정식들은 비율이나 거리, 시간 등 문제를 풀때 많이 사용됩니다. 선형방정식의 일반적인 형태는 y=mx+b 입니다. 여기서 m은 선의 기울기, x는 독립변수, b는 y절편입니다. 기울기와 y절편은 방정식의 점들을 그래프에 그려 구할 수 있습니다.
#> 
#> 기울기와 y절편이 결정되면 다른 값들로 선형방정식을 작성할 수도 있습니다. 예를 들어, 선형 방정식의 기울기가 m=5이고 y절편이 b=3인 경우, y=5x+3으로 방정식을 작성할 수 있습니다. 또한 다른 값들을 방정식에 대입하여 x값 또는 y값을 구할 수도 있습니다.
#> 
#> 회귀방정식 시스템들은 두 개의 방정식을 하나의 방정식으로 결합합니다. 두 방정식을 동시에 풀게 되어 상대적으로 더 일반적인 해답을 구할 수 있습니다.

3 시연 화면

바로가기