Log in


It seems that...

« previous entry | next entry »
Feb. 2nd, 2006 | 11:23 am
posted by: soullesshippy in mctcstudents

in order to leave an initial comment, you do need to log in / have a LiveJournal account.
You can reply to someone else's comment w/o logging in, using anonymous.
I just realized this, and it may make this avenue less attractive to some.

Creating a LiveJournal account is relatively quick and painless though, just look at the topright of the screen where it says LogInNow, beneath it is a link to Create account, for those still interested in participating.

Sorry, I just became aware of this nuance today.

Link | Leave a comment | Share

Comments {3}

question on assgn.3, #3

from: anonymous
date: Feb. 5th, 2006 06:39 pm (UTC)

Chris asked a good question about problem 3 on assgn. 3 (see below) and I just sent him this response - I'm putting my response here in case anyone else is confused about that problem in a similar way.

The problem is not stating that the sequence that you specified:
converges to pi. Instead, it is saying that the product of all terms of the form
from n=2 to n=N (N is a stopping value to be specified by the program user), multiplied by 8/(2N-1) will be close to pi.
For example, for N=2, this product = (8/5)*(4^2/3^2)
For N=3, this product = (8/7)*(4^2*6^2)/(3^2*5^2)
For N=4, this product = (8/9)*(4^2*6^2*8^2)/(3^2*5^2*7^2)
If you consider the sequence of these terms, this problem is saying that THAT sequence converges to pi.
In this exercise, you need to write a procedure similar to sum from the book that can be used to accumulate a product, rather than a sum; then, you are to use it to make a procedure that will then calculate the product I described above.
I just looked at your code. Your product procedure looks OK (but it would be more general if you used a fourth parameter, "next", so that the procedure could be used when the next term to be used is something other than the incrementation by one of the previous term). But, your "test" procedure is not quite correct - as described above, you need to acummulate the product (given in the brackets []) FIRST, and then multiply it by 8/(2n-1).

>>> Chris Keller <der.keller@gmail.com> 02/05/06 11:40 AM >>>
Hi Ed - I think I might be interpreting the formula for estimating pi
incorrectly for problem #4 on assignment 3. The way it looks to me is:


Which of course converges to 0 as the degree on the bottom is greater than
the degree on the top.

Is the "n" entered supposed to be any large number?

I've attached my code in case you want to take a look at it.

Thank you,
Chris Keller

Reply | Thread

My first post

from: jonnyh
date: Feb. 21st, 2006 10:17 pm (UTC)

Hey. Just joined. I thought someone might find this source interesting. I got it from:

It works in scheme (assuming you can copy/paste it alright after it posts). It creates some frames and some buttons and does some simple UI stuff. If it doesn't work right after posting, just go to the site I got it from and copy/paste it from there.

(define start (instantiate frame% ("Welcome to the land of land")(x 150)(y 150)(height 300)(width 500)))
(define line1 (instantiate message% ("You find yourself in a room. In this room are a wand and a sword." start)))
(define line2 (instantiate message% ("Obvious exits are North and South. Areas of the room may be hidden." start)))
(instantiate button% () (label "Pick up sword")(parent start)
(callback (lambda (button event) (send sword show #t)(send start show #f))))
(instantiate button% () (label "Pick up wand")(parent start)
(callback (lambda (button event) (send wand show #t)(send start show #f))))
(instantiate button% () (label "Search the room") (parent start)
(callback (lambda (button event) (send gos1 show #t)(send start show #f))))
(send start show #t)
(define sword (instantiate frame% ("You have the sword in hand...")(x 150)(y 150)(height 300)(width 500)))
(define sl1 (instantiate message% ("The sword is heavy, but you know you can wield it in combat." sword)))
(define sl2 (instantiate message% ("Which exit will you take?" sword)))
(define wand (instantiate frame% ("You have the wand in hand...") (x 150)(y 150)(height 300)(width 500)))
(define wn1 (instantiate message% ("You fell great power as you pick up the wand..." wand)))
(define wn2 (instantiate message% ("But the moment is ruined as you fart loudly." wand)))
(define gos1 (instantiate frame% ("Darn but your stupid...")(x 150)(y 150)(height 300)(width 500)))
(define gos1m1 (instantiate message% ("You search the room, setting off several traps. You dead!" gos1)))

Reply | Thread


Re: My first post

from: soullesshippy
date: Feb. 21st, 2006 10:49 pm (UTC)

Awesome! Instantaneous GUI in Scheme!
Off to try and incorporate/understand this,

Reply | Parent | Thread