Results 1 to 4 of 4
- 03-07-2011, 08:05 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 7
- Rep Power
- 0
- 03-07-2011, 11:37 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,589
- Blog Entries
- 7
- Rep Power
- 17
Is n very big? i.e. n > Double.MAX_VALUE. If so you have to approximate those logs. The disadvantage with approximating a log with, say, a Taylor or McLaurin series is that they become quite inaccurate for large values. A way to reduce the inaccuracy is:
log(x+y) == log(y)+log(1+y/x))
for suitable values of x and y when x+y == n. If you can elaborate on this, feel free to reply here.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-08-2011, 03:56 AM #3
Member
- Join Date
- Mar 2011
- Posts
- 7
- Rep Power
- 0
Thank you josAH for quick reply...
n is very big,i.e n>>Double.maxvalue,
actually iam implementing quadratic sieve algorithm for integer factorization problem..
in that i have to find lognloglogn value..
- 03-08-2011, 05:15 AM #4
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
If numerical accuracy is desired (I'm assuming it is), I'd write a log function using the BigInteger and BigDecimal classes directly.
You might consider talking to a mathematician. This function appears to me to be monotonic, and so a gradient descent (Newton-Raphson) approach may work and provide a solution much faster than direct computation.
Similar Threads
-
BigInteger value of
By ccie007 in forum New To JavaReplies: 2Last Post: 09-26-2010, 03:46 PM -
convert BigInteger
By bobo67 in forum New To JavaReplies: 1Last Post: 09-01-2010, 02:00 PM -
BigInteger
By windows.login in forum New To JavaReplies: 8Last Post: 07-13-2010, 01:10 PM -
My own BigInteger class. Need help.
By Dinde in forum New To JavaReplies: 2Last Post: 01-27-2010, 08:49 PM -
how to convert from BigInteger to Hex
By nanaji in forum Advanced JavaReplies: 10Last Post: 05-22-2008, 12:44 PM


LinkBack URL
About LinkBacks


Bookmarks