Question

In: Computer Science

in Java, write a program for methods (Secant, False-Position and Modified Secant) for locating roots. Make...

in Java, write a program for methods (Secant, False-Position and Modified Secant) for locating roots. Make sure that you have clever checks in your program to be warned and stop if you have a divergent solution or stop if the solution is very slowly convergent after a maximum number of iterations.

(a) f(x) = 2x3 – 11.7x2 + 17.7x – 5 This function has 3 +ve roots, all of which lie between 0 and 4. Find the roots. Implement the methods until ea < 1%. Let the maximum iterations be 100. For the modified secant method, use δ = 0.01. Plot the graphs for the approximate % relative error for different roots. Each graph should have 5 error curves, one for each method.

(b) f(x) = x + 10 – xcosh(50/x) For this function, plot the % approximate relative error for each method similar to the part (a). Use δ = 0.01 for modified secant method. Figure out the initial points for the other methods. As a hint, the root lies in the interval [120, 130]

Solutions

Expert Solution


Related Solutions

Write a C++ program for all the methods (Bisection, Newton-Raphson, Secant, False-Position, and Modified Secant) for...
Write a C++ program for all the methods (Bisection, Newton-Raphson, Secant, False-Position, and Modified Secant) for locating roots. Make sure that you have clever checks in your program to be warned and stop if you have a divergent solution or stop if the solution is very slowly convergent after a maximum number of iterations.
Program Specifications The built-in Java Math methods make some calculations much easier. Write a program called...
Program Specifications The built-in Java Math methods make some calculations much easier. Write a program called "DoTheMath" that accepts as input three floating-point numbers x, y, and z (define them as double) and outputs several calculations: x to the power of y x to the power of (y to the power of z) The absolute value of x The square root of (x*y to the power of z). Sample Run: Enter the values for x, y, z: -3.7 -3 5...
write a program to make scientific calculator in java
Problem StatementWrite a program that uses the java Math library and implement the functionality of a scientific calculator. Your program should have the following components:1. A main menu listing all the functionality of the calculator.2. Your program should use the switch structure to switch between various options of the calculator. Your Program should also have the provision to handle invalidoption selection by the user.3. Your calculator SHOULD HAVE the following functionalities. You can add any other additional features. PLEASE MAKE...
Write the methods that insert and remove an element at the kth position in Java using...
Write the methods that insert and remove an element at the kth position in Java using recursion (NOT iteration) (Hint for the remove method: we have to recursive position -1 times, and each time we do the recursion, we have to create a method to move the head to the right) public void insertRecursive(int position, int data) { //enter code here } public int removeAtRecursive(int position) { //enter code here } Here is the given class for the Node: public...
Write a java program that asks the user for the starting X and Y position of...
Write a java program that asks the user for the starting X and Y position of a mouse cursor as well as the starting X and Y movement, then prints out its position until X < 0 or X >100 Example 2: Enter the starting X position: 60 Enter the starting Y position: 60 Enter the starting X velocity: 4.7 Enter the starting Y velocity: 1 X:60    Y:60 X:64.7 Y:61 X:69.4 Y:63 X:74.1 Y:65 X:78.8 Y:67 X:83.5 Y:69 X:88.2 Y:71...
3) Create a Java program that uses NO methods, but use scanner: Write a program where...
3) Create a Java program that uses NO methods, but use scanner: Write a program where you will enter the flying distance from one continent to another, you will take the plane in one country, then you will enter miles per gallon and price of gallon and in the end it will calculate how much gas was spend for that distance in miles. Steps: 1) Prompt user to enter the name of country that you are 2) Declare variable to...
Please write a java program that has the following methods in it: (preferably in order)   a...
Please write a java program that has the following methods in it: (preferably in order)   a method to read in the name of a University and pass it back a method to read in the number of students enrolled and pass it back a method to calculate the tuition as 20000 times the number of students and pass it back a method print the name of the University, the number of students enrolled, and the total tuition Design Notes: The...
Write a program in java which is in main and uses no classes, methods, loops or...
Write a program in java which is in main and uses no classes, methods, loops or if statements Ask the user to enter their first name Ask the user to enter their last name Print their initials followed by periods (ie. Clark Kent = C. K.) Print the number of letters in their last name
CIT 149 JAVA 1 program question? Write a program that will use static methods as described...
CIT 149 JAVA 1 program question? Write a program that will use static methods as described in the specifications below. Utilizing the if and else statements, write a program which will calculate a commission based on a two-tiered commission plan of 3% and 7% paid on amounts of $15,000 or less, or over $15,000 in monthly sales by a sales force paid on a commission basis. Use the output specifications below. ? Specifications There will be two classes (separate files)...
write program that develop a Java class Dictionary to support the following public methods of an...
write program that develop a Java class Dictionary to support the following public methods of an abstract data type: public class Dictionary { // insert a (key, value) pair into the Dictionary, key value must be unique, the value is associated with the key; only the last value inserted for a key will be kept public void insert(String key, String value); // return the value associated with the key value public String lookup(String key); // delete the (key, value) pair...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT