Quadrangle >> exampleInViewer baby graphics bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish


Quadrangle >> exampleInViewer

reports an error: MessageNotUnderstood: Quadrangle>>costume.

Squeak 4.1 fresh image.



Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

Igor Stasenko
On 24 April 2010 02:05, Lawson English <[hidden email]> wrote:
>
>
> Quadrangle >> exampleInViewer
>
> reports an error: MessageNotUnderstood: Quadrangle>>costume.
>
> Squeak 4.1 fresh image.
>
>
Ouch... where you dug out this dusty stuff? :)

>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish
Igor Stasenko wrote:

> On 24 April 2010 02:05, Lawson English <[hidden email]> wrote:
>  
>> Quadrangle >> exampleInViewer
>>
>> reports an error: MessageNotUnderstood: Quadrangle>>costume.
>>
>> Squeak 4.1 fresh image.
>>
>>
>>    
> Ouch... where you dug out this dusty stuff? :)
>
>  
Was rummaging around, trying to figure out how to implement a mandelbrot
set thingie, and saw that  example.

Lawson

Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

Levente Uzonyi-2
On Fri, 23 Apr 2010, Lawson English wrote:

> Igor Stasenko wrote:
>> On 24 April 2010 02:05, Lawson English <[hidden email]> wrote:
>>
>>> Quadrangle >> exampleInViewer
>>>
>>> reports an error: MessageNotUnderstood: Quadrangle>>costume.
>>>
>>> Squeak 4.1 fresh image.
>>>
>>>
>>>
>> Ouch... where you dug out this dusty stuff? :)
>>
>>
> Was rummaging around, trying to figure out how to implement a mandelbrot set
> thingie, and saw that  example.

Have a look at: http://squeaksource.com/MandelMorph2.html
It won't load smoothly, because some method has floats which use obsolete
formatting (- 2.5), but after fixing those (remove the space between - and
2.5) you can evaluate this:

MandelMorph2 new openInWorld


Levente

>
> Lawson
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish
Levente Uzonyi wrote:

> On Fri, 23 Apr 2010, Lawson English wrote:
>
>> Igor Stasenko wrote:
>>> On 24 April 2010 02:05, Lawson English <[hidden email]> wrote:
>>>
>>>> Quadrangle >> exampleInViewer
>>>>
>>>> reports an error: MessageNotUnderstood: Quadrangle>>costume.
>>>>
>>>> Squeak 4.1 fresh image.
>>>>
>>>>
>>>>
>>> Ouch... where you dug out this dusty stuff? :)
>>>
>>>
>> Was rummaging around, trying to figure out how to implement a
>> mandelbrot set thingie, and saw that  example.
>
> Have a look at: http://squeaksource.com/MandelMorph2.html
> It won't load smoothly, because some method has floats which use
> obsolete formatting (- 2.5), but after fixing those (remove the space
> between - and 2.5) you can evaluate this:
>
> MandelMorph2 new openInWorld
>
>
> Levente
>
>

Thanks. I'm still a noob though. How do I fix a package that has errors
when I try to load it?


Lawson


Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

Levente Uzonyi-2
On Fri, 23 Apr 2010, Lawson English wrote:

> Levente Uzonyi wrote:
>> On Fri, 23 Apr 2010, Lawson English wrote:
>>
>>> Igor Stasenko wrote:
>>>> On 24 April 2010 02:05, Lawson English <[hidden email]> wrote:
>>>>
>>>>> Quadrangle >> exampleInViewer
>>>>>
>>>>> reports an error: MessageNotUnderstood: Quadrangle>>costume.
>>>>>
>>>>> Squeak 4.1 fresh image.
>>>>>
>>>>>
>>>>>
>>>> Ouch... where you dug out this dusty stuff? :)
>>>>
>>>>
>>> Was rummaging around, trying to figure out how to implement a mandelbrot
>>> set thingie, and saw that  example.
>>
>> Have a look at: http://squeaksource.com/MandelMorph2.html
>> It won't load smoothly, because some method has floats which use obsolete
>> formatting (- 2.5), but after fixing those (remove the space between - and
>> 2.5) you can evaluate this:
>>
>> MandelMorph2 new openInWorld
>>
>>
>> Levente
>>
>>
>
> Thanks. I'm still a noob though. How do I fix a package that has errors when
> I try to load it?

You'll get a Syntax Error window. Fix the code there and press cmd+s on
mac or alt+s on other platforms.
Normally this should be enough, but there's a problem with MC. It's not
able to load methods other than the fixed one for some reason. So I closed
the debugger and merged the package, but rejected the fixed method.
I saved the package and uploaded here:
http://leves.web.elte.hu/squeak/MandelMorph2-ul.3.mcz


Levente

>
>
> Lawson
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish
Levente Uzonyi wrote:

> On Fri, 23 Apr 2010, Lawson English wrote:
>
>> Levente Uzonyi wrote:
>>> On Fri, 23 Apr 2010, Lawson English wrote:
>>>
>>>> Igor Stasenko wrote:
>>>>> On 24 April 2010 02:05, Lawson English <[hidden email]> wrote:
>>>>>
>>>>>> Quadrangle >> exampleInViewer
>>>>>>
>>>>>> reports an error: MessageNotUnderstood: Quadrangle>>costume.
>>>>>>
>>>>>> Squeak 4.1 fresh image.
>>>>>>
>>>>>>
>>>>>>
>>>>> Ouch... where you dug out this dusty stuff? :)
>>>>>
>>>>>
>>>> Was rummaging around, trying to figure out how to implement a
>>>> mandelbrot set thingie, and saw that  example.
>>>
>>> Have a look at: http://squeaksource.com/MandelMorph2.html
>>> It won't load smoothly, because some method has floats which use
>>> obsolete formatting (- 2.5), but after fixing those (remove the
>>> space between - and 2.5) you can evaluate this:
>>>
>>> MandelMorph2 new openInWorld
>>>
>>>
>>> Levente
>>>
>>>
>>
>> Thanks. I'm still a noob though. How do I fix a package that has
>> errors when I try to load it?
>
> You'll get a Syntax Error window. Fix the code there and press cmd+s
> on mac or alt+s on other platforms.
> Normally this should be enough, but there's a problem with MC. It's
> not able to load methods other than the fixed one for some reason. So
> I closed the debugger and merged the package, but rejected the fixed
> method.
> I saved the package and uploaded here:
> http://leves.web.elte.hu/squeak/MandelMorph2-ul.3.mcz
>

Thanks. I had gotten that far with John Dougan's help and tried to save
back to the repository but it wouldn't accept since I lack a password.
   I converted all references of Floats to Fractions just to see if
