Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Task 3 Compare Results (part 1)
#1
These are whatever, use Scott's below for better tests.

Make the following bash script test3.sh:
Code:
#!/bin/bash
echo "(0.0 0.0 100)" > task3.args
scam -r task3.scm task3.args > results.text
echo "(-1 10 250)" > task3.args
scam -r task3.scm task3.args >> results.text
echo "(22 22 500)" > task3.args
scam -r task3.scm task3.args >> results.text
echo "(-9 -9 0)" > task3.args
scam -r task3.scm task3.args >> results.text
echo "(0.001 -0.00432 1)" > task3.args
scam -r task3.scm task3.args >> results.text
echo "(0.001 -0.00432 100)" > task3.args
scam -r task3.scm task3.args >> results.text
Run 
Code:
chmod u+x test3.sh
./test3.sh
Compare your results.text with my output:
Code:
100 0 0 0
1 255 3 2
1 255 2 1
0 0 0 0
1 0 0 0
100 0 0 0
UA ACM Vice President
ACM has bi-weekly meetings Tuesdays at 5:15pm
We're UA's best organization for CS majors (website)
Join us on Slack for all kinds of discussion channels (including one for CS403)
Reply
#2
Here's some of my test cases with colors included.
Code:
echo "(-1.2531 0.0402 50)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.57855 0.45625 30)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.57855 0.45625 60)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(0.45 0.45 20)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-1.18627 0.30333 20)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.53712 -0.59262 500)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.53748 -0.59276 1000)" > task3.args
scam -r task3.scm task3.args >> results.txt

Code:
40 73 139 244
30 0 0 0
44 99 183 235
6 224 213 121
20 0 0 0
480 15 30 255
246 236 178 96

As far as finding values for edge cases, find a Mandelbrot set explorer online that shows you X and Y coordinates.  Pick coordinates close to the edges of the fractal.  

This site is cool because it will let you zoom in on a point while animating the iterations used to draw the new window:
http://davidbau.com/mandelbrot/
If you hover on a point, it will give coordinates along with the number of iterations before those values diverged... although I've found that I have different results when there are lots of iterations.  Maybe I'm wrong.  Or maybe it's using a different formula.  Still cool/useful.
Reply
#3
(08-30-2017, 03:04 AM)SSinischo Wrote: Here's some of my test cases with colors included.
Code:
echo "(-1.2531 0.0402 50)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.57855 0.45625 30)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.57855 0.45625 60)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(0.45 0.45 20)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-1.18627 0.30333 20)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.53712 -0.59262 500)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.53748 -0.59276 1000)" > task3.args
scam -r task3.scm task3.args >> results.txt

Code:
40 73 139 244
30 0 0 0
44 99 183 235
6 224 213 121
20 0 0 0
480 15 30 255
246 236 178 96

As far as finding values for edge cases, find a Mandelbrot set explorer online that shows you X and Y coordinates.  Pick coordinates close to the edges of the fractal.  

This site is cool because it will let you zoom in on a point while animating the iterations used to draw the new window:
http://davidbau.com/mandelbrot/
If you hover on a point, it will give coordinates along with the number of iterations before those values diverged... although I've found that I have different results when there are lots of iterations.  Maybe I'm wrong.  Or maybe it's using a different formula.  Still cool/useful.

I am using the proper formulas, but it seems divergence never happens between 0 or 1 and the threshold for me. On your (0.45 0.45 20) example, mine reaches 20 and thinks it is in the Mandelbrot set. Could you possibly share your r and s values at each iteration so I can compare where mine goes wrong? Here are mine for the first few. As you can see, they are getting nowhere near 4.

Code:
r-value                 s-value                 (rxr)+(sxs)
r: 0.000000e+00         s: 0.000000e+00         0.000000e+00
r: 0.4500000000         s: 0.4500000000         0.4050000000
r: 0.4500000000         s: 0.8550000000         0.9335250000
r: -0.0785250000        s: 0.3157222500         0.1058467148
r: 0.3564856365         s: 0.6751008945         0.5828432267
r: 0.1213207913         s: 0.6138075494         0.3914784421
r: 0.0879590267         s: 0.5579798292         0.3190782802
Reply
#4
I get these numbers for (0.45 0.45 20)...

