忍者ブログ
物理学者(ポスドク)による日々の研究生活のメモ書きです ( python/emacs/html/Japascript/シェルスクリプト/TeX/Mac/C言語/Linux/git/tmux/R/ポケモンGO)
> a=10
> print a
10
みたいなのが基本的な使い方

他にも
> G=6.67e-11
> M1=10
> M2=20
> R=100
> print G * M1 * M2 / R / R
1.334e-12
とかすると、
質量10kgと20kgのものを100m離したときの万有引力を計算できたりする。
簡単な計算ならすぐにやってくれる
(そこまで信用できるわけではないので、概算程度で)



> print 100*200*300
6000000
こういう計算結果はできれば指数表示になってほしいところ。


ということで
>help print
The `print` command prints the value of to the screen. It is
synonymous with `pause 0`. may be anything that `gnuplot` can
evaluate that produces a number, or it can be a string.

Syntax:
  print {, , ...}

See `expressions`. The output file can be set with `set print`.


要するに、詳しくは expressionsの項目を見てね・・・っと。


>help expressions
In general, any mathematical expression accepted by C, FORTRAN, Pascal, or
BASIC is valid. The precedence of these operators is determined by the
specifications of the C programming language. White space (spaces and tabs)
is ignored inside expressions.

Complex constants are expressed as {,}, where and
must be numerical constants. For example, {3,2} represents 3 + 2i; {0,1}
represents 'i' itself. The curly braces are explicitly required here.

Note that gnuplot uses both "real" and "integer" arithmetic, like FORTRAN and
C. Integers are entered as "1", "-10", etc; reals as "1.0", "-10.0", "1e1",
3.5e-1, etc. The most important difference between the two forms is in
division: division of integers truncates: 5/2 = 2; division of reals does
not: 5.0/2.0 = 2.5. In mixed expressions, integers are "promoted" to reals
before evaluation: 5/2e0 = 2.5. The result of division of a negative integer
by a positive one may vary among compilers. Try a test like "print -5/2" to
determine if your system chooses -2 or -3 as the answer.

The integer expression "1/0" may be used to generate an "undefined" flag,
which causes a point to ignored; the `ternary` operator gives an example.
Or you can use the pre-defined variable NaN to achieve the same result.

The real and imaginary parts of complex expressions are always real, whatever
the form in which they are entered: in {3,2} the "3" and "2" are reals, not
integers.

Gnuplot can also perform simple operations on strings and string variables.
For example, the expression ("A" . "B" eq "AB") evaluates as true, illustrating
the string concatenation operator and the string equality operator.

A string which contains a numerical value is promoted to the corresponding
integer or real value if used in a numerical expression. Thus ("3" + "4" == 7)
and (6.78 == "6.78") both evaluate to true. An integer, but not a real or
complex value, is promoted to a string if used in string concatenation.
A typical case is the use of integers to construct file names or other strings;
e.g. ("file" . 4 eq "file4") is true.

Substrings can be specified using a postfixed range descriptor [beg:end].
Press return for more:
For example, "ABCDEF"[3:4] == "CD" and "ABCDEF"[4:*] == "DEF"
The syntax "string"[beg:end] is exactly equivalent to calling the built-in
string-valued function substr("string",beg,end), except that you cannot
omit either beg or end from the function call.

Subtopics available for expressions:
 functions operators random tm_hour
 tm_mday tm_min tm_mon tm_sec
 tm_wday tm_yday tm_year user-defined


明らかに長い・・・・
そして自分の欲しい情報が書いてないっす・・・・


C言語で言うと、
printf("%e¥n",a);
みたいなことがしたいんです。




○printの結果を出力する

できるらしい。

> set print ''FILENAME"
> print 500

これで、FILENAMEというファイルの中に500と書かれてるはず。

どこかで使えるかもね
PR
プロフィール
HN:coffee
職業:物理屋(自称)
趣味:映画鑑賞、登山
出身:大阪府の南の田舎
自己紹介:
import MyProfile
import coffee_pote from TWITTER
import amazonのほしい物リスト from WISH_LIST

print "先月子供が産まれました!"

# 最終更新 2022/10/25
カウンター
カウンター カウンター
ブログ内検索
ツイートするボタン
リンク
相互リンク募集中です (Twitterにてお知らせください)

Demo scripts for gnuplot version 5
(gnuplotのさまざまなデモ画像と作り方がまとめられている、眺めているだけでできるようになった気分になれる)

gnuplotスクリプトの解説
(米澤進吾さんの個人ページ、gnuplotと言えばこのかた)

gnuplot のページ
(Takeno Lab、うちのブログがリンクされていたのでリンク返し)

Twitterから映画の評価が分かる & 映画の鑑賞記録が残せる coco
(映画の感想をまとめられるサイト、いつもお世話になっています)

Astronomy Picture of the Day Archive
(天文や宇宙関連の最新の話題について画像とともにNASAが説明しているページ)

今日のほしぞら
(任意の時刻の空で見える星を表示してくれる、国立天文台が管理している)

GNUPLOTとアニメーション
(応用の項目の「見せてあげよう!ラピュタの雷を!!」あたりからすごすぎる)

読書メーター
(読んだ本をリストできる便利なサイト)

flickr難民の写真置き場
(20XX年、flickrは有料化の炎に包まれた。あらゆるflickr無料ユーザーは絶滅したかに見えた。 しかし、tumblr移住民は死に絶えてはいなかった。)

教授でもできるMac OS X へのLaTeX, X11, gccのインストレーションと環境設定
(阪大の山中卓さんのwebページ、タイトルにセンスが溢れている、内容は超充実してる、特にTeX関連、学振DCとかPDの申請書類作成時にはお世話になっております)

英語論文執筆用の例文検索サービス
(とんでもないものを見つけてしまった・・・・ arXivに収録されている 811,761報の 英語論文から,例文を検索するための検索エンジン)


Template "simple02" by Emile*Emilie
忍者ブログ [PR]