POV-Ray : Newsgroups : povray.general : Stupid math help Server Time: 22 Oct 2017 21:06:54 GMT
  Stupid math help (Message 1 to 3 of 3)  
From: Mike Horvath
Subject: Stupid math help
Date: 10 Nov 2016 18:10:00
Message: <5824b7f8$1@news.povray.org>
I have this formula from Wikipedia:

<math>A_v = </math> <math>\log_2</math> <math>A^2</math>

How do I use this in POV-Ray? What is the correct syntax? Thanks.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Stupid math help
Date: 10 Nov 2016 19:37:28
Message: <5824cc78$1@news.povray.org>
On 11/10/2016 1:10 PM, Mike Horvath wrote:
> I have this formula from Wikipedia:
>
> <math>A_v = </math> <math>\log_2</math> <math>A^2</math>
>
> How do I use this in POV-Ray? What is the correct syntax? Thanks.
>
>
> Mike


Never mind. I guessed the correct syntax.

Mike


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Stupid math help
Date: 11 Nov 2016 03:35:01
Message: <web.58253984c2d2382468fc97e0@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> On 11/10/2016 1:10 PM, Mike Horvath wrote:
> > I have this formula from Wikipedia:
> >
> > <math>A_v = </math> <math>\log_2</math> <math>A^2</math>
> >
> > How do I use this in POV-Ray? What is the correct syntax? Thanks.
> >
> >
> > Mike
>
>
> Never mind. I guessed the correct syntax.

It seems that \log_2 is the binary logarithm, which is not a standard float
function in POV-Ray (AFAIK).

You can get around this by doing something like this:


#declare BinLogFn = function(x) { ln(x)/ln(2) }

#declare Q = 8; // 2^3 = 8
#declare P = BinLogFn(Q);

#debug "\n\n"
#debug concat("2^", str(P, 0, -1), " = ", str(Q, 0, -1))
#debug "\n\n"


- But if you found the correct syntax, then you are probably aware of this.

--
Tor Olav
http://subcube.com


Post a reply to this message

Copyright 2003-2008 Persistence of Vision Raytracer Pty. Ltd.