r: 0, s: 0
r: 0.4500000000, s: 0.4500000000
r: 0.4500000000, s: 0.8550000000
r: -0.0785250000, s: 1.2195000000
r: -1.0310140744, s: 0.2584775250
r: 1.4461793906, s: -0.0829879324
r: 2.5345478330, s: 0.2099691251
Reply
#5
Adding in my 2 cents that I got the same results for Scott's test cases.

(
40 73 139 244
30 0 0 0
44 99 183 235
6 224 213 121
20 0 0 0
480 15 30 255
246 236 178 96
)
UA ACM Vice President
ACM has bi-weekly meetings Tuesdays at 5:15pm
We're UA's best organization for CS majors (website)
Join us on Slack for all kinds of discussion channels (including one for CS403)
Reply
#6
I'm getting the same as above:

Code:
40 73 139 244
30 0 0 0
44 99 183 235
6 224 213 121
20 0 0 0
480 15 30 255
246 236 178 96


Question: Did anyone actually solve for the fit parameters: A, k, and p
for
     f(x) = A*cos(k*x + p)
or did everyone guess one and solved for the rest?

Also, does it matter what our main function looks like?
Reply
#7
Your main function should follow the style that's shown in the assignment.

Not being a mathematician, I admit I played around with k until I got the first one to work. Then I pattern-matched for the others.
Reply
#8
(09-01-2017, 02:12 PM)lusth Wrote: Your main function should follow the style that's shown in the assignment.

Not being a mathematician, I admit I played around with k until I got the first one to work. Then I pattern-matched for the others.

Were your fit parameters all integers?

The fact that the color functions must convert its values to integers before returning them means that there is slight leeway in the fit parameters.
For example, for the color function mred
suppose that person A has fit parameters such that
f( (t-1)/2 ) = 180.4

while person B has fit parameters such that
f( (t-1)/2 ) = 180.1

Since the color function will convert these to integers, the color functions of both person A and person B will return 180 and both will technically satisfy the constraints.

However, for other values, it is possible that the differences in their fit parameters will result in a different integer being returned.
Suppose we have x such that person A's function yields f(x) = 50.6, while person B's function yields f(x) = 50.4.
The color function will convert these to 51 and 50, respectively.

This can cause problems in grading, I think.

(Note that I assume the conversion from real to integer is by rounding; however, the problem can still occur with truncation. Consider a case like: f(x) = 50.1 and f(x) = 49.9 )
Reply
#9
My frequency calculations used PI and integers (with care taken that all calculations were real numbered), so I'm not sure how two people could have two different frequency calculations, both being correct. This is why I specified a particular value of PI, because that was the only variable in the frequency calculation (at least, that is my thinking).

I suppose the order of the frequency calculation could affect the final result, if intermediate values are not exactly representable in floating point, but like I said in another post, I may have to grade some things manually if the grading script counts something wrong if it was actually correct.
Reply
#10
(08-30-2017, 03:04 AM)SSinischo Wrote: Here's some of my test cases with colors included.
Code:
echo "(-1.2531 0.0402 50)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.57855 0.45625 30)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.57855 0.45625 60)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(0.45 0.45 20)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-1.18627 0.30333 20)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.53712 -0.59262 500)" > task3.args
scam -r task3.scm task3.args >> results.txt
echo "(-0.53748 -0.59276 1000)" > task3.args
scam -r task3.scm task3.args >> results.txt

Code:
40 73 139 244
30 0 0 0
44 99 183 235
6 224 213 121
20 0 0 0
480 15 30 255
246 236 178 96

As far as finding values for edge cases, find a Mandelbrot set explorer online that shows you X and Y coordinates.  Pick coordinates close to the edges of the fractal.  

This site is cool because it will let you zoom in on a point while animating the iterations used to draw the new window:
http://davidbau.com/mandelbrot/
If you hover on a point, it will give coordinates along with the number of iterations before those values diverged... although I've found that I have different results when there are lots of iterations.  Maybe I'm wrong.  Or maybe it's using a different formula.  Still cool/useful.
Are you testing for divergence when r and s is equal to 0.0? I get one less iteration than all of your results -- other than the ones when the threshold is reached
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)