* This is for CS 101 Java class. I can only use "while" loops. I cannot use "for", "do-while" or any other repetition method.*
import java.util.Scanner;
public class arctan {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double x, error, precision, steps=0, sum = 0;
System.out.print("Enter x: ");
x=input.nextDouble();
System.out.print("Enter precision: ");
precision=input.nextDouble();
error=1;
while (error>precision)
{
sum=sum+Math.pow(-1, steps)*(Math.pow(x, 2*steps+1))/(2*steps+1);
System.out.print("\nCurrent sum: "+sum);
error=(Math.pow(Math.abs(x), 2*steps+2))/(2*steps+3);
steps+=1;
}
System.out.printf("\n\nComputed with %.1e precision in %.0f steps\n", precision,steps);
System.out.printf("arctan("+x+") = "+sum+" radians");
input.close();
}
}
* This is for CS 101 Java class. I can only use "while" loops. I cannot...
6. (2n) a. Use the AST to show this series converges. b. Approximate the sum by calculating s c. Find a maximum for the absolute value of the error (error]) in this approximation. d. How many terms n must be added (i.e. s,) so that Jerrort .001
6. (2n) a. Use the AST to show this series converges. b. Approximate the sum by calculating s c. Find a maximum for the absolute value of the error (error]) in this approximation....
Consider the following alternating series. (-1)*+ 1 3k k=1 (a) Show that the series satisfies the conditions of the Alternating Series Test. 1 3" Since lim o and an + 1 for all n, the series is convergent (b) How many terms must be added so the error in using the sum S, of the first n terms as an approximation to the sum n=10 X (c) Approximate the sum of the series so that the error is less than...
Only C and D are necessary.
An approximation attributed to both James Gregory (1638-1675) and Goltfried Leibniz (1646-1716) relies 1. tan +.", for-1 <xs 1. on the Taylor series for the inverse tangent (Sectlon 9.3): 3 S 7 a. Substitute x 1 into the Taylor series and write out a series that converges lo a/4. b. Write the first ten terms of the sequence of partial sums for the series. What is the error in the approximation to x/4 using...
We saw in class a result that provides an upper bound for the error approximation of an alternating series by a given partial sum. Applying this result to the alternating series (1)n S = n=3 n (Inn)6 and its partial sum 5 (1)2 S5= compute the corres pond ing upper bound for the error s-s Give your answer to five decimals accuracy Number MIM8
We saw in class a result that provides an upper bound for the error approximation of...
Convince yourself that the Maclaurin Series for cos(x) is:
A. Write a function script called cos_series
that takes that takes as its inputs, x and N and has output given
by the sum in the N-term Maclaurin Series approximation for Cos(x).
Hint: try a “for loop” and set “format long” in
your code. You may use the MATLAB built-in function factorial()
B. Check your code by finding the 2-terms,
3-terms, 4-terms, 5-terms and 6-terms Maclaurin Series
approximations every 30 degrees...
Matlab function to solve an inequality that has a summation problem
on one side. I have to write a function that uses a while loop and
determines the biggest exponent value(k) in the summation out =
symsum(2^i,i,o,k) that exceeds the input n in the inequality out
> n so i need it to test the values of k from 1 on until out is
the closest over n it can be.
this assignment you will write two functions. The first...
Question 11 0/5 points n+1 satisfies all requirements of the Alternating Series Test. (You don't It 2n=1 have to check that - trust me on this one.) (2n+1) (a) Use a calculator to evaluate the partial sum S3 of this series. Give the answer rounded to four decimal places. (b) Estimate the error of using S3 as an approximation to the sum of the series, i.e. estimate the remainder R3. Recall that the remainder estimate of the Alternating Series Test...
2. It is probably evident that the Gregory/Leibniz series
converges very slowly. The reason is that with x = 1, the powers of
x in the Taylor series do not decrease in size. Here is an idea for
obtaining better approximations.
I need help with d, please. Thanks in advance
1, 2. It is probably evident that the Gregory/Leibniz series converges very slowly. The reason is that with the powers ofx in the Taylor series do not decrease in size....
I am confused as to some properties of solving for DFT and DTFT. I am given a series of x[n] values and have to determine the X[k]. The formula for R[k] is sum[x(n)cos(2pi*k*n/N)], which make sense. However, when I plug the values (1, -1, 1, -1) into the equation, I get zeros across the board. Matlab tell me that at k=2, R[2] should be 4, but the only way that make sense is if the summation is an alternating series....
7. (a) Use the well known Maclaurin series expansion for the cosine function: f (x ) = cos x = 1 x? 2! + 4! х 6! + (-1)" (2n)! . * 8! 0 and a substitution to obtain the Maclaurin series expansion for g(x) = cos (x²). Express your formula using sigma notation. (b) Use the Term-by-Term Integration Theorem to obtain an infinite series which converges to: cos(x) dx . y = cos(x²) (c) Use the remainder theorem associated...