Re: need help on this problem.




"Ingo R. Homann" <ihomann_spam@xxxxxx> wrote in message
news:43985484$0$27903$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> > Suppose that you have a computer that has 64
>> processors. Write a program to compute Pi in java for that computer.
>> But run it on your computer.
>
> OK, now you can throw the pen yourself, or you can write a simulation that
> simulates how a pen is thrown. There is a x-coord and an angle a which are
> randomly distributed. From x and a you can calculate if the pen crosses
> one of the lines (*). By repeating this N times, you can approximate Pi.
>
> (*) I suppose, for calculating this simulation, you need Pi! ;-)

This last point is the part that confused me the most. I assumed that
you had to simulate throwing the pen, but for this simulation you need Pi,
but since you're trying to compute pi, presumably you don't know Pi yet!

It did not occur to me that perhaps the assignment was to throw the pen
in real life, and then write a computer program that kept track of how many
line-crosses you got, and approximate Pi that way.

I'm also not sure where the "64 processors" part comes into play, unless
this is actually an assignment on parallel programming.

- Oliver


.



Relevant Pages

  • Re: Ingenieurmangel: Nur Gerede oder ist was dran?
    ... mit Spielerein, die keiner braucht, in Java aber schnell ... Die zweite Fraktion war eine Reihe von Studis, die Code bestehend aus Tcl/Tk, Java und shell und Perl und viell. ... ....das NEUE war jedenfalls Bullshit und das Projekt wurde nicht realisiert. ... Es sollte eine Simulation werden, ...
    (de.sci.electronics)
  • Re: Java or C++?
    ... I would like to roughly repeat what James Gosling (Java inventor) said at a lecture I attended: Java is nice because you can work in Java everywhere now - from embedded to desktops to supercomputers and servers. ... Even python is less helpful; ... but C bogs you down with administrative stuff (try converting an int to a string; I found myself googling for an hour!). ... assignment would only do a memory copy ...
    (comp.lang.python)
  • Re: Most SF headline of the day
    ... Java doesn't seem to be working right on the system I'm on ... Programming on digital computers is subject to rounding ... Unless done in cooperation among experts in simulation ... And I *certainly* wouldn't trust one done in Java. ...
    (rec.arts.sf.written)
  • Re: help needed on time-dependent functions!
    ... I know a little bit about Java. ... say one second as a single time ... > assignments (a la simulation), ... and learn how to write a for loop (or ...
    (comp.lang.java.help)
  • Re: Nulling an object
    ... a popped element would be unexpected and, I hope, clearly ... and the stack user should never need to be aware of it, i.e. if he is, ... In fact, assigning "null" to the variable can actually delay collection, because it causes the variable to be used at a later point in the code than without such an assignment. ... It seems entirely possible to me that Java does the same thing. ...
    (comp.lang.java.programmer)