STAT Homework 1 Solution

$30.00 $24.00

Problem 1 (3 points) Find the numeric answers of the following mathematical expressions (up to 2 decimal places if the answer is not an integer). (a) 6 + 5 4=32 (b) exp   (14 + 13)=(12 + 11)   11+12!p 2 (c)       13!+14   Problem 2 (2 points) The monthly sales figures…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Problem 1 (3 points)

Find the numeric answers of the following mathematical expressions (up to 2 decimal places if the answer is not an integer).

(a)
6 + 5

4=32

(b) exp

 

(14 + 13)=(12 + 11)

 

11+12!p
2

(c)

 

 

 

13!+14

 

Problem 2 (2 points)

The monthly sales figures of Hummer H2 vehicles in the U.S. during 2002 were 2700, 2600, 3050, 2900, 3000, 2500, 2600, 3000, 2800, 3200 2800 3400. Please answer the following questions.

(a) Enter this data into a data vector called H2

(b) Name the data vector with the month abbreviation

(c) What is the total number of Hummer H2 sold in 2002?

(d) Using diff(), find the month with the greatest increase from the previous month, and the month with the greatest decrease from the previous month

Problem 3 (3 points)

Rewrite each code block to comply with the “Homework and Project Code Style Guide” (a)

• <- c( 1 ,-2 ,3 ,-4 ,5 ,100 ) y <- x * – 1

y [ y >0 ]

1
(b)

# create a sequence from 1 to 50 z <- seq (1 ,50)

• test whether an o b s e r v a t i o n is even even <- z %% 2 = = 0

• subset z by the test above

z = z [ even ]

(c)

mean <- function ( x ) {

sum ( x ) / length ( x )

}

 

Problem 4 (2 points)

A twin prime is a prime that has a prime gap of two. Sometimes the term twin prime is used for a pair of twin primes. For example, the five twin prime pairs are (3; 5), (5; 7), (11; 13), (17; 19) and (29; 31). Write a function that returns the number of all twin prime pairs between 1 and a given number n.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2

STAT Homework 1 Solution
$30.00 $24.00