Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Task 9 Compare Results
#1
Note: The computation converges extremely fast with n. We should probably not share results of computations with n > 2.

Create a test script file test9.sh and place the following code:
Code:
#!/bin/bash
echo "(0)" > results9.txt
echo "(0)" > task9.args
scam -r task9.scm task9.args >> results9.txt
echo "(1)" >> results9.txt
echo "(1)" > task9.args
scam -r task9.scm task9.args >> results9.txt
echo "(2)" >> results9.txt
echo "(2)" > task9.args
scam -r task9.scm task9.args >> results9.txt
cat results9.txt
modify as you please

allow the script to be executed
Code:
chmod u+x test9.sh

then run it:
Code:
./test9.sh

My results:
edit: modified program to output 1 on input of 0 to match example given in spec.
Code:
(0)
mystery returns 1
imystery returns 1
(1)
mystery returns 1.6666666667
imystery returns 1.6666666667
(2)
mystery returns 1.6486486486
imystery returns 1.6486486486
Reply
#2
(09-01-2017, 09:32 PM)james_h Wrote: Note: The computation converges extremely fast with n. We should probably not share results of computations with n > 2.

Correct.
Reply
#3
I noticed that for the case n = 0, your results print 1.0000000000, while the specs print the integer 1. I'm not sure how harshly this will be graded, but I made sure to print an integer in that case.
Reply
#4
(09-08-2017, 11:12 PM)evtilley Wrote: I noticed that for the case n = 0, your results print 1.0000000000, while the specs print the integer 1. I'm not sure how harshly this will be graded, but I made sure to print an integer in that case.

Thanks for pointing that out. I'm going to put that grace period to use now. Tongue
Reply
#5
(09-01-2017, 09:32 PM)james_h Wrote: Note: The computation converges extremely fast with n. We should probably not share results of computations with n > 2.

Create a test script file test9.sh and place the following code:
Code:
#!/bin/bash
echo "(0)" > results9.txt
echo "(0)" > task9.args
scam -r task9.scm task9.args >> results9.txt
echo "(1)" >> results9.txt
echo "(1)" > task9.args
scam -r task9.scm task9.args >> results9.txt
echo "(2)" >> results9.txt
echo "(2)" > task9.args
scam -r task9.scm task9.args >> results9.txt
cat results9.txt
modify as you please

allow the script to be executed
Code:
chmod u+x test9.sh

then run it:
Code:
./test9.sh

My results:
Code:
(0)
mystery returns 1.0000000000
imystery returns 1.0000000000
(1)
mystery returns 1.6666666667
imystery returns 1.6666666667
(2)
mystery returns 1.6486486486
imystery returns 1.6486486486

My first two output matches with you, however with level 2 I get 1.84848485

????


at this point it is too late for me to change calculation , but would like to have the same results during re submission.
Reply
#6
(09-09-2017, 06:52 PM)mmrahman Wrote:
(09-01-2017, 09:32 PM)james_h Wrote: Note: The computation converges extremely fast with n. We should probably not share results of computations with n > 2.

Create a test script file test9.sh and place the following code:
Code:
#!/bin/bash
echo "(0)" > results9.txt
echo "(0)" > task9.args
scam -r task9.scm task9.args >> results9.txt
echo "(1)" >> results9.txt
echo "(1)" > task9.args
scam -r task9.scm task9.args >> results9.txt
echo "(2)" >> results9.txt
echo "(2)" > task9.args
scam -r task9.scm task9.args >> results9.txt
cat results9.txt
modify as you please

allow the script to be executed
Code:
chmod u+x test9.sh

then run it:
Code:
./test9.sh

My results:
Code:
(0)
mystery returns 1.0000000000
imystery returns 1.0000000000
(1)
mystery returns 1.6666666667
imystery returns 1.6666666667
(2)
mystery returns 1.6486486486
imystery returns 1.6486486486

My output first two matches with you, however with level 2 I get 1.84848485

????

I think mine is correct. You can check with a calculator.
Also note: I changed my program to output 1 instead of 1.00000... when the input is 0 in order to match the example given in the spec.
Reply
#7
(09-09-2017, 06:57 PM)james_h Wrote:
(09-09-2017, 06:52 PM)mmrahman Wrote:
(09-01-2017, 09:32 PM)james_h Wrote: Note: The computation converges extremely fast with n. We should probably not share results of computations with n > 2.

Create a test script file test9.sh and place the following code:
Code:
#!/bin/bash
echo "(0)" > results9.txt
echo "(0)" > task9.args
scam -r task9.scm task9.args >> results9.txt
echo "(1)" >> results9.txt
echo "(1)" > task9.args
scam -r task9.scm task9.args >> results9.txt
echo "(2)" >> results9.txt
echo "(2)" > task9.args
scam -r task9.scm task9.args >> results9.txt
cat results9.txt
modify as you please

allow the script to be executed
Code:
chmod u+x test9.sh

then run it:
Code:
./test9.sh

My results:
Code:
(0)
mystery returns 1.0000000000
imystery returns 1.0000000000
(1)
mystery returns 1.6666666667
imystery returns 1.6666666667
(2)
mystery returns 1.6486486486
imystery returns 1.6486486486

My output first two matches with you, however with level 2 I get 1.84848485

????

I think mine is correct. You can check with a calculator.
Also note: I changed my program to output 1 instead of 1.00000... when the input is 0 in order to match the example given in the spec.

I get 1.6486486486 as well, although when writing that program I remember getting that number a few times. Check to see if you have the order of operations right.
Reply
#8
Thank you both, it is a bit late to change the calculation, during re submission  i will re do the math to match
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)