Question

The sum of the infinite series: f(r) = 1 + r + r4 r3+ is equal to 1/r), if Irl <1 Calculate the sum of the infinite series upCODE IN JAVA to be typed in Eclipse

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE

public class Main {

public static double infiniteSum(double r, int N) {

double sum = 0;

for (int i=0; i<N; i++) {

sum += Math.pow(r, i);

}

return sum;

}

public static void main(String[] args) {

System.out.println("Sum of 5 terms = " + infiniteSum(0.5, 5));

System.out.println("Sum of 15 terms = " + infiniteSum(0.5, 15));

}

}

Add a comment
Know the answer?
Add Answer to:
CODE IN JAVA to be typed in Eclipse The sum of the infinite series: f(r) =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Find the Fourier series of the following function, and calculate the sum of rn. n=1 f(x)...

    Find the Fourier series of the following function, and calculate the sum of rn. n=1 f(x) = 12,2 if 0<r<\ if-1< 0 f(x + 2)-f(x)

  • QUESTION 22 Consider the following Matlab code to produce a series <nzin2 n=1; Mo=-1; Mn=0; while...

    QUESTION 22 Consider the following Matlab code to produce a series <nzin2 n=1; Mo=-1; Mn=0; while Mn>MO Mo=Mn; Mn=Mn+n* (-2); n=n+1; end If the series is infinite, why does the code stop running? d. The series is infinite so the code will not stop running. It must be stopped manually using ctrl + C. The logical evaluation will become false when the terms in the series become so small that the sum does not change relative to the machine precision...

  • * This is for CS 101 Java class. I can only use "while" loops. I cannot...

    * This is for CS 101 Java class. I can only use "while" loops. I cannot use "for", "do-while" or any other repetition method.* d. Create a new project Lab04d. In this part, you are going to compute arctan(x) in radians The following formula approximates the value of arctan(x) using Taylor series expansion: 2k +1 tan-1 (x) = > (-1)" 2k 1 k=0 Depending on the number of terms included in the summation the approximation becomes more accurate Your program...

  • f) Calculate the coefficients of the trigonometric form of the Fourier series numerically in MATLAB and...

    f) Calculate the coefficients of the trigonometric form of the Fourier series numerically in MATLAB and graphically represent the one-sided spectrum (width and phase) frequency for n up to 10 compared to the analytics results. g) From the coefficients of the trigonometric form of the Fourier series , calculate the coefficients of the exposure series and present the two-sided spectrum (width and phase) frequency. h) Find the average and active value of the signal from the Fourier expansion. i) Check...

  • 1, write an m file to determine the sum of the infinite series converges to π2 /6. Do this by com...

    please write matlab code for these questions in matlabplatform 1, write an m file to determine the sum of the infinite series converges to π2 /6. Do this by computing the sum for a) n-100, b) n-1000 and c) n 10000. Do this by assigning n values using logspace command 2. Write an m-file to evaluate the following algebraic formula log( -a f i>a log) sa where t is a number that a user enters and a 100 3. A...

  • 1. Answer the following questions. Justify your answers. a. (8pts) Find the Taylor series for f(x)...

    1. Answer the following questions. Justify your answers. a. (8pts) Find the Taylor series for f(x) = (5x centered at a = 1 using the definition of the Taylor series. Also find the radius of convergence of the series. b. (8pts) Find a power series representation for the function f(x) = 1 5+X C. (4pts) Suppose that the function F is an antiderivative of a function f. How can you obtain the Maclaurin series of F from the Maclaurin series...

  • Need code written for a java eclipse program that will follow the skeleton code. Exams and...

    Need code written for a java eclipse program that will follow the skeleton code. Exams and assignments are weighted You will design a Java grade calculator for this assignment. A user should be able to calculate her/his letter grade in COMS/MIS 207 by inputting their scores obtained on worksheets, assignments and exams into the program. A skeleton code named GradeCompute.java containing the main method and stubs for a few other methods, is provided to you. You must not modify/make changes...

  • Another math problem: It is often convenient to replacea sum by an integral. However, this is...

    Another math problem: It is often convenient to replacea sum by an integral. However, this is an approximation and it is sometimes useful, or needed, to find the "leading corrections" to this approximation. Specifically, one has where j is an integer, and thus Δ-1 formally fu) signifies some function f evaluated for a given value of the integer label j and a is the smallest value j takes. The goal of this problem is to compute the leading terms that...

  • 4. Consider the following partial information about a function f(x): S.x2, 0<x<I, (2-x), 1<x<2. Given that...

    4. Consider the following partial information about a function f(x): S.x2, 0<x<I, (2-x), 1<x<2. Given that the function can be extended and modelled as a Fourier cosine-series: (a) Sketch this extended function in the interval that satisfies: x <4 (b) State the minimum period of this extended function. (C) The general Fourier series is defined as follows: [1 marks] [1 marks] F(x) = 4 + ] Ancos ("E") + ] B, sin("E") [1 marks] State the value of L. (d)...

  • 11.1) a) Verify that the function f(x,y) given below is a joint density function for r...

    11.1) a) Verify that the function f(x,y) given below is a joint density function for r and y: ſ4.ty if 0 <r<1, 0 <y<1 f(x, y) = { 10 otherwise b) For the probability density function above, find the probability that r is greater than 1/2 and y is less than 1/3. 11.2) For the same probability density function f(x,y) as from Problem #1. Find the expected values of r and y. 11.3) a) Let R= [0,5] x [0,2]. For...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT