1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Veronika [31]
3 years ago
9

Use the Bisection Method to find the root 2. Write a main program and a function program 3. Main Program a. define constants b.

define es c. define function handle for the function you are finding the root for. Note that the function handle you define will be a function of S and t, i.e. f(S,t) d. define Sl and Su e. t will go from 0 days to 40 days. Use 40 values for t f. use a for loop (inside main program) to loop through the values of t (one at a time) to generate a vector for S (one value at a time). Note that each value of t will give a different value for S g. use a convergence criteria corresponding to 6 significant figures h. generate plot of S vs t 4. Function Program an. algorithm for Bisection Method
Computers and Technology
1 answer:
MissTica3 years ago
5 0

Answer:

// C++ program for implementation of Bisection Method for  

// solving equations  

#include<bits/stdc++.h>  

using namespace std;  

#define EPSILON 0.01  

// An example function whose solution is determined using  

// Bisection Method. The function is x^3 - x^2 + 2  

double func(double x)  

{  

return x*x*x - x*x + 2;  

}  

// Prints root of func(x) with error of EPSILON  

void bisection(double a, double b)  

{  

if (func(a) * func(b) >= 0)  

{  

 cout << "You have not assumed right a and b\n";  

 return;  

}  

double c = a;  

while ((b-a) >= EPSILON)  

{  

 // Find middle point  

 c = (a+b)/2;  

 // Check if middle point is root  

 if (func(c) == 0.0)  

  break;  

 // Decide the side to repeat the steps  

 else if (func(c)*func(a) < 0)  

  b = c;  

 else

  a = c;  

}  

cout << "The value of root is : " << c;  

}  

// Driver program to test above function  

int main()  

{  

// Initial values assumed  

double a =-200, b = 300;  

bisection(a, b);  

return 0;  

}  

You might be interested in
You copy several files from one folder to another folder within the same drive. what permissions do the files in the destination
cricket20 [7]
They have the same permissions in the destination folder as in the original folder
3 0
4 years ago
What is meant by reflection?​
lana66690 [7]
It’s something that reflects off something
6 0
3 years ago
Read 2 more answers
How can the IOSP model help us to design an app that solves a problem?
docker41 [41]

Answer:

Definition. IOSP. Input Output Server Processor. IOSP. Integrative and Organ Systems Pharmacology (course; various locations)

Explanation:

6 0
3 years ago
Two numbers are given (numbers are entered from the keyboard). If both numbers are positive, then output their sum, if both numb
AleksAgata [21]

Answer:

The program in Python is as follows:

num1 = int(input())

num2 = int(input())

if num1 >=0 and num2 >= 0:

   print(num1+num2)

elif num1 <0 and num2 < 0:

   print(num1*num2)

else:

   if num1>=0:

       print(num1**2)

   else:

       print(num2**2)

Explanation:

This gets input for both numbers

num1 = int(input())

num2 = int(input())

If both are positive, the sum is calculated and printed

<em>if num1 >=0 and num2 >= 0:</em>

<em>    print(num1+num2)</em>

If both are negative, the products is calculated and printed

<em>elif num1 <0 and num2 < 0:</em>

<em>    print(num1*num2)</em>

If only one of them is positive

else:

Calculate and print the square of num1 if positive

<em>    if num1>=0:</em>

<em>        print(num1**2)</em>

Calculate and print the square of num2 if positive

<em>    else:</em>

<em>        print(num2**2)</em>

3 0
3 years ago
) Using newline command : endl
Pavlova-9 [17]

Answer:

The output of the code is following:-

My first C++ program.

The sum of 2 and 3 = 5

7 + 8 = 15

Explanation:

First the program should have #include<iostream>.This is missing in the program.

In the program you have printed My first C++ program first then used newline character endl. After that you have printed The sum of 2 and 3 = 5 this will be printed in the new line.Then you have used endl.Then printed  "7 + 8 = " string and the sum 7+8 that is 15.

Hence the output is like this.

6 0
4 years ago
Other questions:
  • You need to design a data storage scheme for Hayseed Heaven library data system. There are several hundred thousand large data r
    8·1 answer
  • JAVA
    7·1 answer
  • To select all the text in a document, press ____.
    12·2 answers
  • Give the 16-bit 2's complement form of the following 8-bit 2's complement numbers: (a) OX94 (b) OXFF (c) OX23 (d) OXBCWhich of t
    7·1 answer
  • Word processing software allows users to do which of the following:
    10·1 answer
  • Explain the role of the network layer and Internet protocol (IP) in order to make internetworking possible.
    8·1 answer
  • Julio receives many emails from a healthcare site. He finds them useful, and he wants to save them all in a folder. How can he a
    12·1 answer
  • What adaptation Judy and her parents have that help them run from predators coming?​
    6·1 answer
  • The steps.txt file contains the number of steps a person has taken each day for a year. There are 365 lines in the file, and eac
    12·1 answer
  • Describe the role of a distributed file system in a job execution environment such as MapReduce in a large-scale cloud system. g
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!