Question

    c++

Code the question,
Output a table showing the values vs. the range of inputs specified.

Problem 12) Mutual Recursion. Provide code and test sufficiently. x- Base Condd,tien

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

#include<bits/stdc++.h>
using namespace std;

const double eps = 0.000001;
const double pi = 3.14;

//functions for code equations
double s(double );
double c(double );

int main(){
  
   cout << "Input(x)   c(x)           s(x)\n\n";
   for(double i = pi / 4; i <= 10; i++)
       cout << i << "       " << c(i) << "       " << s(i) << endl;

}
double s(double x){
  
   if(abs(x) < eps)
       return 1.0 / x + x / 6.0; //base condition
   double nm = c(x / 2.0);
   double dm = s(x / 2.0);
   return (nm * nm * dm * dm) / (nm * nm - dm * dm); //formula
}
double c(double x){
   if(abs(x) < eps){
       return 1 + x * x / 2.0; // base condition
   }
   return 0.5 * c(x / 2.0) * s(x / 2.0); //formula
}

Output

Add a comment
Know the answer?
Add Answer to:
    c++ Code the question, Output a table showing the values vs. the range of inputs specified. Problem 12) Mutual Recursion. Provide code and test sufficiently. x- Base Condd,tien Problem 12) M...
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
  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks.please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me...

  • A combination circuit is specified by the following Boolean functions listed below. h(a, b, c) = b,c' + a'c Implement the circuit with a 3x8 decoder. Provide truth table and drawing the l...

    A combination circuit is specified by the following Boolean functions listed below. h(a, b, c) = b,c' + a'c Implement the circuit with a 3x8 decoder. Provide truth table and drawing the logic/circuit diagram. Use the block diagram for the decoder provided in Figure A4 in supplements. Please label the inputs and outputs clearly. Note: use single 3x8 decoder Question 2 (15 points] A priority encoder is an encoder circuit that includes the Truth Table of a priority function. The...

  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in Matlab and show me the code. Thanks. Problem #1: Circuits and linear-systems In the last HW you developed the governing equations for the “Wheatstone”-bridge circuit used extensively in engineering applications (shown below). B R R2 A D G m RA с E The resulting equations were solved for the output voltage and currents using the function: function [V_out, I_vector] =Wheatstone_bridge (v_in, R_vector) In...

  • LANGUAGE IS C++ Lab Ch14 Recursion In this lab, you are provided with startup code which...

    LANGUAGE IS C++ Lab Ch14 Recursion In this lab, you are provided with startup code which has six working functions that use looping (for, while, or do loops) to repeat the same set of statements multiple times. You will create six equivalent functions that use recursion instead of looping. Although looping and recursion can be interchanged, for many problems, recursion is easier and more elegant. Like loops, recursion must ALWAYS contain a condition; otherwise, you have an infinite recursion (or...

  • Page 243, Practical Question TABLE 12-1 Values of ye for EDTA at 25°C and -0.10 M...

    Page 243, Practical Question TABLE 12-1 Values of ye for EDTA at 25°C and -0.10 M pH • Calculate (Ca2+] in 0.10 M CaY2- at pH 8.00, logKf(Ca2+ - EDTA) = 10.65. (answer: 2.3x10-5 M). 1.3 X 10-23 1.4 X 10-18 2.6 X 10-14 2.1 X 10-11 3.0 x 10 2.9 x 10-7 1.8 X 10- 3.8 X 10+ 4.2 x 10 Ca2+ + Y4- Cay2- 0.041 Conditional formation constant [MY-4) K = ayun Ky = m**][**] 0.30 0.81 0.98...

  • C++ help Format any numerical decimal values with 2 digits after the decimal point. Problem descr...

    C++ help Format any numerical decimal values with 2 digits after the decimal point. Problem description Write the following functions as prototyped below. Do not alter the function signatures. /// Returns a copy of the string with its first character capitalized and the rest lowercased. /// @example capitalize("hELLO wORLD") returns "Hello world" std::string capitalize(const std::string& str); /// Returns a copy of the string centered in a string of length 'width'. /// Padding is done using the specified 'fillchar' (default is...

  • Please help with solving Question 1 (A-C) Thank you! Unless otherwise specified in the problem, you...

    Please help with solving Question 1 (A-C) Thank you! Unless otherwise specified in the problem, you may assume that all solutions are at 25°C. 1. 50.0 mL of a pH 6.00 carbonic acid buffer is titrated with 0.2857 M NaOH, requiring 17.47 mL to reach the second equivalence point. a. Calculate the molarity of carbonic acid and bicarbonate in the original buffer. Carbonic acid: Bicarbonate: b. Calculate the pH of the solution after a total of 100.0 mL of 0.2857...

  • A group of physics students collected data from a test of the projectile motion problem that...

    A group of physics students collected data from a test of the projectile motion problem that was analyzed in a previous lab exercise (L5). In their test, the students varied the angle and initial velocity Vo at which the projectile was launched, and then measured the resulting time of flight (tright). Note that tright was the dependent variable, while and Vo were independent variables. The results are listed below. (degrees) Time of Flight (s) Initial Velocity V. (m/s) 15 20...

  • Question2 uses structured design implemented in C. Array of records (structs) with file I/O is needed....

    Question2 uses structured design implemented in C. Array of records (structs) with file I/O is needed. The program takes two inputs at a time. The name of a person, and, the coin value as an integer in the range 5 to 95. Input coin values should always be divisible by 5 (integer division). Names are one word strings. An example input is: Jane 30 This input line indicates that 30 cents change is to be given to Jane. Output change...

  • I need helo on question #12. I solved the problem but the percent error is a...

    I need helo on question #12. I solved the problem but the percent error is a large number. Are my calculations correct? Titration of a weak unknown acid: Name: Noora Hamil Unknown acid A Mass of the Unknown acid: Volume NaOH added (letter or number on the unknown bottle) 0.19 Concentration of NaOH(aq):_01705 M рн 0.5 2.5 2.61 2.6u 2.67 2.69 2.73 2.77 2.81 2.86 2 .93 3.04 3.13 3.23 3.37 3 .5 u u.s 5:5 6.5 3.59 7.5 u.co...

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