Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#26 2016-12-17 04:19:43

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

Okay, help me out here


'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'
I'm not crazy, my mother had me tested.

Offline

#27 2016-12-17 04:25:33

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

What do you do first?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#28 2016-12-17 04:28:42

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

Notice that cos(pi n) should be replaced with if (even n) then 1 else -1 because cos is expensive.

Then I compute partial sums, of course.


'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'
I'm not crazy, my mother had me tested.

Offline

#29 2016-12-17 04:33:09

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

I am paraphrasing but someone once said,

The purpose of math is to eliminate intelligent thought.

We compute partial sums without the noticing.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#30 2016-12-17 04:35:27

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

I would still advice using the if-else defintion  because that computes faster.

bobbym wrote:

Mathematicians like simplicity. I like speed.


'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'
I'm not crazy, my mother had me tested.

Offline

#31 2016-12-17 04:37:57

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

It will be fast enough for our purposes.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#32 2016-12-17 04:42:47

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

Here are the partial sums for several powers of 2:

[-0.5,-0.5833333333333333,-0.6345238095238095,-0.6628718503718505,-0.6777662022075269,-0.6853957082692488,-0.6892561888834033,-0.6911978702281084,-0.6921715717324437,-0.6926591377284127,-0.6929030995395857,-0.6930251251486118,-0.693086149128997,-0.6931166639131536,-0.6931319220037282,-0.6931395512236546]

'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'
I'm not crazy, my mother had me tested.

Offline

#33 2016-12-17 04:45:06

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

To what powers?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#34 2016-12-17 04:48:24

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

2^1, 2^2, ... 2^16

Prelude> pSum f n = sum $ take n [f m | m <- [1.0, 2.0 ..]]
Prelude> map (pSum (\n -> cos(pi*n)/n)) [2^n | n <- [1..16]]
[-0.5,-0.5833333333333333,-0.6345238095238095,-0.6628718503718505,-0.6777662022075269,-0.6853957082692488,-0.6892561888834033,-0.6911978702281084,-0.6921715717324437,-0.6926591377284127,-0.6929030995395857,-0.6930251251486118,-0.693086149128997,-0.6931166639131536,-0.6931319220037282,-0.6931395512236546]

'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'
I'm not crazy, my mother had me tested.

Offline

#35 2016-12-17 04:50:04

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

Please truncate that list for only 2^10. Do you see that convergence is slow? Now apply shanks acceleration to it.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#36 2016-12-17 04:54:12

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

Before that, is Dimensions[l][[1]] the same as Length[l]?


'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'
I'm not crazy, my mother had me tested.

Offline

#37 2016-12-17 04:56:17

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

You never have to ask that sort of question of another person. Just ask M. Did it work?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#38 2016-12-17 05:02:21

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

There is something weird with your code. What is x? Why do you increment it but not use it?

In[2]:= shanks[{-0.5,-0.5833333333333333,-0.6345238095238095,-0.6628718503718505,-0.6777662022075269,-0.6853957082692488,-0.6892561888834033,-0.6911978702281084,-0.6921715717324437,-0.6926591377284127}]
Out[2]= {-0.716049,-0.698052,-0.694255,-0.693408,-0.69321,-0.693163,-0.693151,-0.693148}

'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'
I'm not crazy, my mother had me tested.

Offline

#39 2016-12-17 05:08:46

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

What do you have for the last one in your list. We will look at the code later.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#40 2016-12-17 05:09:56

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

Is -0.693148 the value we are looking for?


'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'
I'm not crazy, my mother had me tested.

Offline

#41 2016-12-17 05:12:02

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

Is that all the precision you have?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#42 2016-12-17 05:13:12

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

I do not know how to get more precision.


'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'
I'm not crazy, my mother had me tested.

Offline

#43 2016-12-17 05:13:51

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

Hmmm, did you copy and paste that answer back into a notebook cell?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#44 2016-12-17 05:16:33

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

No, I already have it in the notebook cell.


'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'
I'm not crazy, my mother had me tested.

Offline

#45 2016-12-17 05:19:18

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

Repaste the six digit answer in the notebook and you will see more.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#46 2016-12-17 05:21:44

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

Oh okay, right. I got -0.6931481384212015


'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'
I'm not crazy, my mother had me tested.

Offline

#47 2016-12-17 05:27:16

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

Now what do you do?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#48 2016-12-17 05:29:55

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

I check my answer in two ways.


'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'
I'm not crazy, my mother had me tested.

Offline

#49 2016-12-17 05:30:41

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Because he asked.

What answer?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#50 2016-12-17 05:36:04

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Because he asked.

-0.693148...


'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'
I'm not crazy, my mother had me tested.

Offline

Board footer

Powered by FluxBB