exerciseMarch1008

# exerciseMarch1008 - { } public double getReal() { } public...

This preview shows pages 1–4. Sign up to view the full content.

COMP202 Instructor: Ladan Mahabadi March 10, 2008 Turing Machines Turing machines are abstract machines described by Alan Turing in 1936. These simple machines are significant because the Church-Turing Thesis states that that a computing problem can be solved on any computer (or more generally on any reasonable model of computation) if and only if it can be solved on a Turing machine. Write a program that receives two non-negative integers less than 128, stores their bits in two arrays of size 8, subtracts the two and replaces the first number with the result and erases the second number.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
with the result and erases the second number. Fractals: First, create a complex class with limited functionality: public class Complex { private double real; private double imaginary; private double modulus; public Complex() { } public Complex(double rPart, double imPart)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { } public double getReal() { } public double getIm() { } public double getMod() { } public double calcMod(double rPart, double imPart) { } public Complex add(Complex second) { } public Complex mult(Complex second) { } } Now, randomly choose an initial complex number c, and repeat the following operation n number of times where n is a user-input value: Z_i = (Z_{i-1})^2 + c If after 10 iterations, modulus of z_10 is less than 1 continue, otherwise choose another initial c and repeat the process. public class Fractal { private Complex start; private Complex addCons; private Complex current; public Fractal(Complex constant) { //Start from 0 + i0 // Set addCons to be the input constant //Set current to be (start)^2 + addCons } public void move(int iterations) { } public boolean convg() { return (current.getMod() < 1); } }...
View Full Document

## This note was uploaded on 04/14/2008 for the course COMP 202 taught by Professor Verbrugge during the Winter '07 term at McGill.

### Page1 / 4

exerciseMarch1008 - { } public double getReal() { } public...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online