You are not logged in.

- Topics: Active | Unanswered

Is the formula same as filling it up with trapeziums?

How much n do you want me to take?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

Yes, they are rectangles with a triangle on top.

To know n beforehand we must have an error estimate.

**In mathematics, you don't understand things. You just get used to them.Of course that result can be rigorously obtained, but who cares?Combinatorics is Algebra and Algebra is Combinatorics.**

**Online**

Hmm...

How to have that?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

I already do:

with that we can answer the question.

**In mathematics, you don't understand things. You just get used to them.Of course that result can be rigorously obtained, but who cares?Combinatorics is Algebra and Algebra is Combinatorics.**

**Online**

But we still do not know n!

How did you come up with that formula?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

Those are well known from books on numerical analysis and elsewhere. I believe it is derived from the Taylor series. We are going to compute n using that formula!

**In mathematics, you don't understand things. You just get used to them.Of course that result can be rigorously obtained, but who cares?Combinatorics is Algebra and Algebra is Combinatorics.**

**Online**

Define error before that.

Its sad to note that I cannot differentiate cos(x)^100

*Last edited by Agnishom (2013-07-23 13:29:54)*

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

You have defined it!

Of course that result can be rigorously obtained, but who cares?

Combinatorics is Algebra and Algebra is Combinatorics.

**Online**

I do not understand the formula at post 29, what did you put between f''()

Please help me with differentiating cos(x)^100

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

Hi;

That is xi, it represents a number between a and b that makes errror a maximum.

For the sake of speed, I will differentiate it for you.

Remember we are in computer land here, not in the real world. Throw your pencil and paper out the window but make sure you do not hit anybody with them.

Maxima or any other CAS can get that second derivative immediately and in this field you are encouraged to use it. If you can not do the differentiation what then? We will talk about that at the end. Let us not be slowed down by side issues of differentiation or computing numbers. These are tasks unrelated to what the question is.

Of course that result can be rigorously obtained, but who cares?

Combinatorics is Algebra and Algebra is Combinatorics.

**Online**

I wrote the function and I am getting 0.12501848174018745

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

Hi Agnishom;

You are a fireball! But do not get ahead of me so fast.

What function?

Of course that result can be rigorously obtained, but who cares?

Combinatorics is Algebra and Algebra is Combinatorics.

**Online**

```
>>> from math import cos
>>> def integrate(f, a, b, n):
s = 0
for k in xrange(1, n):
s += f(a + ((k*(b-a))/n))
s += 0.5*(f(a) + f(b))
s *= (b-a)/n
return s
>>> f = lambda x: (cos(x))**100
>>> integrate(f, 0, (3.141592653589793/4),1000)
0.12501848174018745
```

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

Haha!

You went to Wikipedia! That is the code for the above formula I gave you.

Let me rant a bit...

Please help me with differentiating cos(x)^100

Post that in help me and I will work with you on it there.But let us proceed quickly and smoothly to our goal of getting a trapezoid rule answer.

You have asked me to teach you, I will give you the tricks of the trade. So far only two others have been able to follow them. We will now find out how crazy you really are. Are you prepared to take the red pill, to go down the rabbit hole?

If yes, then lets see why that code works?!

Of course that result can be rigorously obtained, but who cares?

Combinatorics is Algebra and Algebra is Combinatorics.

**Online**

Haha!

You went to Wikipedia! That is the code for the above formula I gave you.

-_-

No, I wrote it all by myself. I even made a few mistakes and had to correct it with a few tries.

Yes, I am prepared for the red pill. Please continue...

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

That is very good!

Since you have programmed the trapezoid rule, you understand it better than most mathematicians. That will make many angry at me. But it is not my opinion but the opinion of Doron Zeilberger.

Then we can proceed with the question how do I know how many n to use?

I gave you this formula,

and the somewhat enigmatic statement

That is xi, it represents a number between a and b that makes errror a maximum.

How do we use that?

Of course that result can be rigorously obtained, but who cares?

Combinatorics is Algebra and Algebra is Combinatorics.

**Online**

bobbym wrote:

You have defined it!

Nope. I have not. What is error?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

You said 4 significant figures. Since we have an estimate given for the integral, that implies an error of .00005

Of course that result can be rigorously obtained, but who cares?

Combinatorics is Algebra and Algebra is Combinatorics.

**Online**

Ok, what about xi?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

xi is a value in the closed interval a,b that maximizes the value of error. Let's see how to compute that.

Of course that result can be rigorously obtained, but who cares?

Combinatorics is Algebra and Algebra is Combinatorics.

**Online**

Hmm

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

It looks terrible..

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

Yes and the error estimate is wildly inaccurate so we will do it the old fashioned way. When you ran your routine for n = 4 what did you get?

Of course that result can be rigorously obtained, but who cares?

Combinatorics is Algebra and Algebra is Combinatorics.

**Online**

I did not run the routine for n=4 ever

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 87,240

Can you do it now?

Of course that result can be rigorously obtained, but who cares?

Combinatorics is Algebra and Algebra is Combinatorics.

**Online**