University |
Singapore University of Social Science (SUSS) |

Subject |
FIN312: Mathematics and Programming for FinTech |

^{th}Sep 2023

# FIN312: Mathematics and Programming for FinTech Assignment, SUSS, Singapore The median, mode, and mean are basic statistical functions for data analytics. In this question, you will implement

**1)** The median, mode, and mean are basic statistical functions for data analytics. In this question, you will implement them in pure Python code without importing any packages.

The following notations are used:

- v is a non-empty “list of numbers”
- vm is a non-empty “list of numbers” OR “list of non-empty lists of numbers” where the sub-lists have equal lengths.

**a)** Create a function median(v) which returns the median of v

**b)** Create a function mode (v) that returns a list containing the modes of v. Note that it is possible to have more than one mode, hence we return a list.

**c)** Create a function mean(vm, axis=None) which returns the mean of vm. The return value depends on the value of the axis as follows:

- 0: returns the mean down the rows
- 1: returns the mean across the columns
- None: return the mean of all the entries in vm

**d)** Show the result of your code running against these test cases:

- median(v), modes(v) and mean(v) for

*v = [i for j in (range(1180, 2022, k)*

*for k in (3, 5, 7)) for i in j] *

- mean(vm), mean(vm, 0) and mean(vm, 1) for

*vm = [[11, 12, 13, 14, 15, 16, 17, 18],*

*[21, 22, 23, 24, 25, 26, 27, 28],*

*…*

*[91, 92, 93, 94, 95, 96, 97, 98]]*

##### Stuck with a lot of homework assignments and feeling stressed ? Take professional academic assistance & Get 100% Plagiarism free papers

**2)** In Dice Game, you must run across a 140m bridge before it collapses. You are given two 6- sided dices with these numbers on their faces:

- -8, -7, 1, 2, 7, 8 on the first dice
- -7, -2, 1, 3, 7, 7 on the second dice

At every move, you throw the two dice simultaneously to obtain a score of X which is the product of the top faces of the two dice. You are then required to run forward X meters across the bridge. If unfortunately, X is negative, you need to run backward X meters. You can only make 3 moves before the bridge collapses.

For example, if you throw (8, 7), (2, -2) and (-7, -7), you will have run a total of 101m (since 8 x 7 + 2 x (-2) + (-7) x (-7) = 56 – 4 + 49 = 101). Sadly, this means you will still be on the bridge when it collapses.]

You are not allowed to import any packages in this question unless stated otherwise.

**a)** List the unique scores X you can get per move in ascending order.

**b)** Code a function pmf(x) that returns P(X = x). Compute to 6 decimal places the values.

- P(X = -21)

P(X = -14)

P(X = 14)

P(X = 50)

**c)** Code a function cdf(x) that returns P(X x). Compute to 6 significant figures the values

- P(X<-21)
- P(X<-14)
- P(X< 14)
- P(X < 50)

**d)** What is the probability of you crossing the bridge successfully? Explain your reasoning clearly. Give your answer correct to 6 significant figures.

**e)** Draw and label (using a legend) the step graphs of pmf(x) and cdf(x) for an integer x such that -70< x < 70.

##### Hire a Professional Essay & Assignment Writer for completing your Academic Assessments

- ELG101: Discovering Language Assignment, SUSS, Singapore: Speakers are creative users of the languages they speak. In our everyday interaction
- ELG101: Discovering Language Assignment, SUSS, Singapore: Demonstrate the articulation of the words in the above data set using the International Phonetic
- Principles of Project Management Individual Assignment, SUSS, Singapore: You are appointed a Project Manager in charge of organising and planning a project
- COR2223: Frontiers of Modern Computing Final Written Assignment, SMU, Singapore: Write a short story imagining a future scenario and how one or more of the modern computing technologies
- AC2101: Accounting Recognition and Measurement Assignment, NTU, Singapore: If NTU-C were to record the abovementioned transactions on 31 January, 28 February and 15 March 20×2
- BSE217: Motor Development, Control and Learning Assignment, SUSS, Singapore: Create a rating scale or categories of differentiation to rate the movement proficiencies of the individual
- BSE217: Motor Development, Control and Learning Assignment, SUSS, Singapore: Discuss the main theoretical foundations of Ecological Dynamics Theory
- NCO201: Learn To Learn, Learn For Life Tutor-Marked Assignment 2, SUSS, Singapore: Create a learning plan. Use this template to create your learning plan
- NCO201: Learn To Learn, Learn For Life Tutor-Marked Assignment 2, SUSS, Singapore: Self-reflection is a critical part of learning. By looking back at your process and analysing
- BPM301: LCC and Sustainable Design and Construction Assignment, SUSS, Singapore: A developer is building a new 3-storey sports complex on a 10-year leasehold land

*UP TO*
**15 %**
DISCOUNT