Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Congratulations for your great site. This site helped me more than university..."

Geography

Where in the world do Tek-Tips members come from?
onlyuros (Programmer)
17 Sep 10 8:41
Aloha,

what would be the way to calculate the square root of a number e.g. A with precision E with formula X(0)=(A+1)/2, X(i)=(X(i-1) + A/X(i-1))/2, i=1,2,... ? Tnx!
joel76 (Programmer)
17 Sep 10 18:43
What have you tried ?
joel76 (Programmer)
17 Sep 10 18:47
You should have written :
X(0)=(1+A/1)/2,
X(i)=(X(i-1) + A/X(i-1))/2.
It is easier to see the recursion.
onlyuros (Programmer)
17 Sep 10 21:20
Ah yes, sorry. I have no idea how to do it since I'm quite new to prolog.
joel76 (Programmer)
18 Sep 10 2:59
You can do it with a predicate of 4 arguments my_square_root/4 .
arg 1 : the number you're looking for the square_root.
arg 2 : epsilon
arg 3 : the current computed value of the square root
arg 3 : the final result

 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close