there was an easy way to give it higher precision but it slowed down to
< Apple ][ speeds when I did that.


Obviously the naive way isn't going to work. I gotta think there's some
glitch with what I did, or incompatibility with the algorithm and
Fractions....

Lawson



Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish
Lawson English wrote:

>
> Thanks. I had gotten that far with John Dougan's help and tried to
> save back to the repository but it wouldn't accept since I lack a
> password.   I converted all references of Floats to Fractions just to
> see if there was an easy way to give it higher precision but it slowed
> down to < Apple ][ speeds when I did that.
>
>
> Obviously the naive way isn't going to work. I gotta think there's
> some glitch with what I did, or incompatibility with the algorithm and
> Fractions....
>
>
Or maybe  things like x^100/y^100   takes a rather long time to calculate...


sigh...


So an arbitrary precision Mandelbrot generator in Squeak isn't going to
be a cakewalk, apparently, or perhaps I'm missing something else obvious.


Lawson





Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

Igor Stasenko
On 24 April 2010 10:55, Lawson English <[hidden email]> wrote:

> Lawson English wrote:
>>
>> Thanks. I had gotten that far with John Dougan's help and tried to save
>> back to the repository but it wouldn't accept since I lack a password.   I
>> converted all references of Floats to Fractions just to see if there was an
>> easy way to give it higher precision but it slowed down to < Apple ][ speeds
>> when I did that.
>>
>>
>> Obviously the naive way isn't going to work. I gotta think there's some
>> glitch with what I did, or incompatibility with the algorithm and
>> Fractions....
>>
>>
> Or maybe  things like x^100/y^100   takes a rather long time to calculate...
>

you can optimize, rather than multiplying x*x*...*x 100 times in a row,

use a power of two numerics.
Given that:
x^y = (x^a)*(x^b)
where y = a+b

so,

x^100 = (x^64)*(x^32)*(x^4)

then, you can reuse an intermediate results of computation i.e:

x2 := x*x.
x4 := x2*x2.
x8 := x4*x4.
x16 := x8*x8.
x32 := x16*x16.
x64 := x32*x32.

result := x64*x32*x4.

so, totally 8 multiplications, instead of 100.

>
> sigh...
>
>
> So an arbitrary precision Mandelbrot generator in Squeak isn't going to be a
> cakewalk, apparently, or perhaps I'm missing something else obvious.
>
>
> Lawson
>

--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish
Igor Stasenko wrote:

> On 24 April 2010 10:55, Lawson English <[hidden email]> wrote:
>  
>> Lawson English wrote:
>>    
>>> Thanks. I had gotten that far with John Dougan's help and tried to save
>>> back to the repository but it wouldn't accept since I lack a password.   I
>>> converted all references of Floats to Fractions just to see if there was an
>>> easy way to give it higher precision but it slowed down to < Apple ][ speeds
>>> when I did that.
>>>
>>>
>>> Obviously the naive way isn't going to work. I gotta think there's some
>>> glitch with what I did, or incompatibility with the algorithm and
>>> Fractions....
>>>
>>>
>>>      
>> Or maybe  things like x^100/y^100   takes a rather long time to calculate...
>>
>>    
>
> you can optimize, rather than multiplying x*x*...*x 100 times in a row,
>
> use a power of two numerics.
> Given that:
> x^y = (x^a)*(x^b)
> where y = a+b
>
> so,
>
> x^100 = (x^64)*(x^32)*(x^4)
>
> then, you can reuse an intermediate results of computation i.e:
>
> x2 := x*x.
> x4 := x2*x2.
> x8 := x4*x4.
> x16 := x8*x8.
> x32 := x16*x16.
> x64 := x32*x32.
>
> result := x64*x32*x4.
>
> so, totally 8 multiplications, instead of 100.
>
>  
>
Interesting. I'm not quite sure if it would work for colorizing the M
set boundaries though, since that is typically done based on the number
of iterations before the number goes out of bounds.

I guess a logarithmic index could be used for  the color table instead
of a linear index...

I worked out a simple way to truncate calculations to an arbitrary
number of digits.  Unless my algorithm is wrong, I can do 100 recursive
Complex>>squared calculations at 1000 decimal points of precision in
only 17 seconds (i.e. 100TimesRepeat: ["z := z^2"]). Which is a tad too
slow for the M set.
[ b:= b*b. b real: (ScaledDecimal readFrom: (b real)asString).   b
imaginary: (ScaledDecimal readFrom: (b imaginary) asString)]

where the  real and imaginary  were already set as scaledDecimal: 1000

so a test after each new run would give 7 levels of color for z^128 and
run 12 times faster.

only 1.4 seconds per pixel. Getting close... ;-)


Lawson







Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish
Lawson English wrote:

