Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE SOLVE THIS QUESTION WITH R STUDIO WITH RMD Here is the instructions: And here is problem 1: Again, please please follow the instructions above

PLEASE SOLVE THIS QUESTION WITH R STUDIO WITH RMD

Here is the instructions:

image text in transcribed

And here is problem 1:

image text in transcribed

image text in transcribed

image text in transcribed

Again, please please follow the instructions above and solve all (a), (b), and (c) with RSTUDIO

- Your .Rmd file must knit. If your .Rmd file does not knit you will receive (at most) half credit for the assignment. The two most common reason files fail to knit are because of workspace/directory structure issues and because of missing include files. To remedy the first, ensure all of the file paths in your document are relative paths pointing at the current working directory. To remedy the second, simply make sure you upload any and all files you source or include in your .Rmd file. - Your coding should adhere to the tidyverse style guide: https://style.tidyverse.org/. - All pseudocode or flowcharts should be done on separate sheets of paper, but be included, inline as images, in your final markdown document. - Any functions/classes you write should have the corresponding comments as the following format. my_function i - function (x,y,){ \#A short description of the function \#Args: #x : Variable type and dimension \#y: Variable type and dimension \#Return: \#Variable type and dimension Your codes begin here \} To simulate how the computer handle the computation with large floating point numbers we define pqnumber objects to keep large numbers. This object should have four components. The first one is either the integer +1 or the integer 1. It gives the sign of the number. The second and third are p and q. And the fourth component is a vector of p+q+1 integers between zero and nine. For example, we can use the following object x to keep the number 87654.321. x9, this decimal representation cannot be used directly. - So we need a carry-over function that moves the extra digits in the appropriate way. Same as one would do when adding two large numbers on paper. Also we need a special provision for overflow, because the sum of two pqnumber objects can be too big to be a pquumber 3. - Likewise, a subtraction function should have a borrowing function that borrows 10 in the same way as you would do a subtraction with pencil-and-paper. - Your functions should work for both positive and negative pqnumber objects. Both functions should return a pqnumber object with enough p and q to carry the result. - This question accounts for 60% of this assignment. 1add(x,y)=x+y 2 subtract (x,y)=xy 3 Note that the length of a vector in R is stored as signed integers. (c) Multiplication Use your add() function to write a multiplication function multiply (x,y) which can multiply two pqnumber objects x and y. Think about how you would multiply two large numbers by hand and implement that algorithm in R for two pqnumber objects. The function should also return a pqnumber object. Both functions should return a pqnumber object with enough p and q to carry the result. This question accounts for 15% of this assignment. You may demonstrate your three functions using the examples provided in (a). Note: Please attach the flowchart or algorithms for your carry-over, addition, subtraction, borrowing, and multiplication functions. Also, the cases provided here are only for your test. We will use different arguments and objects to try your functions while grading. Therefore, try your best to make your functions efficient, accurate, and robust

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

Students also viewed these Databases questions

Question

what is the inportance of ecomic properity in foreign policy gowls

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago