pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Anti log in PostgreSQL
12+ messages / 8 participants
[nested] [flat]

* Anti log in PostgreSQL
@ 2003-12-26 22:12  Sai Hertz And Control Systems <sank89@sancharnet.in>
  0 siblings, 1 reply; 12+ messages in thread

From: Sai Hertz And Control Systems @ 2003-12-26 22:12 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org; +Cc: pgsql-sql

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.




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Anti log in PostgreSQL
@ 2003-12-26 22:34  Martin Marques <martin@bugs.unl.edu.ar>
  parent: Sai Hertz And Control Systems <sank89@sancharnet.in>
  0 siblings, 3 replies; 12+ messages in thread

From: Martin Marques @ 2003-12-26 22:34 UTC (permalink / raw)
  To: aspire420@hotpop.com, Sai Hertz And Control Systems <sank89@sancharnet.in>; pgsql-admin@postgresql.org; +Cc: pgsql-sql

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
-----------------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: [SQL] Anti log in PostgreSQL
@ 2003-12-26 22:46  Sai Hertz And Control Systems <sank89@sancharnet.in>
  parent: Martin Marques <martin@bugs.unl.edu.ar>
  2 siblings, 3 replies; 12+ messages in thread

From: Sai Hertz And Control Systems @ 2003-12-26 22:46 UTC (permalink / raw)
  To: Martin Marques <martin@bugs.unl.edu.ar>; +Cc: aspire420@hotpop.com; pgsql-admin@postgresql.org; pgsql-sql

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.




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Anti log in PostgreSQL
@ 2003-12-26 22:53  Wei Weng <wweng@kencast.com>
  parent: Sai Hertz And Control Systems <sank89@sancharnet.in>
  2 siblings, 1 reply; 12+ messages in thread

From: Wei Weng @ 2003-12-26 22:53 UTC (permalink / raw)
  To: aspire420@hotpop.com; +Cc: Martin Marques <martin@bugs.unl.edu.ar>; pgsql-admin@postgresql.org; pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Anti log in PostgreSQL
@ 2003-12-26 23:18  Yasir Malik <ymalik@heineken.cs.stevens-tech.edu>
  parent: Martin Marques <martin@bugs.unl.edu.ar>
  2 siblings, 1 reply; 12+ messages in thread

From: Yasir Malik @ 2003-12-26 23:18 UTC (permalink / raw)
  To: pgsql-sql

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
>



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Anti log in PostgreSQL
@ 2003-12-26 23:20  Martin Marques <martin@bugs.unl.edu.ar>
  parent: Sai Hertz And Control Systems <sank89@sancharnet.in>
  2 siblings, 0 replies; 12+ messages in thread

From: Martin Marques @ 2003-12-26 23:20 UTC (permalink / raw)
  To: aspire420@hotpop.com, Sai Hertz And Control Systems <sank89@sancharnet.in>; +Cc: aspire420@hotpop.com; pgsql-admin@postgresql.org; pgsql-sql

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
-----------------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Anti log in PostgreSQL
@ 2003-12-26 23:25  Sai Hertz And Control Systems <sank89@sancharnet.in>
  parent: Wei Weng <wweng@kencast.com>
  0 siblings, 1 reply; 12+ messages in thread

From: Sai Hertz And Control Systems @ 2003-12-26 23:25 UTC (permalink / raw)
  To: Wei Weng <wweng@kencast.com>; +Cc: aspire420@hotpop.com, Martin Marques <martin@bugs.unl.edu.ar>; pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Anti log in PostgreSQL
@ 2003-12-26 23:37  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Sai Hertz And Control Systems <sank89@sancharnet.in>
  0 siblings, 1 reply; 12+ messages in thread

From: Tom Lane @ 2003-12-26 23:37 UTC (permalink / raw)
  To: aspire420@hotpop.com; +Cc: Wei Weng <wweng@kencast.com>; Martin Marques <martin@bugs.unl.edu.ar>; pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Anti log in PostgreSQL
@ 2003-12-27 02:14  Chris Travers <chris@travelamericas.com>
  parent: Yasir Malik <ymalik@heineken.cs.stevens-tech.edu>
  0 siblings, 0 replies; 12+ messages in thread

From: Chris Travers @ 2003-12-27 02:14 UTC (permalink / raw)
  To: Yasir Malik <ymalik@heineken.cs.stevens-tech.edu>; pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: [SQL] Anti log in PostgreSQL
@ 2003-12-27 02:34  David F. Skoll <dfs@roaringpenguin.com>
  parent: Sai Hertz And Control Systems <sank89@sancharnet.in>
  2 siblings, 0 replies; 12+ messages in thread

From: David F. Skoll @ 2003-12-27 02:34 UTC (permalink / raw)
  To: aspire420@hotpop.com; +Cc: pgsql-admin@postgresql.org

On Sat, 27 Dec 2003, Sai Hertz And Control Systems wrote:

> select exp(3.3234) as a2144
> Gives me
> 27.754555808589792

Right.  That's e^3.3234

Try:

	select 10^3.3234;

or:

	select dpow(10, 3.3234);

or even:

	select exp(3.3234 * ln(10.0));

--
David.



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: [SQL] Anti log in PostgreSQL
@ 2003-12-27 06:47  Sai Hertz And Control Systems <sank89@sancharnet.in>
  parent: Martin Marques <martin@bugs.unl.edu.ar>
  2 siblings, 0 replies; 12+ messages in thread

From: Sai Hertz And Control Systems @ 2003-12-27 06:47 UTC (permalink / raw)
  To: Martin Marques <martin@bugs.unl.edu.ar>; +Cc: aspire420@hotpop.com; pgsql-admin@postgresql.org; pgsql-sql

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 ^.
>
>  
>




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Anti log in PostgreSQL
@ 2003-12-27 10:40  D'Arcy J.M. Cain <darcy@druid.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: D'Arcy J.M. Cain @ 2003-12-27 10:40 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; aspire420@hotpop.com; +Cc: Wei Weng <wweng@kencast.com>; Martin Marques <martin@bugs.unl.edu.ar>; pgsql-sql

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.



^ permalink  raw  reply  [nested|flat] 12+ messages in thread


end of thread, other threads:[~2003-12-27 10:40 UTC | newest]

Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-12-26 22:12 Anti log in PostgreSQL Sai Hertz And Control Systems <sank89@sancharnet.in>
2003-12-26 22:34 ` Martin Marques <martin@bugs.unl.edu.ar>
2003-12-26 22:46   ` Sai Hertz And Control Systems <sank89@sancharnet.in>
2003-12-26 22:53     ` Wei Weng <wweng@kencast.com>
2003-12-26 23:25       ` Sai Hertz And Control Systems <sank89@sancharnet.in>
2003-12-26 23:37         ` Tom Lane <tgl@sss.pgh.pa.us>
2003-12-27 10:40           ` D'Arcy J.M. Cain <darcy@druid.net>
2003-12-26 23:20     ` Martin Marques <martin@bugs.unl.edu.ar>
2003-12-27 02:34     ` David F. Skoll <dfs@roaringpenguin.com>
2003-12-26 23:18   ` Yasir Malik <ymalik@heineken.cs.stevens-tech.edu>
2003-12-27 02:14     ` Chris Travers <chris@travelamericas.com>
2003-12-27 06:47   ` Sai Hertz And Control Systems <sank89@sancharnet.in>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox