POV-Ray : Newsgroups : povray.advanced-users : Square roots of negative numbers in isosurfaces? Server Time
11 Oct 2026 20:23:41 EDT (-0400)
  Square roots of negative numbers in isosurfaces? (Message 1 to 26 of 26)  
From: Greg M  Johnson
Subject: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 09:00:16
Message: <3879E51F.77B9A241@my-dejanews.com>
How "should" an isosurface respond when there is an undefined region of
space?

I just ran something like
        function{noise3d(x^0.5/constant , y/constant , z/constant}
.  The result is symmetric about the x-axis!

Is this an algorithm mistake?

Did pov just uncover a great secret of mathematics: all this fuss over
the square root of negative numbers was a tempest in a teapot??


Post a reply to this message

From: david sharp
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 10:55:10
Message: <387a00de@news.povray.org>
Greg M. Johnson <gre### [at] my-dejanewscom> wrote in message
news:3879E51F.77B9A241@my-dejanews.com...
> How "should" an isosurface respond when there is an undefined region of
> space?
>
> I just ran something like
>         function{noise3d(x^0.5/constant , y/constant , z/constant}
> .  The result is symmetric about the x-axis!
>
> Is this an algorithm mistake?

*I* wouldn't want to get an error every time I had an isosurface
do (-1)^.5,  but I think this is a very debatable topic.
What would you like the program to do in this case?

The isosurface stuff converts x to absolute value of x
before trying to use the ^. This is just to avoid many floating
point errors.  The isosurface code does the same conversion
before applying sqrt() or ln().
Personally I think its OK, (but perhaps the program should put out
a warning). If you look at isosurface scenes posted in these newsgroups,
you will find a lot of square roots and logs of negative numbers being done,
and a lot of this is probably being done completely oblivious to the
mathematical inconsistency.


Post a reply to this message

From: Ron Parker
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 11:02:27
Message: <387a0293@news.povray.org>
On Mon, 10 Jan 2000 10:55:52 -0500, david sharp wrote:
>The isosurface stuff converts x to absolute value of x
>before trying to use the ^. This is just to avoid many floating
>point errors.  The isosurface code does the same conversion
>before applying sqrt() or ln().

Does it only do that for fractional exponents, or does it also 
do it for odd integer exponents?

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: david sharp
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 11:45:33
Message: <387a0cad@news.povray.org>
david sharp <dsh### [at] interportnet> wrote in message
news:387a0473@news.povray.org...
>
> Ron Parker <ron### [at] povrayorg> wrote in message
> news:387a0293@news.povray.org...
> > On Mon, 10 Jan 2000 10:55:52 -0500, david sharp wrote:
> > >The isosurface stuff converts x to absolute value of x
> > >before trying to use the ^. This is just to avoid many floating
> > >point errors.  The isosurface code does the same conversion
> > >before applying sqrt() or ln().
> >
> > Does it only do that for fractional exponents, or does it also
> > do it for odd integer exponents?
>
> Always.

No, not always. (I should have actually checked before replying)
there is a ffloor test to distinguish integers from fractions.


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 13:53:13
Message: <387A29CF.D6C94973@my-dejanews.com>
Are you sure?

function {noise3d(x ^0.5, y, z)}, I know,  is symmetric about the x=0
plane.
function {noise3d(x^3.0, y, z)}, I will bet, behaves correctly, and has
a kind of symmetry like the curve y=x^3.

There is something "more wrong" here.  If Ron were correct, then x^3
would also be symmetric about x=0.

david sharp wrote:

> david sharp <dsh### [at] interportnet> wrote in message
> news:387a0473@news.povray.org...
> >
> > Ron Parker <ron### [at] povrayorg> wrote in message
> > news:387a0293@news.povray.org...
> > > On Mon, 10 Jan 2000 10:55:52 -0500, david sharp wrote:
> > > >The isosurface stuff converts x to absolute value of x
> > > >before trying to use the ^. This is just to avoid many floating
> > > >point errors.  The isosurface code does the same conversion
> > > >before applying sqrt() or ln().
> > >
> > > Does it only do that for fractional exponents, or does it also
> > > do it for odd integer exponents?
> >
> > Always.
>
> No, not always. (I should have actually checked before replying)
> there is a ffloor test to distinguish integers from fractions.


Post a reply to this message

From: david sharp
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 10 Jan 2000 23:17:20
Message: <387aaed0@news.povray.org>
Greg M. Johnson wrote:
> Are you sure?

Sure about what?

> function {noise3d(x ^0.5, y, z)}, I know,  is symmetric about the x=0
> plane.

Because x^.5 actually does (abs( x))^.5
(calling the C function pow(abs(x),.5) )

> function {noise3d(x^3.0, y, z)}, I will bet, behaves correctly, and has
> a kind of symmetry like the curve y=x^3.

Because x^3.0 actually does x*x*x

> There is something "more wrong" here.  If Ron were correct, then x^3
> would also be symmetric about x=0.

Ron didn't claim x^3 was (abs(x))^3. I  prematurely did claim that, and
I was horribly, sorrowfully, and disgustingly mistaken.


> david sharp wrote:
>
> > david sharp <dsh### [at] interportnet> wrote in message
> > news:387a0473@news.povray.org...
> > >
> > > Ron Parker <ron### [at] povrayorg> wrote in message
> > > news:387a0293@news.povray.org...
> > > > On Mon, 10 Jan 2000 10:55:52 -0500, david sharp wrote:
> > > > >The isosurface stuff converts x to absolute value of x
> > > > >before trying to use the ^. This is just to avoid many floating
> > > > >point errors.  The isosurface code does the same conversion
> > > > >before applying sqrt() or ln().
> > > >
> > > > Does it only do that for fractional exponents, or does it also
> > > > do it for odd integer exponents?
> > >
> > > Always.
> >
> > No, not always. (I should have actually checked before replying)
> > there is a ffloor test to distinguish integers from fractions.
>
>
>


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 11 Jan 2000 15:26:49
Message: <387B913E.9BBE68F1@my-dejanews.com>
Actually, I think that this is what povray does:

if I say,               noise3d (x^a                            ,  y,z)
it processes        noise3d (sign(x)*pow(abs(x),a),  y,z)

I will try to prove this tonight.
[I thought someone had asked what SHOULD it do--was that note deleted?]  If
povray processes the formula above as I described, there's no problem--it was
just a mystery to be solved . . .


david sharp wrote:

> > function {noise3d(x^3.0, y, z)}, I will bet, behaves correctly, and has
> > a kind of symmetry like the curve y=x^3.
>
> Because x^3.0 actually does x*x*x
>
> > There is something "more wrong" here.  If Ron were correct, then x^3
> > would also be symmetric about x=0.
>
> Ron didn't claim x^3 was (abs(x))^3. I  prematurely did claim that, and
> I was horribly, sorrowfully, and disgustingly mistaken.
>


Post a reply to this message

From: Ron Parker
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 11 Jan 2000 15:38:34
Message: <387b94ca@news.povray.org>
On Tue, 11 Jan 2000 15:23:26 -0500, Greg M. Johnson wrote:
>Actually, I think that this is what povray does:
>
>if I say,               noise3d (x^a                            ,  y,z)
>it processes        noise3d (sign(x)*pow(abs(x),a),  y,z)
>
>I will try to prove this tonight.
>[I thought someone had asked what SHOULD it do--was that note deleted?]  If
>povray processes the formula above as I described, there's no problem--it was
>just a mystery to be solved . . .

Well, there's that little problem of x^2+y^2+z^2-1 (threshold 0) not being a 
sphere anymore, but other than that...


-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 12 Jan 2000 08:15:51
Message: <387C7DB8.95F16859@my-dejanews.com>
Okay, how about:

x^a =  sign(x)^int(a) * pow(abs(x), a)      ?

Povray is doing SOMETHING, as it gives me a picture in a mathematically undefined
region of space!  It was driving me crazy to figure out what it was doing  . . .

Ron Parker wrote:

> Well, there's that little problem of x^2+y^2+z^2-1 (threshold 0) not being a
> sphere anymore, but other than that...
>
> --
> These are my opinions.  I do NOT speak for the POV-Team.
> The superpatch: http://www2.fwi.com/~parkerr/superpatch/
> My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: David Fontaine
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 13 Jan 2000 23:41:23
Message: <387EA67E.7CE91E84@faricy.net>
What I think POV *should* do is not include these areas in the graph. Say I
want to graph a hemisphere on my TI-89, I do x^2+y^2+z^2=1, z^2=-x^2-y^2+1,
z=sqrt(1-x^2-y^2), and graph it and it gives me my hemisphere, and the area
*outside* the hemisphere is ignored (not rendered) because it is sqrt(neg).
Because if people want it to work the other way they can always just make
it sqrt(abs(x)) instead of sqrt(x).

--
Homepage: http://www.faricy.net/~davidf/
___     ______________________________
 | \     |_       <dav### [at] faricynet>
 |_/avid |ontaine      <ICQ 55354965>


Post a reply to this message

From: Chris Huff
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 14 Jan 2000 00:02:47
Message: <chrishuff_99-A0DA74.00030614012000@news.povray.org>
In article <387EA67E.7CE91E84@faricy.net>, David Fontaine 
<dav### [at] faricynet> wrote:

> What I think POV *should* do is not include these areas in the graph. Say 
> I
> want to graph a hemisphere on my TI-89, I do x^2+y^2+z^2=1, 
> z^2=-x^2-y^2+1,
> z=sqrt(1-x^2-y^2), and graph it and it gives me my hemisphere, and the 
> area
> *outside* the hemisphere is ignored (not rendered) because it is 
> sqrt(neg).
> Because if people want it to work the other way they can always just make
> it sqrt(abs(x)) instead of sqrt(x).

I think this might be difficult to do, because the isosurface is solved 
by sampling the function at different points. I don't see how it could 
be done.
Then again, it is after midnight now, it is probably just that I am 
tired and not thinking straight.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 14 Jan 2000 17:10:49
Message: <387F9E1B.F3DF1811@my-dejanews.com>
But the point is that pov is doing SOMETHING.  If it finds a definite
isosurface for a mathematically undefined region of space, then povray is in
reality not computing the given function, but converting it to some defined
function. Or there is an error in how it has defined some functions.

perhaps
    x^a = sign(x)^int(a) * abs(x)^a

because
    noise3d(x^3.1, y, z)
gives "something" for negative values of x !

I'm not complaining as much as striving to solve the mystery . . .
Chris Huff wrote:

> In article <387EA67E.7CE91E84@faricy.net>, David Fontaine
> <dav### [at] faricynet> wrote:
>
> > What I think POV *should* do is not include these areas in the graph. Say
> > I
> > want to graph a hemisphere on my TI-89, I do x^2+y^2+z^2=1,
> > z^2=-x^2-y^2+1,
> > z=sqrt(1-x^2-y^2), and graph it and it gives me my hemisphere, and the
> > area
> > *outside* the hemisphere is ignored (not rendered) because it is
> > sqrt(neg).
> > Because if people want it to work the other way they can always just make
> > it sqrt(abs(x)) instead of sqrt(x).
>
> I think this might be difficult to do, because the isosurface is solved
> by sampling the function at different points. I don't see how it could
> be done.
> Then again, it is after midnight now, it is probably just that I am
> tired and not thinking straight.
>
> --
> Chris Huff
> e-mail: chr### [at] yahoocom
> Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 14 Jan 2000 17:16:00
Message: <387F9F51.19F25191@my-dejanews.com>
Yet another possibility, as I jokingly suggested, is that pov has "discovered"
solutions to these functions, and mathematicians and programs like Lotus 123 are
"wussies" for refusing to give an answer to these unorthodox
questions..............

Greg M. Johnson wrote:

> But the point is that pov is doing SOMETHING.  If it finds a definite
> isosurface for a mathematically undefined region of space, then povray is in
> reality not computing the given function, but converting it to some defined
> function. Or there is an error in how it has defined some functions.
>
> perhaps
>     x^a = sign(x)^int(a) * abs(x)^a
>
> because
>     noise3d(x^3.1, y, z)
> gives "something" for negative values of x !
>
> I'm not complaining as much as striving to solve the mystery . . .


Post a reply to this message

From: Chris Huff
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 14 Jan 2000 17:21:35
Message: <chrishuff_99-19A28A.17215614012000@news.povray.org>
In article <387F9E1B.F3DF1811@my-dejanews.com>, 
gre### [at] my-dejanewscom wrote:

> But the point is that pov is doing SOMETHING.  If it finds a definite
> isosurface for a mathematically undefined region of space, then povray is 
> in reality not computing the given function, but converting it to some 
> defined
> function. Or there is an error in how it has defined some functions.

But if it stops when it attempts to sample at an undefined spot, there 
could be defined areas that would be missed or rendered incorrectly.

Maybe there should be a "strict_math" option. If strict_math is on, then 
it will perform the solving operation as it usually does, and then test 
the function at that point using standard math to see if it is defined 
at that point. If it is defined, then count it as an intersection, 
otherwise skip it. That way, the undefined areas would be removed(by a 
kind of customized clipping). And older isosurfaces would still work 
properly, either with the addition of "strict_math off" or by having 
strict_math default to off.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Mike Williams
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 14 Jan 2000 21:20:24
Message: <FslWUEAg43f4EwTB@econym.demon.co.uk>
Wasn't it David Fontaine who wrote:
>What I think POV *should* do is not include these areas in the graph. Say I
>want to graph a hemisphere on my TI-89, I do x^2+y^2+z^2=1, z^2=-x^2-y^2+1,
>z=sqrt(1-x^2-y^2), and graph it and it gives me my hemisphere, and the area
>*outside* the hemisphere is ignored (not rendered) because it is sqrt(neg).
>Because if people want it to work the other way they can always just make
>it sqrt(abs(x)) instead of sqrt(x).

That might be possible when using the function as an isosurface, but
such a function can also be used as a pattern for a pigment or normal.
When a function has no solution in a region of space you could ignore it
if you're using that function to define a surface, but what could you do
if there's a point where the surface exists but the pigment and/or
normal doesn't. E.g.

sphere {0,1
        pigment {
            function {noise3d(x^0.5/K, y/K, z/K)}
            colour_map{[0 rgb <1,0,0>][1 rgb <1,1,0>]}
            }    
        normal {
            function {noise3d(x^0.5/K, y/K, z/K)}
            }
       }     

-- 
Mike Williams + #
Gentleman of Leisure


Post a reply to this message

From: David Fontaine
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 15 Jan 2000 22:45:49
Message: <38813C69.D04DBC9F@faricy.net>
> That might be possible when using the function as an isosurface, but
> such a function can also be used as a pattern for a pigment or normal.
> When a function has no solution in a region of space you could ignore it
> if you're using that function to define a surface, but what could you do
> if there's a point where the surface exists but the pigment and/or
> normal doesn't. E.g.
>
> sphere {0,1
>         pigment {
>             function {noise3d(x^0.5/K, y/K, z/K)}
>             colour_map{[0 rgb <1,0,0>][1 rgb <1,1,0>]}
>             }
>         normal {
>             function {noise3d(x^0.5/K, y/K, z/K)}
>             }
>        }

Well it's up to the user to make a function that doesn't do that. It could issue
a warning and replace it with zero or something.

--
Homepage: http://www.faricy.net/~davidf/
___     ______________________________
 | \     |_       <dav### [at] faricynet>
 |_/avid |ontaine      <ICQ 55354965>


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 17 Jan 2000 07:04:08
Message: <38830469.C475282D@my-dejanews.com>
No problem, but pov is doing SOMETHING.  It makes up its own definition in the
undefined areas. That's the mystery.

what is x^a?



Chris Huff wrote:

> In article <387F9E1B.F3DF1811@my-dejanews.com>,
>
> But if it stops when it attempts to sample at an undefined spot, there
> could be defined areas that would be missed or rendered incorrectly.
>
> Maybe there should be a "strict_math" option. If strict_math is on, then
> it will perform the solving operation as it usually does, and then test
> the function at that point using standard math to see if it is defined
> at that point. If it is defined, then count it as an intersection,
> otherwise skip it. That way, the undefined areas would be removed(by a
> kind of customized clipping). And older isosurfaces would still work
> properly, either with the addition of "strict_math off" or by having
> strict_math default to off.
>
> --
> Chris Huff
> e-mail: chr### [at] yahoocom
> Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Matt Giwer
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 17 Jan 2000 11:54:25
Message: <38834975.C6C381E5@ij.net>
"Greg M. Johnson" wrote:

> No problem, but pov is doing SOMETHING.  It makes up its own definition in the
> undefined areas. That's the mystery.
>
> what is x^a?

    x to the power a or exp( a * log(x) )

    If a = 2 then it would be x*x


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 17 Jan 2000 16:20:44
Message: <388386DC.48C2398@my-dejanews.com>
Matt Giwer wrote:

> "Greg M. Johnson" wrote:
> > what is x^a?
>     x to the power a or exp( a * log(x) )
>     If a = 2 then it would be x*x

Nope.  You cannot take the ln(x) of a negative x! Therefore, that's NOT what povray
is doing!  My guess is

x^a= sign(x)^int(a)* abs(x)^a .

My re-writing of the function is "defined" for all values of x and a, whereas x^a is
NOT.

Again, I hound this point not to attack the giants whose shoulder we stand on--pov
developers--but to have fun at solving a mathematical mystery : what IS pov doing?


Post a reply to this message

From: Ken
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 17 Jan 2000 16:25:00
Message: <3883870C.729B3B58@pacbell.net>
"Greg M. Johnson" wrote:

> Again, I hound this point not to attack the giants whose shoulder we stand on--pov
> developers--but to have fun at solving a mathematical mystery : what IS pov doing?

Perhaps only Mr. Suzuki can answer this question...

-- 
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Ron Parker
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 17 Jan 2000 16:32:09
Message: <38838a59@news.povray.org>
On Mon, 17 Jan 2000 16:17:16 -0500, Greg M. Johnson wrote:

>Again, I hound this point not to attack the giants whose shoulder we stand on--pov
>developers--but to have fun at solving a mathematical mystery : what IS pov doing?


void func_exp_xy(void)
 {
  if (((*calc_stack_top)>0) && ((*calc_stack_top)<16) &&
      (FFLOOR(*calc_stack_top)== *calc_stack_top))
   {
    fint= *(calc_stack_top--);
    ftemp1= (*calc_stack_top);
    for (; fint>1; fint--) (*calc_stack_top)*= ftemp1;
   }
  else
   {
    calc_stack_top--;
    *(calc_stack_top)= pow( *(calc_stack_top),*(calc_stack_top+1));
   }
 }

translated:

in the equation x^y,
if y is an integer between 1 and 15 inclusive
  calculate x^y by multiplying x by itself y times.
otherwise,
  call the C function pow(x,y) and return its result
  directly.


Presumably, pow(x,y) itself does something when presented
with invalid parameters, but what that is isn't specified
in the MSVC documentation.  It may be specified in the ANSI
C spec; I haven't checked.

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 17 Jan 2000 17:26:46
Message: <38839656.3849FE0C@my-dejanews.com>
Thanks.  But the mystery deepens. I found a web page mentioning an ANSI standard:

http://www.thinkage.com/expl/c/lib/pow.html

|  <math.h>
|  z = pow( x, y );
|  Description:
|  "pow" returns "x" to the power "y". If "x" and "y" are both zero, or if "x" is
|  non-positive and "y" is not an integer, "pow" return -HUGE_VAL and sets
|  "errno" to EDO

I have little understanding of this stuff, but pov seems to be doing something
different.


Ron Parker wrote:

> On Mon, 17 Jan 2000 16:17:16 -0500, Greg M. Johnson wrote:
>
> >Again, I hound this point not to attack the giants whose shoulder we stand on--pov
> >developers--but to have fun at solving a mathematical mystery : what IS pov doing?
>
>   call the C function pow(x,y) and return its result
>   directly.
>
> Presumably, pow(x,y) itself does something when presented
> with invalid parameters, but what that is isn't specified
> in the MSVC documentation.  It may be specified in the ANSI
> C spec; I haven't checked.
>
> --
> These are my opinions.  I do NOT speak for the POV-Team.
> The superpatch: http://www2.fwi.com/~parkerr/superpatch/
> My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 17 Jan 2000 19:35:05
Message: <3883b539@news.povray.org>
In article <38838a59@news.povray.org> , ron### [at] povrayorg (Ron Parker)
wrote:

> Presumably, pow(x,y) itself does something when presented
> with invalid parameters,

The docs I have say this:

The macro pow(x,y) returns x raised to the power yx xy.
If x is +0.0 and y is negative, then pow returns +inf and signals divide by
zero.  If x is -0.0, and y is integral and negative, then pow signals divide
by zero and returns +inf if y is even, or -inf if y is odd.
The function pow returns NaN and signals invalid if:
both x and y are 0.0, or
x is +-inf and y is 0.0, or
x is 1.0 and y is +-inf, or
x is -0.0 or negative and y is non-integral.


     Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Matt Giwer
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 18 Jan 2000 00:15:58
Message: <3883F73F.9ED303FD@ij.net>
"Greg M. Johnson" wrote:

> Matt Giwer wrote:
>
> > "Greg M. Johnson" wrote:
> > > what is x^a?
> >     x to the power a or exp( a * log(x) )
> >     If a = 2 then it would be x*x
>
> Nope.  You cannot take the ln(x) of a negative x! Therefore, that's NOT what povray
> is doing!  My guess is

    I do abs(x) when I have such problems. Mathematicians hate me but it usually
works.


> x^a= sign(x)^int(a)* abs(x)^a .

    sign(x) is my second last resort. I'd rather avoid it as it usually does not work
being function specific as to whether or not it works. My last resort is actually
digging into the function and making sense of it.


> My re-writing of the function is "defined" for all values of x and a, whereas x^a is
> NOT.

    The idea of epsilon, for small values of zero, is also a useful compuational
concept. x+.000001 never hurts when folks do theoretical implementations.


> Again, I hound this point not to attack the giants whose shoulder we stand on--pov
> developers--but to have fun at solving a mathematical mystery : what IS pov doing?

    I do not claim to know all the computational tricks, but I think I do. If you are
really into a function you can find more adaptive ways to avoid problems. But I can't
remember the +.000001 trick failing since 1967. You can't publish the trick without
showing it applies but if it works ... So what is your audience?

    I am sure there are but I do not know of any smooth function (not discontinuous
like
1 and 0 binary) that has any problems with evaluation at any point but real zero. And
with a smooth function the small value always works.

    This not new so I guess I am missing your problem. Care to repeat or rephrase?


Post a reply to this message

From: Matt Giwer
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 18 Jan 2000 00:23:38
Message: <3883F90B.CFEC940E@ij.net>
"Greg M. Johnson" wrote:

> Thanks.  But the mystery deepens. I found a web page mentioning an ANSI standard:
>
> http://www.thinkage.com/expl/c/lib/pow.html
>
> |  <math.h>
> |  z = pow( x, y );
> |  Description:
> |  "pow" returns "x" to the power "y". If "x" and "y" are both zero, or if "x" is
> |  non-positive and "y" is not an integer, "pow" return -HUGE_VAL and sets
> |  "errno" to EDO
>
> I have little understanding of this stuff, but pov seems to be doing something
> different.

    If this is the issue, the current vice the older one that POV implements, is like
exp(4096).

    If that guess is valid ... comments?


Post a reply to this message

From: Ron Parker
Subject: Re: Square roots of negative numbers in isosurfaces?
Date: 18 Jan 2000 08:16:10
Message: <3884679a@news.povray.org>
On Tue, 18 Jan 2000 00:16:47 -0500, Matt Giwer wrote:
>    I am sure there are but I do not know of any smooth function (not discontinuous
like
>1 and 0 binary) that has any problems with evaluation at any point but real zero. And
>with a smooth function the small value always works.

Well, sqrt(x) is undefined for all x<0.  But somehow the isosurface patch
manages to deal with that.  I think the reason is that the processors we 
usually run it on keep going on getting a NaN result.  Try running it on 
an alpha and see how quickly it manages to crash.

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

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