> Igor Stasenko wrote:
>> On 24 April 2010 10:55, Lawson English <[hidden email]> wrote:
>>  
>>> Lawson English wrote:
>>>    
>>>> Thanks. I had gotten that far with John Dougan's help and tried to
>>>> save
>>>> back to the repository but it wouldn't accept since I lack a
>>>> password.   I
>>>> converted all references of Floats to Fractions just to see if
>>>> there was an
>>>> easy way to give it higher precision but it slowed down to < Apple
>>>> ][ speeds
>>>> when I did that.
>>>>
>>>>
>>>> Obviously the naive way isn't going to work. I gotta think there's
>>>> some
>>>> glitch with what I did, or incompatibility with the algorithm and
>>>> Fractions....
>>>>
>>>>
>>>>      
>>> Or maybe  things like x^100/y^100   takes a rather long time to
>>> calculate...
>>>
>>>    
>>
>> you can optimize, rather than multiplying x*x*...*x 100 times in a row,
>>
>> use a power of two numerics.
>> Given that:
>> x^y = (x^a)*(x^b)
>> where y = a+b
>>
>> so,
>>
>> x^100 = (x^64)*(x^32)*(x^4)
>>
>> then, you can reuse an intermediate results of computation i.e:
>>
>> x2 := x*x.
>> x4 := x2*x2.
>> x8 := x4*x4.
>> x16 := x8*x8.
>> x32 := x16*x16.
>> x64 := x32*x32.
>>
>> result := x64*x32*x4.
>>
>> so, totally 8 multiplications, instead of 100.
>>
>>  
>
my bad. The algorithm for the M set is  recursive, 100 timesRepeat: [z:=
z squared]

so you're not talking z^100 but z^2^100.  which is why I truncated it to
1000 decimals...

> where the  real and imaginary  were already set as scaledDecimal: 1000
>
> so a test after each new run would give 7 levels of color for z^128
> and run 12 times faster.
>
> only 1.4 seconds per pixel. Getting close... ;-)
>
>
> Lawson
>
>
>
>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

Levente Uzonyi-2
In reply to this post by LawsonEnglish
On Sun, 25 Apr 2010, Lawson English wrote:

> Igor Stasenko wrote:
>> On 24 April 2010 10:55, Lawson English <[hidden email]> wrote:
>>
>>> Lawson English wrote:
>>>
>>>> Thanks. I had gotten that far with John Dougan's help and tried to save
>>>> back to the repository but it wouldn't accept since I lack a password.
>>>> I
>>>> converted all references of Floats to Fractions just to see if there was
>>>> an
>>>> easy way to give it higher precision but it slowed down to < Apple ][
>>>> speeds
>>>> when I did that.
>>>>
>>>>
>>>> Obviously the naive way isn't going to work. I gotta think there's some
>>>> glitch with what I did, or incompatibility with the algorithm and
>>>> Fractions....
>>>>
>>>>
>>>>
>>> Or maybe  things like x^100/y^100   takes a rather long time to
>>> calculate...
>>>
>>>
>>
>> you can optimize, rather than multiplying x*x*...*x 100 times in a row,
>>
>> use a power of two numerics.
>> Given that:
>> x^y = (x^a)*(x^b)
>> where y = a+b
>>
>> so,
>>
>> x^100 = (x^64)*(x^32)*(x^4)
>>
>> then, you can reuse an intermediate results of computation i.e:
>>
>> x2 := x*x.
>> x4 := x2*x2.
>> x8 := x4*x4.
>> x16 := x8*x8.
>> x32 := x16*x16.
>> x64 := x32*x32.
>>
>> result := x64*x32*x4.
>>
>> so, totally 8 multiplications, instead of 100.
>>
>>
> Interesting. I'm not quite sure if it would work for colorizing the M set
> boundaries though, since that is typically done based on the number of
> iterations before the number goes out of bounds.
>
> I guess a logarithmic index could be used for  the color table instead of a
> linear index...
>
> I worked out a simple way to truncate calculations to an arbitrary number of
> digits.  Unless my algorithm is wrong, I can do 100 recursive
> Complex>>squared calculations at 1000 decimal points of precision in only 17
> seconds (i.e. 100TimesRepeat: ["z := z^2"]). Which is a tad too slow for the
> M set.
> [ b:= b*b. b real: (ScaledDecimal readFrom: (b real)asString).   b imaginary:
> (ScaledDecimal readFrom: (b imaginary) asString)]

Use [b squared] instead of [b * b], it's faster for Fractions and
ScaledDecimals.

Do not convert the number to string and then to number again, it's just
waste of time.


Levente


>
> where the  real and imaginary  were already set as scaledDecimal: 1000
>
> so a test after each new run would give 7 levels of color for z^128 and run
> 12 times faster.
>
> only 1.4 seconds per pixel. Getting close... ;-)
>
>
> Lawson
>
>
>
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish
Levente Uzonyi wrote:

