![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
今回の記事の目的はProcessingの「exp()
」を理解し、自分なりに使ってみること。
この記事を書いた人
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-user-profile-illustrationi-light-blue.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-user-profile-illustrationi-light-blue.png)
- クリエイティブコーディングで制作した作品と、上達のためにやったこと・学習過程を発信
- コンセプトは「クリエイティブコーディング1万時間の歩き方」
- 2024年にProcessingの構文のアウトプットを終え、2025年から作品制作開始(クリエイティブコーディングで作成した作品集)
目次
【Processing】exp()について
exp()について
- expは “exponential” の略で、「指数関数」という意味
exp()
関数は、数学でいう「eのx乗」を計算するための関数exp(1)
は約2.718(自然対数の底)
- 【注意点】数がとても大きくなることがあるので、結果がどのくらいの大きさになるか注意しましょう。あまり大きすぎるとプログラムが遅くなったり、間違った結果になることもある
【Processing】exp()の使い方【画像とコード】
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/11/processing-exp-function-how-to-calculate-e-to-the-power-of-x1.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/11/processing-exp-function-how-to-calculate-e-to-the-power-of-x1.png)
float size;
void setup() {
size(400, 400);
size = exp(2); // sizeにeの2乗の値を代入
}
void draw() {
background(255);
ellipse(width/2, height/2, size, size); // 中心に円を描く
}
【Processing】exp()を使ってみた感想
「eのx乗」。数学が苦手だったけど、Processingを通すと数学も嫌な気分にならない。
使いこなすとかっこいい表現ができるんじゃないかという可能性を感じるから。
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
それでは今日もレッツワクワクコーディング。