Branches of mechanical engineering: Basic Operations Exercises + Answers - R




This laid upwardly of exercises volition assistance you lot to larn too examination your science amongst basic arithmetical operations too logic functions. Before proceeding, it powerfulness live helpful to hold off over the assistance pages for the **%/%%%, too the logical operators such as !=, ==, >=, isTRUE .
Answers to the exercises are available here.
If you lot obtained a dissimilar (correct) respond than those listed on the solutions page, delight experience costless to shipping service your respond every bit a comment on that page.
Exercise 1
Basic Operations There are 2 top dog dissimilar type of interest, elementary too compound. To showtime let’s do iii variables, southward = 100 (initial investment), i1=.02 (annual elementary interest), i2=.015 (annual chemical compound interest), n=2 (years that the investment volition last).
Simple Interest Define a variable called simple equal to southward (1 + i1 * n)
Compound Interest Define a variable called compound equal to southward x (1 + i2)n
Exercise 2
It’s natural to enquire which type of involvement for this values gives to a greater extent than sum of coin afterwards 2 years (n = 2). Using logical functions <,>, == check which variable is bigger between simple and compound
Exercise 3
Using logical functions <,>, ==, |, & find out if elementary or chemical compound is equal to 120
Using logical functions <,>, ==, |, & find out if elementary too chemical compound is equal to 120
Exercise 4
Formulas tin bargain amongst vectors, then let’s define a vector too utilization it inwards 1 of the formulas nosotros defined earlier. Let’s define southward every bit a vector amongst the next values 100, 96. Remember that c() is the role that allow us to define vectors.
Apply to southward the elementary involvement formula too shop the value of the vector in simple
Exercise 5
Using logical functions <,>, == check if whatsoever of the simple values is smaller or equal to compound
Exercise 6
Using the function %/% find out how many $20 candies tin you lot purchase amongst the coin stored in compound
Exercise 7
Using the function %% find out how much coin is left afterwards buying the candies.
Exercise 8
Let’s do 2 novel variables, ode defined as rational=1/3 and decimal=0.33. Using the logical function !=
Verify if this 2 values are different.
Exercise 9
There are other functions that tin assistance us compare 2 variables.
Use the logical function == verify if rational and decimal are the same.
Use the logical function isTRUE verify if rational and decimal are the same.
Use the logical function identical verify if rational and decimal are the same.
Exercise 10
Using the assistance of the logical functions of the previous practice notice the approximation that R uses for 1/3. Hint: It is non the value that R prints when you lot define 1/3


________________________________________

Below are the solutions to these exercises on Basic operation.
#################### #                  # #    Exercise 1    # #                  # ####################  S <- 100 i1 <- 0.1 i2 <- 0.09 n <- 2  simple <- S*(1 + i1*n)  compound <- S*(1 + i2)**n  #################### #                  # #    Exercise 2    # #                  # ####################  simple>compound 
## [1] TRUE 
#################### #                  # #    Exercise iii    # #                  # ####################  simple>=120|compound>=120 
## [1] TRUE 
simple>=120&compound>=120 
## [1] FALSE 
#################### #                  # #    Exercise four    # #                  # ####################  S <- c(100,95) simple <- S*(1 + i1*n)   #################### #                  # #    Exercise v    # #                  # ####################  simple<=compound 
## [1] FALSE  TRUE 
#################### #                  # #    Exercise six    # #                  # ####################  compound%/%20 
## [1] v 
#################### #                  # #    Exercise seven    # #                  # ####################   compound%%20 
## [1] 18.81 
#################### #                  # #    Exercise 8    # #                  # ####################  rational <- 1/3 decimal <- 0.33  rational!=decimal 
## [1] TRUE 
#################### #                  # #    Exercise nine    # #                  # ####################  rational==decimal 
## [1] FALSE 
isTRUE(rational==decimal) 
## [1] FALSE 
identical(rational,decimal) 
## [1] FALSE 
#################### #                  # #    Exercise 10   # #                  # ####################   1/3==0.3333333333333333 
## [1] TRUE


Sumber http://engdashboard.blogspot.com/

Jangan sampai ketinggalan postingan-postingan terbaik dari Branches of mechanical engineering: Basic Operations Exercises + Answers - R. Berlangganan melalui email sekarang juga:

Bali Attractions

BACA JUGA LAINNYA:

Bali Attractions