Math Is Fun Forum

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

You are not logged in.

#26 2016-11-20 08:11:56

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

OK, the code

f[a_] := Piecewise[{{(Abs[a])^(-1), a != 0}, {0, a == 0}}]
g[b_] := Piecewise[{{(Abs[b])^(-1), b != 0}, {0, b == 0}}]
h[c_] := Piecewise[{{(Abs[c])^(-1), c != 0}, {0, c == 0}}]
Sum[f[a]*g[b]*h[c] Boole[a + b + c == 0], {a, -100, 100}, {b, -100, 
  100}, {c, -100, 100}]

yields 13.6862.

I'm going to try and see what happens after raising the dimension to d = 2.

f[a_] := Piecewise[{{(Abs[a])^(-1), a != 0}, {0, a == 0}}]
g[b_] := Piecewise[{{(Abs[b])^(-1), b != 0}, {0, b == 0}}]
h[c_] := Piecewise[{{(Abs[c])^(-1), c != 0}, {0, c == 0}}]
Sum[f[a]*g[b]*h[c] Boole[a + b + c == 0], {a, -150, 150}, {b, -150, 
  150}, {c, -150, 150}]

yields 13.8993.

Last edited by zetafunc (2016-11-20 08:18:22)

Offline

#27 2016-11-20 08:18:40

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

Re: A zeta-like sum

Hi;

Am I correct in assuming that you only want the terms of f(a)g(b)h(c) when a + b + c = 0?


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-11-20 08:19:56

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

Yes.

Offline

#29 2016-11-20 08:24:35

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

Re: A zeta-like sum

The code looks fine now.


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-11-20 08:25:17

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

I am not sure how to extend this to 2 dimensions without getting something overly complicated.

Offline

#31 2016-11-20 08:28:49

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

Re: A zeta-like sum

How do you raise the dimension to 2?


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-11-20 08:30:23

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

We would have to replace the norms Abs[a] with the equivalent norm in 2 dimensions, which is going to look like Sqrt[a^2 + b^2] instead, and we will have to replace the conditions with a^2 + b^2 != 0, etc. and eventually sum over 6 variables. I'm trying even with just (-2,2) as the ranges and that is taking a long time.

Last edited by zetafunc (2016-11-20 08:31:02)

Offline

#33 2016-11-20 08:40:00

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

Re: A zeta-like sum

If d = 1 converges the code in post #26 is not convincing.


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-11-20 08:45:17

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

Why do you say that?

Offline

#35 2016-11-20 08:52:58

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

Re: A zeta-like sum

Based on the numbers 13.8993 and 13.6862 we can not even be sure that is converging. The harmonic series increases very slowly and does not converge.

If the sum in post #26 is converging it is doing it very slowly.


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-11-20 09:05:41

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

I will try with bigger numbers and maybe leave it on overnight, and see what happens.

Offline

#37 2016-11-20 09:09:03

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

Re: A zeta-like sum

You can be sure that it will much more difficult to do with d = 2.


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-11-20 09:13:07

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

I think analytic methods are more appropriate in that case, and that Mathematica should be used to establish confidence in the d = 1 case (if it diverges for d = 1, then certainly it will diverge for d = 2).

Offline

#39 2016-11-20 09:13:59

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

Re: A zeta-like sum

Okay, good point.


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-11-20 09:23:11

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

I should also mention that convergence for d = 2 would have interesting implications for the Gauss circle problem. More precisely it would suggest something about the maximum value of the remainder. But let us not get ahead of ourselves (as I have learned not to do in the past on working on this problem).

Last edited by zetafunc (2016-11-20 09:23:59)

Offline

#41 2016-11-20 09:31:04

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

Re: A zeta-like sum

Run it off tonight for 200, 250, 300...that way I can use a sequence accelerator on it. Although, they say that it should be done in powers of two, 64,128, 256, 512 but I am not exactly sure why.

See you later, I am going to cook something to eat.


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-11-20 09:39:18

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

200 seems to be taking a really long time. That would be interesting -- maybe I will try to use powers of 2 instead if it is necessary.

OK, see you later.

Offline

#43 2016-11-20 09:55:45

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

f[a_] := Piecewise[{{(Abs[a])^(-1), a != 0}, {0, a == 0}}]
g[b_] := Piecewise[{{(Abs[b])^(-1), b != 0}, {0, b == 0}}]
h[c_] := Piecewise[{{(Abs[c])^(-1), c != 0}, {0, c == 0}}]
Sum[f[a]*g[b]*h[c] Boole[a + b + c == 0], {a, -200, 200}, {b, -200, 
  200}, {c, -200, 200}]

has given 14.0131, after about 40 minutes.

EDIT: Also:

f[a_] := Piecewise[{{(Abs[a])^(-1), a != 0}, {0, a == 0}}]
g[b_] := Piecewise[{{(Abs[b])^(-1), b != 0}, {0, b == 0}}]
h[c_] := Piecewise[{{(Abs[c])^(-1), c != 0}, {0, c == 0}}]
Sum[f[a]*g[b]*h[c] Boole[a + b + c == 0], {a, -250, 250}, {b, -250, 
  250}, {c, -250, 250}]

has given 14.0846 after a little over 21 minutes. (I don't know why this was so much faster.)

Finally,

f[a_] := Piecewise[{{(Abs[a])^(-1), a != 0}, {0, a == 0}}]
g[b_] := Piecewise[{{(Abs[b])^(-1), b != 0}, {0, b == 0}}]
h[c_] := Piecewise[{{(Abs[c])^(-1), c != 0}, {0, c == 0}}]
Sum[f[a]*g[b]*h[c] Boole[a + b + c == 0], {a, -300, 300}, {b, -300, 
  300}, {c, -300, 300}]

yields 14.1339 after 39 minutes.

Last edited by zetafunc (2016-11-20 11:18:53)

Offline

#44 2016-11-20 13:15:59

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

Re: A zeta-like sum

Hi;

You can use the AbsoluteTiming command to do the timing automatically. I am working on a speedup to the problem.

Using the speedup I was able to do to 1000 in 2 minutes and 15 seconds. I got 14.3229. Still not seeing the expected convergence.


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

#45 2016-11-20 19:59:21

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

How did you speed it up?

Offline

#46 2016-11-20 20:37:24

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

Re: A zeta-like sum

I am glad I found this idea for you and would love to tell you, but first you have to listen to der spiel.

[Begin der spiel]

Do you know I talk to supposedly intelligent people on forums everyday and I have trouble convincing them not the teakettle principle, and not experimental mathematics. They generally just scoff and smirk when I mention those things to them. What does a bumpkin know they say? Nope, the one obvious fact to me and not obvious to them, is this simple relationship:

Mathematics + Programming > Mathematics

I have tried to convince them by subtracting Mathematics from both sides but they still do not get it. Is there more? You bet!

Mathematics + Programming > Programming.

Enough with der spiel for today.

[End der spiel]

Your problem just wants the sum of all tuples between -n and n that do not have a zero in them and sum to 0. Then take those tuples and invert and multiply each element in the tuple.

If we find those tuples first we can reduce the number we have to sum.  So in a -300 to 300 example instead of 601^3 = 217081801 tuples, we only work with 3 (300^2 - 300) = 269100 tuples. This is more than a marginal improvement.

This code here will sum all the tuples that we need from -1000 to 1000 in about 135 seconds on my machine.

n =1000;
AbsoluteTiming[
 Total@(Times @@@ 
     Abs[{a, b, c}^-1 /. 
       FindInstance[{a + b + c == 0, a != 0, b != 0, 
         c != 0, -n <= a <= n, -n <= b <= n, -n <= c <= n}, {a, b, c},
         Integers, 3 n^2 - 3 n]]) // N]

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

#47 2016-11-20 21:07:04

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

That does look much more efficient than what we were working with before. I'm not familiar with some of the things in your code but I'd like to get my hands dirty with it.

However, I ran that code a couple of times on Mathematica 10.3 and I get a ping sound after 60 seconds and it stops running.

Offline

#48 2016-11-20 21:11:26

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

Re: A zeta-like sum

That ping sound is probably an error message. Yes, there is a price for that speed. I was just going to post the one possible problem. My routine uses more memory than the three sigmas did.  I have Manjaro Linux. Linux is much more efficient with memory than Windows is, so that is why it works here. Did you get it to work with n = 300? Do not forget to restart mathematica to clear the memory.

Someday, you will migrate over to linux. It is just a question of time. Do not worry about that code being unfamiliar to you at this point. If we have time I will show an example of why it works tomorrow.


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

#49 2016-11-20 21:27:06

zetafunc
Moderator
Registered: 2014-05-21
Posts: 2,436
Website

Re: A zeta-like sum

Hmm, I don't have a computer with Linux at the moment. I am at uni at the moment so I cannot try the code for smaller n. Is there any way of doing this on a Windows machine, maybe with another program or a newer version of Mathematica?

I just saw you said you used Manjaro. Doesn't that mean the code needs to be modified first before using it in Mathematica?

Last edited by zetafunc (2016-11-20 21:29:33)

Offline

#50 2016-11-20 21:47:45

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

Re: A zeta-like sum

Manjaro is the name of the Linux distro I use. Mathematica runs the same commands on all operating systems. I use 11.0 but that may not make any difference. I will work on another less memory intensive solution as soon as I get in tomorrow. Sorry to have to bug out but I need to get ready to leave.


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

Board footer

Powered by FluxBB