Author Topic: Division by Zero  (Read 13100 times)

0 Members and 1 Guest are viewing this topic.

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: Division by Zero
« Reply #30 on: November 13, 2021, 03:34:28 pm »
Brilliant minds, fabulous explanations

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Division by Zero
« Reply #31 on: November 14, 2021, 06:08:46 am »
@STxAxTIC
  [ You are not allowed to view this attachment ]  

Wow!  So the bit after the negative sign never gets above 2 (the sum approaches 4).  Another numbers marvel.  So the quantity under the final square root approaches zero.  Meanwhile the 2^n is increasing rapidly.  From the number of nines in the quantity 1.999999.... and the number of places in the 2^n, as calculated by QB64, I deduce that the square root 'approaches zero quicker than the 2^n increases' (sorry for the mathematical gobbledegook): the answer is zero as n-> infinity.

Well, it's either zero or infinity.
« Last Edit: November 14, 2021, 06:55:02 am by Qwerkey »

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Division by Zero
« Reply #32 on: November 14, 2021, 06:52:59 am »
The whole reason I brought up sin(x)/x in the first place is because it has a removeable singularity, which means it has no singularity.

Another example to demonstrate this is take any function say f(x) = x^5+456*x

then define another function g(x) = f(x)*(x - 1)/(x - 1)

now g(x) demands a division by zero at x = 1 -- but you have done nothing to the function, you can cancel out the (x - 1) terms

g(x) = f(x) still holds
« Last Edit: November 14, 2021, 07:48:46 am by _vince »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Division by Zero
« Reply #33 on: November 14, 2021, 08:31:33 am »
Good morning boys

So Qwerkey! I can tell you're close. Did you try setting variable types as double? This piece of code captures the problem:

Code: QB64: [Select]
  1. n = 20
  2. a = 2 ^ n
  3. b = SQR(2)
  4. FOR k = 1 TO n - 2
  5. b = SQR(2 + b)
  6. b = SQR(2 - b)
  7. PRINT a * b
  8.  

... And when you run that... Amazingly somehow*, you get the digits of pi! Good ole 3.14159... And in the case that N goes to infinity, the answer converges to exactly pi. Weird right? Infinity times zero equals pi? Damn right it is, if you pick your infinity properly and your zero properly.

* = (proof of all this on request)

----------

Vince, glad you piped into this conversation. You're damn right too: if you can factor a zero out of the denominator and cancel it with something upstairs, the singularity is gone.
« Last Edit: November 14, 2021, 08:38:15 am by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Division by Zero
« Reply #34 on: November 14, 2021, 08:45:38 am »
Photographic evidence

notice how an actual singularity looks in images f(z) = 1/z and f(z) = (z+1)/(z-1), the magnitude contours get closer and closer together as the function tends to infinity

then in image sinc(z) directly computed by dividing complex sine of z by z.  Just as one might understand a function as "a rule to apply to a number" rather then "a set of pairs" with each pair rightfully justified.  Notice how there's no evidence of a tendency to infinity at z = 0

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Division by Zero
« Reply #35 on: November 14, 2021, 08:58:30 am »
Vince with the one-two punch! What a cool plotting utility you've got there. Real textbook-quality crispness and coloring. Thanks for gracing this thread with those visuals - I've never pictured sinc(z) before.

For anyone who doesn't know why these are 2D plots, Vince is showing us the complex plane, not just the number line. (Activates tomato shield.) Everything we were discussing in this thread previously takes place on a thin horizontal line running through the middle of Vince's last plot.
You're not done when it works, you're done when it's right.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Division by Zero
« Reply #36 on: November 14, 2021, 09:09:21 am »
So Qwerkey! I can tell you're close.

Close?  Nowhere near.  I used double and then Float.  Looks like I can't write code properly.  Will try to get it right (having donned the class dunce cap).

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Division by Zero
« Reply #37 on: November 14, 2021, 09:39:34 am »
Good morning boys

So Qwerkey! I can tell you're close. Did you try setting variable types as double? This piece of code captures the problem:

Code: QB64: [Select]
  1. n = 20
  2. a = 2 ^ n
  3. b = SQR(2)
  4. FOR k = 1 TO n - 2
  5. b = SQR(2 + b)
  6. b = SQR(2 - b)
  7. PRINT a * b
  8.  

