Article View: comp.lang.prolog
Article #1052Re: HELP!! Need a square root function/predicate in Prolog
From: fore057
Date: Thu, 09 Aug 2012 18:21
Date: Thu, 09 Aug 2012 18:21
19 lines
1136 bytes
1136 bytes
In article <1990Aug08.001233.6587@hoss.unl.edu>, sanjiv@fergvax.unl.edu (Sanjiv K. Bhatia) writes:
> Hi there:
>
> I am working on some experiments using Prolog and need a square root function.
> Will some kind soul mail me a copy of the same if you happen to have one handy?
>
> Thanks in advance.
>
> Sanjiv
> Sanjiv K. Bhatia Department of Computer Science
> sanjiv@fergvax.unl.edu Ferguson Hall 115
> voice: (402)-472-3485 University of Nebraska - Lincoln
> fax : (402)-472-7767 Lincoln, NE 68588-0115
If you have log and exponential functions in your prolog version, the following
will give you X to any power Y:
powerOf(X,Y,Ans):-
Ans=EXP(Y*LN(X)).
Technical Details
Message-ID:
<1990Aug9.182105.8890@canterbury.ac.nz>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!comp.vuw.ac.nz!virtue!canterbury.ac.nz!fore057References:
<1990Aug08.001233.6587@hoss.unl.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!comp.vuw.ac.nz!virtue!canterbury.ac.nz!fore057 From: fore057@canterbury.ac.nz Newsgroups: comp.lang.prolog Subject: Re: HELP!! Need a square root function/predicate in Prolog Message-ID: <1990Aug9.182105.8890@canterbury.ac.nz> Date: 9 Aug 12 18:21:04 GMT References: <1990Aug08.001233.6587@hoss.unl.edu> Organization: University of Canterbury Lines: 19