POV-Ray : Newsgroups : povray.general : Problems with the sum() and prod(). (Bug in v3.5 ?) Server Time
17 Nov 2024 21:21:25 EST (-0500)
  Problems with the sum() and prod(). (Bug in v3.5 ?) (Message 1 to 10 of 20)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Tor Olav Kristensen
Subject: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 9 Jan 2003 21:10:03
Message: <web.3e1e2ad581e209a5b417814a0@news.povray.org>
If I have understood the documentation
for the new sum() and prod() functions
right, then POV-Ray v3.5 for Windows
behaves very oddly in some cases.

I have observed two different beahiours:

1)
When I run some code with these
functions, POV-Ray just "hangs" and
does not finish parsing, even if the
calculations are very short. In this
state it does not react when I press
the Stop button.

When I try to close it down, then it
says "POV-Ray is currently rendering -
do you want to stop ?".

If I answer Yes, then POV-Ray closes
down as it should. If I answer No,
then POV-Ray just continues to "hang".

The Pause button is working OK.

2)
When I run some other code with these
functions, POV-Ray finishes but
produces wrong results.


Can anyone confirm this behaviour ?

I have inserted my test code below.

The relevant documentation is here:
http://www.povray.org/documentation/view/140/
(Section 6.1.6.1)

My PC runs Win98SE and has a 166MHz MMX
Pentium processor with 96MB of RAM.


Tor Olav


#version 3.5;


// Test of sum() function

// Hangs. Should have given 1.233701
 #declare Fn = function(x) { sum(i, 1, 2, atan2(1, 1)*atan2(1, 1)) }

// Hangs. Should have given 0
// #declare Fn = function(x) { sum(i, 1, 2, pow(x, i) + pow(x, i)) }

// Hangs. Should have given 0
// #declare Fn = function(x) { sum(i, 1, 2, pow(x, 2)*pow(x, 2)) }

// Hangs. Should have given 4
// #declare Fn = function(x) { sum(i, 1, 2, pow(1, 2) + pow(1, 2)) }

// Finishes, but with wrong result: 66 instead of 17
// #declare Fn = function(x) { sum(i, 1, 2, pow(i, 2)*pow(i, 2)) }

// Finishes, but with wrong result: 2.826822 instead of 1.534895
// #declare Fn = function(x) { sum(i, 1, 2, sin(i)*sin(i)) }

// Finishes, but with wrong result: 2 instead of 0
// #declare Fn = function(x) { sum(i, 1, 2, sin(x)*sin(x)) }


// Test of prod() function

// Hangs. Should have given 0.380504
// #declare Fn = function(x) { prod(i, 1, 2, atan2(1, 1)*atan2(1, 1)) }

// Hangs. Should have given 0
// #declare Fn = function(x) { prod(i, 1, 2, pow(x, i) + pow(x, i)) }

// Hangs. Should have given 0
// #declare Fn = function(x) { prod(i, 1, 2, pow(x, 2)*pow(x, 2)) }

// Hangs. Should have given 4
// #declare Fn = function(x) { prod(i, 1, 2, pow(1, 2) + pow(1, 2)) }

// Finishes, but with wrong result: 128 instead of 16
// #declare Fn = function(x) { prod(i, 1, 2, pow(i, 2)*pow(i, 2)) }

// Finishes, but with wrong result: 1.653644 instead of 0.585451
// #declare Fn = function(x) { prod(i, 1, 2, sin(i)*sin(i)) }

// Finishes with correct result: 0, but gives wrong result for Fn(1)
// #declare Fn = function(x) { prod(i, 1, 2, sin(x)*sin(x)) }



// #declare SumFn = function(A, B) { A + B } // Uncomment for tests below


// Test of sum() function

// Hangs. Should have given 18
// #declare Fn = function(x) { sum(i, 1, 2, SumFn(i, 1)*SumFn(i, 2)) }

// Finishes, but with wrong result: 3 instead of 4
// #declare Fn = function(x) { sum(i, 1, 2, SumFn(x, 1)*SumFn(x, 2)) }

// Finishes, but with wrong result: 4 instead of 7
// #declare Fn = function(x) { sum(i, 1, 2, SumFn(x, 1)*SumFn(i, 2)) }


// Test of prod() function

// Hangs. Should have given 72
// #declare Fn = function(x) { prod(i, 1, 2, SumFn(i, 1)*SumFn(i, 2)) }

// Finishes, but with wrong result: 2 instead of 4
// #declare Fn = function(x) { prod(i, 1, 2, SumFn(x, 1)*SumFn(x, 2)) }

// Finishes, but with wrong result: 3 instead of 12
// #declare Fn = function(x) { prod(i, 1, 2, SumFn(x, 1)*SumFn(i, 2)) }



#debug "\n"
#debug str(Fn(0), 0, -1)
#debug "\n\n"


Post a reply to this message

From: Jaap Frank
Subject: Re: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 10 Jan 2003 10:33:22
Message: <3e1ee7c2$1@news.povray.org>
"Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message
news:web.3e1e2ad581e209a5b417814a0@news.povray.org...
>
> If I have understood the documentation
> for the new sum() and prod() functions
> right, then POV-Ray v3.5 for Windows
> behaves very oddly in some cases.
>
> I have observed two different beahiours:
>
> 1)
> When I run some code with these
> functions, POV-Ray just "hangs" and
> does not finish parsing, even if the
> calculations are very short. In this
> state it does not react when I press
> the Stop button.
>
> When I try to close it down, then it
> says "POV-Ray is currently rendering -
> do you want to stop ?".
>
> If I answer Yes, then POV-Ray closes
> down as it should. If I answer No,
> then POV-Ray just continues to "hang".
>
> The Pause button is working OK.
>
> 2)
> When I run some other code with these
> functions, POV-Ray finishes but
> produces wrong results.
>
>
> Can anyone confirm this behaviour ?
>
> I have inserted my test code below.
>
> The relevant documentation is here:
> http://www.povray.org/documentation/view/140/
> (Section 6.1.6.1)
>
> My PC runs Win98SE and has a 166MHz MMX
> Pentium processor with 96MB of RAM.
>
>
> Tor Olav
>
> [...]

Hello Tor Olav,

I get identical results and have a 450MHz MMX
PIII with 1 GB RAM.

I've tried some different things and I think if a function gives
0 as answer, the sum_function uses 1 instead, for:

#declare Fn = function(x) { sum(i, 1, 2, pow(x, 2)) }

with x =0:        2 instead of 0,

 and sum(i,1,8,pow(x,2))     gives 8 as answer.

There may be wrong more things, but this is what I
discovered so far.

Jaap Frank


Post a reply to this message

From: Jaap Frank
Subject: Re: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 10 Jan 2003 10:36:56
Message: <3e1ee898@news.povray.org>
Forgot to tell: I use Windows ME..


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 10 Jan 2003 13:36:16
Message: <Xns92FFC7EA67D58torolavk@204.213.191.226>
"Jaap Frank" <jjf### [at] xs4allnl> wrote in news:3e1ee7c2$1@news.povray.org:

> 
> "Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message
> news:web.3e1e2ad581e209a5b417814a0@news.povray.org...
>>
>> If I have understood the documentation
>> for the new sum() and prod() functions
>> right, then POV-Ray v3.5 for Windows
>> behaves very oddly in some cases.
>>
>> I have observed two different beahiours:
>>
>> 1)
>> When I run some code with these
>> functions, POV-Ray just "hangs" and
>> does not finish parsing, even if the
>> calculations are very short. In this
>> state it does not react when I press
>> the Stop button.
>>
>> When I try to close it down, then it
>> says "POV-Ray is currently rendering -
>> do you want to stop ?".
>>
>> If I answer Yes, then POV-Ray closes
>> down as it should. If I answer No,
>> then POV-Ray just continues to "hang".
>>
>> The Pause button is working OK.
>>
>> 2)
>> When I run some other code with these
>> functions, POV-Ray finishes but
>> produces wrong results.
>>
>>
>> Can anyone confirm this behaviour ?
>>
>> I have inserted my test code below.
>>
>> The relevant documentation is here:
>> http://www.povray.org/documentation/view/140/
>> (Section 6.1.6.1)
>>
>> My PC runs Win98SE and has a 166MHz MMX
>> Pentium processor with 96MB of RAM.
>>
>>
>> Tor Olav
>>
>> [...]
> 
> Hello Tor Olav,
> 
> I get identical results and have a 450MHz MMX
> PIII with 1 GB RAM.
> 
> I've tried some different things and I think if a function gives
> 0 as answer, the sum_function uses 1 instead, for:
> 
> #declare Fn = function(x) { sum(i, 1, 2, pow(x, 2)) }
> 
> with x =0:        2 instead of 0,
> 
>  and sum(i,1,8,pow(x,2))     gives 8 as answer.
> 
> There may be wrong more things, but this is what I
> discovered so far.