... And when you run that... Amazingly somehow*, you get the digits of pi! Good ole 3.14159... And in the case that N goes to infinity, the answer converges to exactly pi. Weird right? Infinity times zero equals pi? Damn right it is, if you pick your infinity properly and your zero properly.
empirical tests suggest that the optimum value for n to give the most digits of Pi is n=ceiling((sqr(2)-1)*2*float_precision), for double the optimum n is 14
and the approximate digits of Pi is float_precision/2
« Last Edit: November 14, 2021, 09:52:00 am by jack »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Division by Zero
« Reply #38 on: November 14, 2021, 06:01:51 pm »
Yeah thats prolly true jack. This example would need high-precision libraries to really shine.
You're not done when it works, you're done when it's right.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Division by Zero
« Reply #39 on: November 15, 2021, 04:41:29 am »
Having corrected a slight coding error, I now see the proper result.  Using Double (or Float) variable, the result switches from pi to zero at n > 25 (multiplication calculation error in number of nines in 1.9999....).

What is it saying about the universe that you can get pi (to do with circles) from square root of 2 (nothing to do with circles)???
Amazing.

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Division by Zero
« Reply #40 on: November 15, 2021, 05:26:52 pm »
I must say, I absolutely love the conversation between Steve and Bill here.  They are both talking over each other, but what exactly is the essence of the miscommunication?

Perhaps it's the limitation of notation, "sin(x)/x".  If you are stuck in "arithmetic land", there's clearly a number on top and a number on the bottom.  When the number on the bottom is zero, you simply can't do it.  But is there a deeper way of looking at "sin(x)/x" other than a list of instructions to key into a calculator?  That might be called limits, calculus, analysis, etc but there is no way to have that conversation within the limited language of "arithmetic land" and so it is impossible.  Steve makes an attempt, "I get what you're saying it is sooo close it's practically..." but communication is not facilitated because they are speaking over each other in two different languages.

It reminds me of the age old "0.999..." -- is it sooo close it's practically one or is it just a misleading side effect of decimal notation?  There is the concept of an infinite sum, 9/10 + 9/100 + 9/1000 + ..., which may converge or diverge but is 0.999... is an infinite sum, or does it just really looks like one?  I guess it depends what "land" you are stuck in.

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: Division by Zero
« Reply #41 on: November 15, 2021, 06:51:20 pm »
Your are onto something there @_vince ... "It depends what land you are stuck in. I kinda like the remark made by @johnno56. You can do all but divide with zero. And I feel he has a point. Why if 1/1 =1, 2/2 = 1, 3/3 =1 can't 0/0 =1 ????? I can hear the guys groaning after all the proof they have just gone through. I'm thinking I'm going to do my own math with zero. I will give signs, like +0 or -0 and see if, especially in terms of trending, the results are logical and actionable.

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Division by Zero
« Reply #42 on: November 16, 2021, 02:45:08 am »
Compromise:  lets redefine sinc to the pictured definition.  Plug in x=0, the exponential e^0 evaluates to 1, and the integral becomes a 2x1 rectangle -- find its area, multiply by half ... = 1.

The integral itself is easy enough to solve being an exponential, it's simply exp(-i*x*t)/(-i*x) -- and, again, there's that dreaded x in the denominator!  but if you plug in x=0, anything but the above answer is clearly wrong

This definition also gives a hint as to why sinc is so useful in engineering and whatnot (Fourier integrals, etc)

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Division by Zero
« Reply #43 on: November 16, 2021, 10:23:20 am »
Say, I like that definition vince!

It's really a shame that the people who *need* to see this kind of thing have long-since exited this thread on their tractors. True to form, he pipes up with the usual cringeworthy stuff during the "teacher trolls the students" phase, and then feeling victorious, does slow-motion donuts toward the door and out of the room.

Ever heard of "steel-manning?" That's where, if two sides disagree on something, and instead of straw-manning, the new polite thing to do is to summarize your opponent's position so perfectly well, that it pays a compliment to the view; does it good justice. In other words, make a solid case *for* your opponent's view, to the point where they say "couldn't have said it better myself". Once both sides agree this has been done, the conversation can move on to the actual "debate" part. Each side has to knock over the steel man of the other if they are to win.

My actual feeling is that Steve and I don't talk past each other. What everyone gets to read instead, and what seems to confuse a few others, is that I'm not really talking *to* Steve when I reply. There is an implicit "ladies and gentlemen, as you can see..." kind of thing behind my responses.

Anyway, back to the subject on hand:

Is there a derivative-based definition to compliment the integral definition? hmmm
You're not done when it works, you're done when it's right.

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: Division by Zero
« Reply #44 on: November 16, 2021, 10:53:33 am »
Geeez. I've tried to follow along using the internet to help me understand the math arguments you guys are making but the tread is heading way, way above me. And I gather it would be too difficult to dummy down the math, I would need to know a lot more just to understand a "dummy down" version anyway. So I'm going to bow out at this point and very much appreciate everyone's input on division by zero.