From sota@midway.uchicago.edu Sun Jul 15 23:29:30 2001
Received: from midway.uchicago.edu (midway.uchicago.edu [128.135.12.12])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f6FLTTX02045
	for <prolog@swi.psy.uva.nl>; Sun, 15 Jul 2001 23:29:29 +0200 (MET DST)
Received: from midway.uchicago.edu (nsit-s229-56.uchicago.edu [128.135.229.56])
	by midway.uchicago.edu (8.11.3/8.11.3) with ESMTP id f6FLTQa13790;
	Sun, 15 Jul 2001 16:29:26 -0500 (CDT)
Message-ID: <3B5209BC.2477B2EF@midway.uchicago.edu>
Date: Sun, 15 Jul 2001 16:23:08 -0500
From: Satoshi Ota :- OOta <sota@midway.uchicago.edu>
X-Mailer: Mozilla 4.05 [ja] (Win95; I)
MIME-Version: 1.0
To: "Michael A. Covington" <mc@arches.uga.edu>
CC: prolog@swi.psy.uva.nl
Subject: Re: [SWIPL] arithmetic_function
References: <20010714200815Q.sota@midway.uchicago.edu> <004d01c10cd0$3f6e2b00$c901a8c0@MINERVA>
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

Michael,

Thank you for your detailed reply. It provides me a lot of information on
programming with prolog. However, my intention was a bit different. I'm sorry for
my insufficient explanation.

My question was simpler. It can be paraphrased as follows:

When I used arithmetic_function/1 to make an arithmetic function, I encountered an
error caused by is/2 if one or more than one of arguments of the function are
functors (or atoms). I thought it would be allowed, but in fact not.

So can anybody tell me if is/2 will reject any arithmetic function containing
functors and/or atoms as its arguments?

Michael A. Covington wrote:

> > ?- A is sum(0, 4, k).
> > It does not work because:
> > ERROR: Arithmetic: `k/0' is not a function
> > Does anybody know why it did not work?
>
> It does not work because the letter k is not the sum of two numbers.
>
> Did you mean to write the variable K?  In that case, the reason it
> doesn't work is that Prolog does not include an all-purpose equation
> solver.  (Indeed, neither does all of mathematics as we know it.)
> Prolog does not have a mechanism to search for numbers that solve
> equations.  (How many numbers should it try?  There are infinitely
> many.)
>
> There are numerous algorithms that solve large classes of equations
> numerically, though success with arbitrary functions is not guaranteed.
> One of them is in the book Prolog Programming in Depth, by Covington,
> Nute, and Vellino, Prentice-Hall edition, pp. 198-203.  The code,
> solver.pl, is online at ftp.ai.uga.edu (somewhere), but you need the
> book to explain how it works.
>
> You can find such algorithms in numerical methods textbooks.  They are
> basically search algorithms, but over an infinite search space.

Thanks,

---
Satoshi


