算法作业代写 | Python代写-CS917 Foundations of Computing – Maths and Stats Assignment

本次作业是关于算法作业代写和Python代写
CS917 Foundations of Computing – Maths and Stats Assignment
This assignment is due at noon on 15th 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 first 10 questions is marked out of 10, and question 11 is out of 25.
If you have general or administrative problems please email me ([email protected]).
1. Let a, b, c, and d denote the following primitive statements: a: Pineapples are a fruit
b: Pigs can fly
c: Sharks can swim
d: Rocks are hard
(a) 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 fly or rocks are soft”.
(b) Write the truth table for the compound statement.
(c) Using the laws of logic simplify the statement to its most concise form.
2. 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 ∈ N
c: A prime number can be made by adding all the elements in one subset of the P
(a) Write them using predicate notation.
(b) Determine their truth values, justifying your answers.
3. 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:
(a) ∅
(b) {∅,{a}}
(c) {∅,{a}}∪{{a,b}} (d) {∅,{a}}∪{a}
(e) {∅,{a},{b},{a},{a,b}}
4. What is the flaw 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”.
5. Considertherelation,R⊆ :A↔A,whereX⊆Y ⇐⇒ ∀x:x∈X =⇒ x∈Y.
(a) Show that R≥ is a partial or a total order?
(b) What are the minimal, maximal, least, or greatest elements of R⊆ : N ↔ N?
6. For a set X with n elements there are a total of 2n×n relations, how many of these are: (a) Reflexive, (b) Symmetric, and (c) Antisymmetric?
7. 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.
8. Show that the set of prime numbers ({∀x ∈ N : isPrime(x) = T}) is countably infinite.
9. From a normal deck of 52 cards (consisting of 4 suits each with 13 values) you are dealt a five 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 flush (five cards of the same suit, i.e. all ê).
• Go for a straight (five consecutive values, i.e. (9,10,J,Q,K) or (10,J,Q,K,A)
What are the probabilities of you improving to a flush by swapping your J♣ and 6 , and a straight by swapping your 6 , and 3ê?
10. Suppose that 0.01% of people who visit India contract dengue. Dennis, upon returning from India, is suffering from severe headaches and decides to go to the doctor. The doctor has recently read in a medical journal that 64% of people with dengue complain about severe headaches, but knows there are many other causes of headaches too. In fact, 60% of people with headaches do not have dengue. In any case, beacuse Dennis has recently visited India, the doctor decides to run a test for dengue. The test is known to have a positive result in 99% of the time when the patient has dengue, but also returns a positive result 4% of the time, even in the absence of the disease.
(a) Thetestreturnsapositiveresult,canthedoctorconcludethatDennishasdengue?
(b) Still confused and without any other ideas, the doctor repeats the test, which again has a positive result. How does this affect the diagnosis? (Hint: assume the tests are independent)
(c) Can this strategy of repeating test over and over again improve the diagnosis? If so, how many consecutive positive results would be needed for the doctor to believe Dennis has dengue?
11. The value of π can be estimated using a Monte-Carlo simulation, by throwing ‘darts’ at a ‘dartboard’. Specifically, 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.
(a) 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.
(b) What is the 95% confidence interval for your estimate of π?
(c) 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 π significantly different to the estimate made in part (a)?
Please submit your adapted code in one file with clear comments describing how it works, and write a short report on your methods and findings.
Do not import any extra packages into your code. You should implement your own statistical tests.

发表评论

电子邮件地址不会被公开。 必填项已用*标注