This assignment is due at noon on 14th December. The submission is on Tabula, and should include code along with scanned copies of any written work.
The work that you submit should be your own work and please show full working where appropriate, as this is necessary to gain full marks.
Each of the rst 10 questions is marked out of 10, and question 11 is out of 25.
If you have general or administrative problems please email me (a.p.chester@warwick.ac.uk).
Let a, b, c, and d denote the following primitive statements: a: Pineapples are a fruit
b: Pigs can y
c: Sharks can swim
d: Rocks are hard
In logic, write the statement \If pineapples are a fruit then sharks can swim and rocks are hard, or if pineapples are not a fruit then pigs can y or rocks are soft”.
Write the truth table for the compound statement.
Using the laws of logic simplify the statement to its most concise form.
Consider the following statements (assume P is the set of all prime numbers): a: All prime numbers larger than 2 are odd and have a divisor of 1
b: All prime numbers larger than 2 are odd and have a divisor of y 2 N
c: A prime number can be made by adding all the elements in one subset of the P
Write them using predicate notation.
Determine their truth values, justifying your answers.
Determine whether each of the following is the power set of a set, where a and b are distinct. If the answer is positive, state the set for which the given set is a power set:
;
f;; fagg
f;; fagg [ ffa; bgg
f;; fagg [ fag
f;; fag; fbg; fag; fa; bgg
What is the aw in the following argument? \For a symmetric relation, R# : X $ X, we can deduce that it is transitive through the existence of x#y and y#x”.
Consider the relation, R : A $ A, where X Y () 8x : x 2 X =) x 2 Y.
Show that R is a partial or a total order?
What are the minimal, maximal, least, or greatest elements of R : P(N) $ P(N)?
For a set X with n elements there are a total of 2n n relations, how many of these are:
Re exive, (b) Symmetric, and (c) Antisymmetric?
Are the two composite functions, f-1 g-1 and (g f)-1 always equal? Show this to be true or provide a counter example.
Show that the set of prime numbers (f8x 2 N : isPrime(x) = Tg) is countably in nite.
From a normal deck of 52 cards (consisting of 4 suits each with 13 values) you are dealt a ve card poker hand of K♥Q♥J|6♦3♥. You can swap some of your cards for new ones taken from the remaining cards in the deck. You are considering two options:
Go for a ush ( ve cards of the same suit, i.e. all ♥).
Go for a straight ( ve consecutive values, i.e. (9,10,J,Q,K) or (10,J,Q,K,A)
What are the probabilities of you improving to a ush by swapping your J| and 6♦, and a straight by swapping your 6♦, and 3♥?
Suppose the probability of contracting a rare tropical disease dengue on a trip to India is 0:0001. Barry, after visiting India feels unwell, complaining to his doctor of severe headaches. The doctor has heard that there have been some cases of dengue reported in India and also knew that 64% of people with dengue complained of severe headaches. There are other causes of severe headaches however and the doctor estimates that the probability of severe headaches in the absence of dengue is 0:6. The doctor ordered a reliable test used to diagnose dengue that returned a positive result 99% of the time when the patient had dengue and only returned a positive result 4% of the time when the patient tested was not su ering from the disease. The test result returned for Barry was positive.
Based on the evidence to date can the doctor conclude that Barry has dengue?
Realising that there are no other symptoms of the disease or any other more accurate tests available, the doctor decides to ask for the test to be repeated. Once again a positive test result is obtained. How, if at all, will this a ect his belief in the diagnosis of dengue?
Can the strategy of repeating the same test over and over again improve his belief in a positive diagnosis of dengue? If so, what is the minimum number of times that the test must be carried out, assuming a positive result each time, for the belief in dengue to be greater than the belief in not dengue?
The value of can be estimated using a Monte-Carlo simulation, by throwing ‘darts’ at a ‘dartboard’. Speci cally, we throw darts in a square centered around the origin and measure their distance to the center. If the darts are thrown uniformly in the square from (-1,-1) to (1,1), this distance is less than 1 with a probability of =4.
You have been provided with Python code that can throw such uniform darts. Adapt this code to throw 1000 darts and estimate , by counting how many have a Euclidean distance of less than 1 to the origin.
What is the 95% con dence interval for your estimate of ?
The code also contains a method to throw darts that are normally distributed (with a mean of 0 and a standard deviation of 0:6 in both dimensions). Throw 1000 normally distributed darts and compute by counting how many have a Euclidean distance of less than 1 to the origin. Is this estimate of signi cantly di erent to the estimate made in part (a)?
Please submit your adapted code in one le with clear comments describing how it works, and write a short report on your methods and ndings.
Do not import any extra packages into your code.
You should implement your own statistical tests.