プリンキピア

第2章準備

2.3.1. Scalars2.3.1 スカラー

Most everyday mathematics consists of manipulating numbers one at a time. Formally, we call these values scalars. For example, the temperature in Palo Alto is a balmy 72 degrees Fahrenheit. If you wanted to convert the temperature to Celsius you would evaluate the expression c=59(f−32), setting f to 72. In this equation, the values 5, 9, and 32 are constant scalars. The variables c and f in general represent unknown scalars.
英語のヒント
日常の数学のほとんどは、数を一つずつ操作することからなる。形式的には、こうした値をスカラーと呼ぶ。たとえば、パロアルトの気温は華氏72度で、心地よい暖かさである。この気温を摂氏に変換したければ、fを72として式c=59(f−32)を計算する。この方程式では、値5、9、32は定数のスカラーである。変数cとfは一般に未知のスカラーを表す。
We denote scalars by ordinary lower-cased letters (e.g., x, y, and z) and the space of all (continuous) real-valued scalars by ℝ. For expedience, we will skip past rigorous definitions of spaces: just remember that the expression x∈ℝ is a formal way to say that x is a real-valued scalar. The symbol ∈ (pronounced “in”) denotes membership in a set. For example, x,y∈{0,1} indicates that x and y are variables that can only take values 0 or 1.
英語のヒント
スカラーは普通の小文字(たとえばx、y、z)で表し、(連続な)実数値のスカラー全体の空間をℝで表す。手っ取り早くするため、空間の厳密な定義は飛ばす。式x∈ℝは、xが実数値のスカラーであることを形式的に言う書き方だ、とだけ覚えておけばよい。記号∈(「イン」と読む)は、集合への所属を表す。たとえばx,y∈{0,1}は、xとyが値0か1しかとれない変数であることを示す。
Scalars are implemented as tensors that contain only one element. Below, we assign two scalars and perform the familiar addition, multiplication, division, and exponentiation operations.
英語のヒント
スカラーは、要素を一つだけ含むテンソルとして実装される。下では、二つのスカラーを代入し、おなじみの加算、乗算、除算、累乗の演算を行う。
x = torch.tensor(3.0)
y = torch.tensor(2.0)

x + y, x * y, x / y, x**y
(tensor(5.), tensor(6.), tensor(1.5000), tensor(9.))