イフコンピュータ > MINERVA > マニュアル > レファレンス > 算術計算

算術計算

MINERVA
ifcomputer logo
f
Expert Services on the Web

MINERVAの新しい算術関数は、内蔵関数と全く同じように使用することが できます。

算術表現の関数表記と関係を示す表記の両方の表記が可能です。

MINERVAの数値を求める述語について、 例えば、is/2 を例に挙げて考えます。 "Result = f(A,...,N)" のような関数は、 "f(A,...,N,Result)" の述語の探索として行なわれます。

これにより、MINERVAによる数式は、 計算途中の値を保持するための変数の記述を省略することができ、 理解しやすくなっています。

% example: compute the cost for industrial urethane foam

% notation as relations a(Price) :- height(H), width(W), depth(D), unit_price_per_volume(U), Price is H * W * D * U.

% notation as functions

b(Price) :- Price is height * width * depth * unit_price_per_volume.

% uniform notation of functions resp. data base

height(6). depth(38). width(75). unit_price_per_volume(0.01).

上のプログラムの結果は以下の通りです。

?- a(Price).

Price = 171.0

yes

?- b(Price).

Price = 171.0

yes

?-

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Arithmetic/print_jp.html
published 2012/5/21 update 2002/3/20 (c) 1996-2009 IF Computer Japan
IF Computer 〒113-0022 Tel 03-5814-3352 start (AT) ifcomputer.com
Customer Support 東京都文京区千駄木5-28-2   http://www.ifcomputer.co.jp
戻る> managed with ubiCMS