Answer to Question #301815 in Java | JSP | JSF for Hanif

Question #301815

1.A method called sine,which takes asits only parameter avalue oftype double,and returns a valueof type doubleThe parameter represents anangle expressed inradians,andthe value returned bythe method representsthe trigonometric sine ofthis angleFor example,suppose thefollowingmethod

call isexecuted:double sin=MathAssignment.sine(1.047197551)

After the execution ofthe above method call,thevalue stored invariable sin willbe(approximately)0.866025404,as the sine of 1.047197551radians is approximately 0.866025404Thesine ofan angle x,denoted sinx,canbe calculated usingthe following algorithm:If x<-π,repeatedly add2π toxuntil-π≤x≤π.Conversely,ifx>π,repeatedlysubtract2π

fromxuntil-π≤x≤πYou MUST use 3.141592653589793 as a value for π

Calculate sinx using the following formula:where t0=xTo calculate the other terms in the sum,we usethe following formula:where ti isan arbitrary term,and ti+1 isthe next termFor example:and so onThelast term in this sum,tn,will bethe firstterm whose absolute valueis lessthan10-10


1
Expert's answer
2022-02-23T14:18:03-0500
public class MathAssignment {
    public static double sine(double rad) {
        return Math.sin(rad);
    }

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS