0% found this document useful (0 votes)
14 views3 pages

Problem Set - 1

The document outlines a problem set consisting of 21 tasks related to mathematical computations, programming, and data analysis. Tasks include creating vectors, matrices, and functions, as well as performing statistical tests and generating random values. The problems require the use of programming concepts and mathematical principles to solve various scenarios.

Uploaded by

Hồng Anh Tạ
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Problem Set - 1

The document outlines a problem set consisting of 21 tasks related to mathematical computations, programming, and data analysis. Tasks include creating vectors, matrices, and functions, as well as performing statistical tests and generating random values. The problems require the use of programming concepts and mathematical principles to solve various scenarios.

Uploaded by

Hồng Anh Tạ
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Problem Set:

1. Create an object p equal to 3!. Then create another object q equal


to 3 p3 +4 p+ 2. Print absolute difference between p and q.
2. Create a vector of integers between 1 and 50 divisible by 8.
3. Create a vector of length 20 which satisfy the formula: { x 2 +4 x −5≥ 0 }.
Hence print those elements that are multiple of 2.
4. Find the elements of a vector of integers between 1 and 700
divisible by 2 or 7. What is the cardinality of the set?
5. Create a 4 ×10 matrix with the vectors
1 :10 , {2 n+3 , 1 ≤ n≤ 10 } , {(
n n+1 )
2 }
,1< n≤ 11 ,{n mod 7 , n=10 ,11, … , 19 }. Hence

find the row mean and column mean.


6. In how many ways can 7 graduate students be assigned to 1 triple
and 2 double hotel rooms during a conference?
7. For p=2, q=13 positive integers x n= p x n−1 mod q ,generate 15 positive
integers with x 0=6.
8. Generate 20 random values from Poisson distribution with
parameter 5. Write a code to test if the elements are less than or
equal to the mean or not then print the values.
9. Create a vector that represents f ( n )=⌈ n ⌉ +⌊ n/2 ⌋ , n=1, 2 , … ,10. Hence
print the values in reverse order.
10. Construct a bar chart and Pie chart for the following dataset.

11. Six different machines are being considered for use in


manufacturing rubber seals. The machines are being compared
with respect to tensile strength of the product. A random sample of
four seals from each machine is used to determine whether the
mean tensile strength varies from machine to machine. Create a
matrix for four seals with the following information. [round it to 1
decimal place]
Seal 1 follows N(18.7, 16)
Seal 2 follows N(19.1, 4)
Seal 3 follows N(17.9, 25)
Seal 4 follows N(18.5, 9)

Find the tensile strength of the seal 2 in Machine 4.


Find the list of the seals who’s tensile strength less than 15.
Calculate the summary of the data.

12. Create a function to calculate the nth partial sum of a


geometric sequence.
13. Find the probability distribution for the following function:
2
x +4
( )
f x= , x=0 , 1 ,2 , 3. Hence calculate E( X ).
30
14. Use for loop to generate first 15 values of the following
sequence:

15. Use while loop for the above example.


16. Let p, q , and r be the propositions
p : Grizzly bears have been seen in the area; q : Hiking is safe on
the trail; r : Berries are ripe along the trail.
Write these propositions using p, q, and r and logical connectives.
a) Berries are ripe along the trail, but grizzly bears have not been
seen in the area.
b) Grizzly bears have not been seen in the area and hiking on the
trail is safe, but berries are ripe along the trail.
c) It is not safe to hike on the trail, but grizzly bears have not been
seen in the area and the berries along the trail are ripe.
17. If the joint probability distribution of X and Y is given by
xy
f ( x , y )= , for x=1 ,2 , 3 ; y=1 , 2 ,3.
36
Create a matrix of probability distribution function. Hence find the
marginal distributions of X and Y .
18. Create a 4 × 4 matrix of integers by generating random values
from binomial distribution with n=15 , p=0.6 . Define column and row
names. Replace all the elements that exceed 2 standard
deviations from the mean by 100.
19. Use R to produce a vector containing all integers from 1 to
100 that are not divisible by 2, 3, or 7. Hence ignore the first 4
elements.
20. Write a program that uses a loop to find the minimum of a
vector x, without using any predefined functions like min()/sort().
21. Use while loop to generate a sequence of factorial numbers
without using any predefined function.

You might also like