Thread: Anti log in PostgreSQL
Dear all , In one of our project I require to calculate antilog of (3.3234) But I could not find any functions in Documentation for the same. In mathematics I would have written it something like A = antilog (3·3234) = 2144 Any suggestions or links are most welcome . Regards, Vishal Kashyap.
El Vie 26 Dic 2003 19:12, Sai Hertz And Control Systems escribió: > Dear all , > > In one of our project I require to calculate antilog of (3.3234) > But I could not find any functions in Documentation for the same. > > In mathematics I would have written it something like > > A = antilog (3·3234) = 2144 As I can understand, this is a 10 base log, so that what you want is 10^(3.3234)? For that you have the exponential operator ^. -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; ----------------------------------------------------------------- Martín Marqués | mmarques@unl.edu.ar Programador, Administrador, DBA | Centro de Telemática Universidad Nacional del Litoral -----------------------------------------------------------------
Dear Martin Marques , >>In mathematics I would have written it something like >> >>A = antilog (3·3234) = 2144 >> >> > >As I can understand, this is a 10 base log, so that what you want is >10^(3.3234)? > >For that you have the exponential operator ^. > > Nope select exp(3.3234) as a2144 Gives me 27.754555808589792 But the answer expected is some what near to 2144 The log tables show this Regards, Vishal Kashyap.
Sai Hertz And Control Systems wrote: > Dear Martin Marques , > >>> In mathematics I would have written it something like >>> >>> A = antilog (3·3234) = 2144 >>> >> >> >> As I can understand, this is a 10 base log, so that what you want is >> 10^(3.3234)? >> >> For that you have the exponential operator ^. >> >> > Nope > select exp(3.3234) as a2144 > Gives me > 27.754555808589792 > But the answer expected is some what near to 2144 > The log tables show this > > Regards, > Vishal Kashyap. > What is the mathematical operation that "antilog" is supposed to perform? Wei
El Vie 26 Dic 2003 19:46, Sai Hertz And Control Systems escribió: > Dear Martin Marques , > > >>In mathematics I would have written it something like > >> > >>A = antilog (3·3234) = 2144 > >> > >> > > > >As I can understand, this is a 10 base log, so that what you want is > >10^(3.3234)? > > > >For that you have the exponential operator ^. > > > > > Nope > select exp(3.3234) as a2144 > Gives me > 27.754555808589792 > But the answer expected is > some what near to 2144 > The log tables show this As I said, log10, not natural logaritm prueba=> select 10^3.3234 AS res; res ------------------2105.71698391175 (1 row) Octave gives me this: octave:1> 10^3.3234 ans = 2105.7 What is 2144? -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; ----------------------------------------------------------------- Martín Marqués | mmarques@unl.edu.ar Programador, Administrador, DBA | Centro de Telemática Universidad Nacional del Litoral -----------------------------------------------------------------
Dear Wei Weng , >> Nope >> select exp(3.3234) as a2144 >> Gives me >> 27.754555808589792 >> But the answer expected is some what near to 2144 >> The log tables show this >> >> Regards, >> Vishal Kashyap. >> > > What is the mathematical operation that "antilog" is supposed to perform? Its going to calculate rate of intrest for an fixed deposit , Iknow theirs other metod also bu theoratically using antilog you get calculations bang corect This is inverse of log Now doing select 1/log(3.3234) does not help _________________ Vishal Kashyap
The antilog of x is 10^x, so all you need to do is used the ^ operator. If you are doing the antilog for some other base, there is formula to do that as well, but I'm forgetting it. Regards, Yasir On Fri, 26 Dec 2003, Martin Marques wrote: > Date: Fri, 26 Dec 2003 19:34:35 -0300 > From: Martin Marques <martin@bugs.unl.edu.ar> > To: aspire420@hotpop.com, > Sai Hertz And Control Systems <sank89@sancharnet.in>, > pgsql-admin@postgresql.org > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] Anti log in PostgreSQL > i> El Vie 26 Dic 2003 19:12, Sai Hertz And Control Systems escribi�: > > Dear all , > > > > In one of our project I require to calculate antilog of (3.3234) > > But I could not find any functions in Documentation for the same. > > > > In mathematics I would have written it something like > > > > A = antilog (3�3234) = 2144 > > As I can understand, this is a 10 base log, so that what you want is > 10^(3.3234)? > > For that you have the exponential operator ^. > > -- > select 'mmarques' || '@' || 'unl.edu.ar' AS email; > ----------------------------------------------------------------- > Mart�n Marqu�s | mmarques@unl.edu.ar > Programador, Administrador, DBA | Centro de Telem�tica > Universidad Nacional > del Litoral > ----------------------------------------------------------------- > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
Sai Hertz And Control Systems <sank89@sancharnet.in> writes: >> What is the mathematical operation that "antilog" is supposed to perform? > Its going to calculate rate of intrest for an fixed deposit , This is not a mathematical operation, it is a financial issue that has to conform to rules developed long ago by bankers. The closest thing that PG offers is 10^x, but regression=# select 10^(3.3234); ?column? ------------------2105.71698391175 (1 row) which is not real close to the 2144 that you say you want. The difference must be due to compounding rules, and perhaps also accumulated roundoff in the monetary amounts. I think you will need to write a little function (in plpgsql or your language of choice) that performs the sequence of compounding steps, if you want to get an answer that a banker will like. regards, tom lane
Dear Martin Marques and other kind people out their , >>In mathematics I would have written it something like >> >>A = antilog (3·3234) = 2144 >> >> > >As I can understand, this is a 10 base log, so that what you want is >10^(3.3234)? > > Though antilog did not solve my problem the link below helped me to prove my point to my bankers http://www.ilovemaths.com/3depreciation.htm http://mathforum.org/dr.math/faq/faq.interest.html Thanks a load for the kind help forwarded by you all. Regards, Vishal Kashyap >For that you have the exponential operator ^. > > >
Definition of log (base n) is that log n(x) = y where n^y = x for all values of x and y. n is the base. So a base 10 log would be reversed by doing 10^x=y. If we know x, we use the exponential operation; if we know y we use log(y) = x. For ln (natural logs, base e, e is approx. 2.818), use e^x=y. Hope this explains things. Best Wishes, Chris Travers
On December 26, 2003 06:37 pm, Tom Lane wrote: > accumulated roundoff in the monetary amounts. I think you will > need to write a little function (in plpgsql or your language of > choice) that performs the sequence of compounding steps, if you > want to get an answer that a banker will like. And make sure that you check your local rules. Mortgages are actually calculated differently in Canada and the US. -- D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.