> On Sun, 25 Apr 2010, Lawson English wrote:
>
>> Igor Stasenko wrote:
>>> On 24 April 2010 10:55, Lawson English <[hidden email]> wrote:
>>>
>>>> Lawson English wrote:
>>>>
>>>>> Thanks. I had gotten that far with John Dougan's help and tried to
>>>>> save
>>>>> back to the repository but it wouldn't accept since I lack a
>>>>> password. I
>>>>> converted all references of Floats to Fractions just to see if
>>>>> there was an
>>>>> easy way to give it higher precision but it slowed down to < Apple
>>>>> ][ speeds
>>>>> when I did that.
>>>>>
>>>>>
>>>>> Obviously the naive way isn't going to work. I gotta think there's
>>>>> some
>>>>> glitch with what I did, or incompatibility with the algorithm and
>>>>> Fractions....
>>>>>
>>>>>
>>>>>
>>>> Or maybe  things like x^100/y^100   takes a rather long time to
>>>> calculate...
>>>>
>>>>
>>>
>>> you can optimize, rather than multiplying x*x*...*x 100 times in a row,
>>>
>>> use a power of two numerics.
>>> Given that:
>>> x^y = (x^a)*(x^b)
>>> where y = a+b
>>>
>>> so,
>>>
>>> x^100 = (x^64)*(x^32)*(x^4)
>>>
>>> then, you can reuse an intermediate results of computation i.e:
>>>
>>> x2 := x*x.
>>> x4 := x2*x2.
>>> x8 := x4*x4.
>>> x16 := x8*x8.
>>> x32 := x16*x16.
>>> x64 := x32*x32.
>>>
>>> result := x64*x32*x4.
>>>
>>> so, totally 8 multiplications, instead of 100.
>>>
>>>
>> Interesting. I'm not quite sure if it would work for colorizing the M
>> set boundaries though, since that is typically done based on the
>> number of iterations before the number goes out of bounds.
>>
>> I guess a logarithmic index could be used for  the color table
>> instead of a linear index...
>>
>> I worked out a simple way to truncate calculations to an arbitrary
>> number of digits.  Unless my algorithm is wrong, I can do 100
>> recursive Complex>>squared calculations at 1000 decimal points of
>> precision in only 17 seconds (i.e. 100TimesRepeat: ["z := z^2"]).
>> Which is a tad too slow for the M set.
>> [ b:= b*b. b real: (ScaledDecimal readFrom: (b real)asString).   b
>> imaginary: (ScaledDecimal readFrom: (b imaginary) asString)]
>
> Use [b squared] instead of [b * b], it's faster for Fractions and
> ScaledDecimals.
>
> Do not convert the number to string and then to number again, it's
> just waste of time.
>
>
> Levente
>
When I tried that, squeak seemed to hang. I was under the impression
that ScaledDecimals are stored internally as Fractions but only reported
as ScaledDecimals, so when you don't do the convert to string and back,
the denominator and numerator precision grow exponentially. Which is Bad.

Lawson

Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish
In reply to this post by Levente Uzonyi-2
Try:


c := Complex real: (1.2 asScaledDecimal:10) imaginary: (1.2
asScaledDecimal:10).

10timesRepeat: [c:= c squared].
c inspect. =>

real:    
16179076657442150770853527851353155726471298091691031267189857182080975646647625504506668234175586148214521889505305242253040644884123843893796453862895583845336242846950815779868456294176417920312278659887541612423662820348021785747119.6681587347s10
imaginary:     0.0000000000s10

see what I mean? You gotta truncate or it takes forever and/or
crashes/hangs squeak.


Lawson

Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

espin
In reply to this post by Igor Stasenko
There is a nice description of exponentiation in SICP:
<a href="http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.4">http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.4

<a href="http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.4">The number of multiplications required is in the order of O(log n) where n is the exponent.

Enjoy the (inspiring) reading...
Bye
Enrico

On Sun, Apr 25, 2010 at 10:54, Igor Stasenko <[hidden email]> wrote:
On 24 April 2010 10:55, Lawson English <[hidden email]> wrote:
> Lawson English wrote:
>>
>> Thanks. I had gotten that far with John Dougan's help and tried to save
>> back to the repository but it wouldn't accept since I lack a password.   I
>> converted all references of Floats to Fractions just to see if there was an
>> easy way to give it higher precision but it slowed down to < Apple ][ speeds
>> when I did that.
>>
>>
>> Obviously the naive way isn't going to work. I gotta think there's some
>> glitch with what I did, or incompatibility with the algorithm and
>> Fractions....
>>
>>
> Or maybe  things like x^100/y^100   takes a rather long time to calculate...
>

you can optimize, rather than multiplying x*x*...*x 100 times in a row,

use a power of two numerics.
Given that:
x^y = (x^a)*(x^b)
where y = a+b

so,

x^100 = (x^64)*(x^32)*(x^4)

then, you can reuse an intermediate results of computation i.e:

x2 := x*x.
x4 := x2*x2.
x8 := x4*x4.
x16 := x8*x8.
x32 := x16*x16.
x64 := x32*x32.

result := x64*x32*x4.

so, totally 8 multiplications, instead of 100.

>
> sigh...
>
>
> So an arbitrary precision Mandelbrot generator in Squeak isn't going to be a
> cakewalk, apparently, or perhaps I'm missing something else obvious.
>
>
> Lawson
>

--
Best regards,
Igor Stasenko AKA sig.




--
Enrico Spinielli
"Do Androids dream of electric sheep?"— Philip K. Dick
"Hear and forget; see and remember;do and understand."—Mitchel Resnick


Reply | Threaded
Open this post in threaded view
|

Re: Quadrangle >> exampleInViewer baby graphics bug

LawsonEnglish
In reply to this post by LawsonEnglish
Lawson English wrote:

> Try:
>
>
> c := Complex real: (1.2 asScaledDecimal:10) imaginary: (1.2
> asScaledDecimal:10).
>
> 10timesRepeat: [c:= c squared].
> c inspect. =>
>
> real:    
> 16179076657442150770853527851353155726471298091691031267189857182080975646647625504506668234175586148214521889505305242253040644884123843893796453862895583845336242846950815779868456294176417920312278659887541612423662820348021785747119.6681587347s10
>
> imaginary:     0.0000000000s10
>
> see what I mean? You gotta truncate or it takes forever and/or
> crashes/hangs squeak.
>
 Of course, that only works for truncating the decimal, but with the M
set algorithm you don't iterate past |z| > 2 anyway.   I use [((z real *
z real) + (z imaginary * z imaginary)<4)] to avoid round off errors from
the internal sqrt calculation...


And I still haven't gotten around to adding etoys behavior to the
original M set morph which was what I was trying to learn how to do
since there's only a few parameters involved as compared to an OGLMorph
with etoys behaviors.

:-/

Lawson