Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

By using the MatLab ,please help Use your favorite programming language to code

ID: 3691387 • Letter: B

Question

By using the MatLab ,please help

Use your favorite programming language to code a program that computes the sum of two fractions x_1/y_1 and x_2/y_2 (the inputs) by evaluating x_1/y_1 + x_2/y_2 = x_1 middot y_2 + x_2 middot y_1/y_1 middot y_2 = z, and returning z as an output. I.e. transfer the problem into the programming language (which should be a standard language or met a language in the above sense) such that an interpreter of this language can easily execute the code. Please, first give the name of the language you are using: 7. Use your favorite programming language to code a program that computes sin(x) for a given positive real number x (input) by means of an evaluation of the power series sin(x) = x - 1/3! x^3 + 1/5! x^5 - 1/7! x^7 + -. and such that the thus computed value differs from the exact result by a prescribed very small epsilon only (e.g. epsilon = 10^-4). In that respect, recall that the approximation error can be measured by the Lagrange remainder form R^n = f^(n+1)(xi)/(n + 1)! middot x^n+1. where xi is some value in (0, x), and n is the number of used terms in the power series, (i.e. n + 1 is thus the number of the first term not included in the calculation). I.e. transfer the problem into the programming language (which should be a standard language or meta-language in the above sense) such that, an interpreter of this language can easily execute the code. Please, first give the name of the language you are using:

Explanation / Answer

Answer for question#6

% xi = numerator and yi =denominator
% This function return numerator and denominatro of result as array
function result = sumOfFractions(x1,y1,x2,y2)
    zn = x1 * y2 + x2 * y1
    zd = y1 * y2
    result = [zn zd]
end

disp(sumOfFractions(1,2,4,5))

---output----------------

zn =  13                                                                                                                   

zd =  10                                                                                                                   

result =                                                                                                                   

                                                                                                                           

   13   10                                                                                                                 

                                                                                                                           

   13   10