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
laila [671]
3 years ago
7

We can easily improve the formula by approximating the area under the function f(x) by two equally-spaced trapezoids. Derive a f

ormula for this approximation and implement it in a function trapezint2( f,a,b ).
Computers and Technology
1 answer:
Salsk061 [2.6K]3 years ago
3 0

Answer:

Explanation:

\text{This is a math function that is integrated using a trapezoidal rule } \\ \\

\text{import math}

def \text{trapezint2(f,a,b):}

      \text{midPoint=(a+b)/2}

       \text{return .5*((midPoint-a)*(f(a)+f(midPoint))+(b-midPoint)*(f(b)+f(midPoint)))}

\text{trapezint2(math.sin,0,.5*math.pi)}

0.9480594489685199

trapezint2(abs,-1,1)

1.0

You might be interested in
Why are iterators useful?
Marina CMI [18]
It is d because I said it is
6 0
3 years ago
In what country did true printing first take place?
kow [346]
Germany. Johannes Guten in Mainz, Germany
7 0
3 years ago
Read 2 more answers
What happens when a computer gets a virus?
Volgvan
You will start to get ad pop-ups like crazy, and your computer will be a lot slower. I'd recommend that you be careful downloading things, make sure it's the right thing you're downloading. Some people make false websites. Also the best thing to do is get a usb drive and store everything you want to keep and reset your computer to factory in your settings.
3 0
3 years ago
Read 2 more answers
CHALLENGE
Lorico [155]

Answer:

Following are the program to this question:

#include <stdio.h>//using the header file

int main()//main method

{

int y;//defining integer variable y

printf("Enter year value:");//print message

scanf("%d", &y);//use input method for input year value

if (y>= 2101)//defining if block that checks year greater then 2101

   printf("Distant future");//print message

else if (y>= 2001)//defining else if block that checks year greater then 2001

   printf("21st century"); //print message

else if (y>= 1901)//defining else if block that checks year greater then 1901

   printf("20th century");//print message

else  //defining else block

   printf("Long ago");//print message

   return 0;

}

Output:

Enter year value:1998

20th century

Explanation:

In the given C language code, inside the main method, an integer variable "y" is defined, which allows the user to input the year value, and use the multiple conditions to check the given value and print message when the condition is matched.  

  • Inside the "if" condition block, it checks the "y" variable value is greater and equal to 2101. so, it will print "Distant future", otherwise go to the next condition.
  • In this, if "y" value is greater than equal to "2001", it will print the message "21st century", otherwise go to the next condition.  
  • In this, If the value of "y" is greater than equal to "1901", it will print the message "20th century", and if all the above condition is not true, then it will go to the else block, and it will print "Long ago" as the message.
6 0
3 years ago
An example of hardware is a(n) _____.
maks197457 [2]
An example of hardware would be a computer. it is a device used to hold and contain/operate software (programs) and exists in a real physical form.
7 0
4 years ago
Read 2 more answers
Other questions:
  • If your vehicle leaves the pavement for any reason, remember to take your foot off the gas pedal, hold the wheel firmly, and
    12·2 answers
  • From the Start screen, you can A. access recently opened Excel workbooks. B. create a document from a template. C. create new bl
    12·2 answers
  • Qazwsxedcrfvtgbyhnujmikolp. In which direction on the keyboard did I type in?
    14·2 answers
  • What do these terms have in common? google, yahoo!, bing they are important books. they are internet search engines. they are wo
    10·1 answer
  • Units for measuring computer memory
    5·1 answer
  • There are generally two ways of implementing dynamic programming solutions to problems, which have equal asymptotic time complex
    13·1 answer
  • What does a production possibilities curve represent?Which of the following statements are true? Economic stability means fair d
    9·1 answer
  • What is the full form of USB​ ?
    15·1 answer
  • 4. Why does Hancock believe that our communication online is more honest than we might<br> expect?
    15·2 answers
  • Question 2 of 10
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!