Version française
Home     About     Download     Resources     Contact us    
Browse thread
nth_root of num?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Claude Marche <Claude.Marche@l...>
Subject: Re: nth_root of num?
>>>>> "N Hur" == N Hur <mapnh@maths.bath.ac.uk> writes:

    N Hur> Thank you.

    N Hur> But running your code for example,

    N Hur> 	root_floor 3 (Int 2) (* menaing third_root of 2 *);;
	
    N Hur> gives 1, while what we want is 1.2599210498 ...

Sorry, I misunderstood your question. I though you where interested in
computing the nth root of a big_num. If you are interested in
computing the nth root of a float, I really don't understand why you
are using big nums. 

An algorithm for computing the nth root of a float is easy :

let nth_root n x = exp (log(x)/.(float_of_int n));;

Hope this helps. If it doesn't answer to your question, please explain
your problem more precisely.

- Claude



-- 
| Claude Marché           | mailto:Claude.Marche@lri.fr |
| LRI - Bât. 490          | http://www.lri.fr/~marche/  |
| Université de Paris-Sud | phoneto: +33 1 69 15 64 85  |
| F-91405 ORSAY Cedex     | faxto: +33 1 69 15 65 86    |