Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Assignment 01 - Discrete Maths BTEC, Essays (university) of Discrete Mathematics

Assignment 01 - Discrete Maths in BTEC Higher National Diploma in Computing

Typology: Essays (university)

2020/2021

Uploaded on 07/12/2022

Vu-Nguyen-73
Vu-Nguyen-73 🇻🇳

4.2

(5)

7 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
0
PROGRAM TITLE: HIGHER NATIONAL DIPLOMA IN COMPUTING
UNIT TITLE: UNIT 18 - DISCRETE MATHS
ASSIGNMENT NUMBER: 01
ASSIGNMENT NAME: SET THEORY AND FUNCTIONS
SUBMISSION DATE:
DATE RECEIVED: …………………………………………….
TUTORIAL LECTURER:
WORD COUNT: ……………………………………………..
STUDENT NAME:
STUDENT ID:
MOBILE NUMBER:
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Assignment 01 - Discrete Maths BTEC and more Essays (university) Discrete Mathematics in PDF only on Docsity!

PROGRAM TITLE: HIGHER NATIONAL DIPLOMA IN COMPUTING

UNIT TITLE: UNIT 18 - DISCRETE MATHS

ASSIGNMENT NUMBER: 01

ASSIGNMENT NAME: SET THEORY AND FUNCTIONS

SUBMISSION DATE:

DATE RECEIVED: …………………………………………….

TUTORIAL LECTURER:

WORD COUNT: ……………………………………………..

STUDENT NAME:

STUDENT ID:

MOBILE NUMBER:

Summative Feedback:

Internal verification:

TABLE OF FIGURES

Figure 1: Set and multiset example ........................................................................................ 6 Figure 2: Function example ................................................................................................. 10

PART 1:

1. Let A and B be two non-empty finite sets. If cardinalities of the sets A , B , and A B are 72, 28, and 13 respectively, find the cardinality of the set AB n ( AB ) = n( A ) + n( B ) – n( AB ) = 72 + 28 - 13 = 87 2. Let A = {nN: 20 ≤ n < 50} and B = {nN: 10 < n ≤ 30}. Suppose C is a set such that CA and CB****. What is the largest possible cardinality of C****? Since: CA and CB <=> CAB => C = {n ∈ N | 20 ≤ n ≤ 30} <=> C ⊆ {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30} = 11 So, the largest possible cardinality of C is 11. 3. C onsider the sets A and B , where A = {3, | B |} and B = {1, | A |, | B |}. What are the sets? If | A| = 1 then B = {1, 1, | B |} and A = {3, | B | = 3} B = {1, 1, | B |} <=> B = {1, | B |} <=> B = {1, 3} => | B | = 2 => Wrong! If | A | = 2 then B = {1, 2, | B| } and A = {3, | B| ≠ 3 } and |B| < 3

import import java.util.ArrayListjava.util.HashSet; ; import import java.util.java.util. ListSet ;; public class public static void Main { main(String[] args){ // Using Set Set companies = new HashSet<>(); companies companies..addadd(("Netflix""Tesla");); companies companies..addadd(("Softbank""Apple"); ); companies System.out.add.println("American Express"(companies.toString); ()); // Using Multiset List peopleName = new ArrayList<>(); peopleName peopleName..addadd(("John""Gary");); peopleName peopleName..addadd(("John""Margaret"); ); peopleName System.out..addprintln("Gary"(peopleName); .toString()); }^ }

And here we have the result, as you can see the names John and Gary can be duplicated on the multiset.

Figure 1 : Set and multiset example

PART 3:

1. Determine whether the following functions are invertible or not. If it is invertible, then find the rule of the inverse f-1 (x)

i. f (x) = x^2 If x = 2, then f(x) = 4 If x = - 2 then f(x) = 4 From two statements above => The function f(x) = x^2 is not one-to-one. So in conclusion, the function is not invertible

ii. f(x) = (^) 𝑥^1

Let y = (^1) 𝑥 with y ≠ 0 <=> x = (^1) 𝑦 <=> x × y = (^1) 𝑦 × y <=> x × y = 1 <=> y = (^1) 𝑥 So the function is invertible and f-1(x) = (^) 𝑥^1

2. Function f(x) = 𝟓 𝟗 (x-32) converts Fahrenheit temperatures into Celsius. What is the function for opposite conversion? Let y = 59 (x-32) <=> 9y = 5x – 160 <=> 9y + 160 = 5x <=> x = 95 y + 32 So the opposite function, which converts Celsius to Fahrenheit is 95 x + 32 where x is the temperature in Celsius. 3. Present the application of function in software engineering? Give a specific programming example The main purpose of any function is to take an input and return the correct output. So by using functions, software developers can make their programs perform tasks from simple to extremely complex involving complicated logic ones. Here is an example of using a function to convert Mile to Kilometer in Java public class final static double Main { MI_TO_KM_CONSTANT = 1.6093; public static void main(String[] args) throws InterruptedException { System System..outout..printlnprintln(("1 mile to km: ""10 miles to km: " + convertMileToKm + convertMileToKm ( 1 ));( 10 )); System System..outout..printlnprintln(("25 miles to km: ""178 mile to km: " ++ convertMileToKmconvertMileToKm (( 25178 ));)); } public static double return mile * MI_TO_KM_CONSTANT convertMileToKm;(double mile){ }^ } And here are the result:

Figure 2 : Function example