Thank you for verifying this Jaap.

I'm not sure if this is the same
bug as the one described here:

http://news.povray.org/povray.bugreports/26015/

Can anyone tell if it is ?


And have some with a Mac or a
Linux PC tried the examples that
I posted ?


Tor Olav


Post a reply to this message

From: Christoph Hormann
Subject: Re: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 10 Jan 2003 13:59:33
Message: <3E1F1814.B8F7D711@gmx.de>
Tor Olav Kristensen wrote:
> 
> [...]
> 
> And have some with a Mac or a
> Linux PC tried the examples that
> I posted ?

Tested on Linux and found the same problems.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 31 Dec. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 10 Jan 2003 14:03:33
Message: <3e1f1905@news.povray.org>
In article <Xns### [at] 204213191226> , Tor Olav Kristensen
<tor### [at] hotmailcom>  wrote:

> Thank you for verifying this Jaap.
>
> I'm not sure if this is the same
> bug as the one described here:
>
> http://news.povray.org/povray.bugreports/26015/
>
> Can anyone tell if it is ?

No it has absolutely nothing to do with it.

Anyway, I recall discussing this particular problem somewhere with someone
before.  Don't bother about trying to find a pattern in what happens, from a
user perspective you don't stand a chance.  Just don't use those tow
functions for now.

    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: Tor Olav Kristensen
Subject: Re: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 10 Jan 2003 16:45:12
Message: <web.3e1f3e34b49a0ea9b417814a0@news.povray.org>
Thorsten Froehlich wrote:
>In article <Xns### [at] 204213191226> , Tor Olav Kristensen
><tor### [at] hotmailcom>  wrote:
>
>> Thank you for verifying this Jaap.
>>
>> I'm not sure if this is the same
>> bug as the one described here:
>>
>> http://news.povray.org/povray.bugreports/26015/
>>
>> Can anyone tell if it is ?
>
>No it has absolutely nothing to do with it.
>
>Anyway, I recall discussing this particular problem somewhere with someone
>before.  Don't bother about trying to find a pattern in what happens, from a
>user perspective you don't stand a chance.  Just don't use those tow
>functions for now.

OK.

I was hoping that these functions could
come in handy in some parametric surface
macros I'm experimenting with.

Do you want me to post a bug report to
povray.bugreports ?


Tor Olav


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 10 Jan 2003 17:03:37
Message: <3e1f4339$1@news.povray.org>
In article <web.3e1f3e34b49a0ea9b417814a0@news.povray.org> , "Tor Olav 
Kristensen" <tor### [at] hotmailcom> wrote:

> Do you want me to post a bug report to
> povray.bugreports ?

Nope, because that would let people find out about those functions in the
first place. No need to worry anybody ;-)  You seem to be only the second
person to even try them in almost half a year!

    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: Warp
Subject: Re: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 10 Jan 2003 17:14:04
Message: <3e1f45ac@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> Nope, because that would let people find out about those functions in the
> first place. No need to worry anybody ;-)

  Ignorance is bliss. :P

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Jellby
Subject: Re: Problems with the sum() and prod(). (Bug in v3.5 ?)
Date: 10 Jan 2003 17:55:15
Message: <3e1f4f52@news.povray.org>
Thorsten Froehlich wrote:

>> Do you want me to post a bug report to
>> povray.bugreports ?
> 
> Nope, because that would let people find out about those functions in the
> first place. No need to worry anybody ;-)  You seem to be only the second
> person to even try them in almost half a year!

Hmm... I'm using prod() to calculate the factorial, as indicated in the 
docs. Should I be worried or does it work fine with that simple example?

-- 

Linux User #289967 (counter.li.org)
PGP Pub Key ID: 0x01A95F99 (pgp.escomplinux.org)


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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