Author Topic: Division by Zero  (Read 15309 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Division by Zero
« Reply #45 on: November 16, 2021, 11:14:36 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.

It's simple Dimster: you *can't* divide by zero.  Zero is one of those special existences which folks who should know better, like to pretend is just the same as any other number.  They come up with "rules" which work, as long as you whistle idiotically and only apply them in specific situations like:

"Zero raised to *any* power is zero. "  They'll draw you pretty pictures to prove their point...

Then, next week, they'll tell you: "Any number raised to the zero power is one."  They'll draw more pictures to try and prove their point...

And then you have to ask, "What about zero raised to the zero power?"  It can't exist under both definitions, unless you believe that 0 = 1...   These instances are singular irregularities which they never bother to point out, just so they can go around quoting their favorite mantras and pretending they're smarter than you.

Truth is -- Zero is an irregularity simply because it represents NOTHING.  Division by zero is simple to understand: Take one of anything and divide it into zero parts.  If you can do that, you just destroyed the Law of Conservation.  You turned *something* into *nothing*, much like STx does every time he bothers to open his mouth.  😝
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Division by Zero
« Reply #46 on: November 16, 2021, 12:25:36 pm »
Btw, Dimster, this isn't really about dividing by zero it's about the sinc function.

Lecturing a physicist on the law of conservation?  He won't be so merry-cherry!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Division by Zero
« Reply #47 on: November 16, 2021, 02:46:09 pm »
Yes finding another way to write sinc function without dividing by 0 was fine way to avoid div by 0 error.

You aren't going to convince QB64 you can divide by zero so find another way before you try.

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Division by Zero
« Reply #48 on: November 16, 2021, 07:30:01 pm »
You are right that QB64 will not directly evaluate sin(0)/0, just as it will not evaluate sqrt(-144), just as it will not evaluate an integral.  That's all up to the man behind the keyboard and what he is trying to do, only then can one recommend the optimal algorithm for the solution.  And such abstract mathematical concepts do not cease to exist just because one is programming QB64.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Division by Zero
« Reply #49 on: November 16, 2021, 08:22:50 pm »
LOL did he really start with the zero-exponents thing?

0^0 = 1. Cry hard.

The question was never really "who is right?" anyway. The question has always been "who needs to be right?" If you don't absolutely need to be correct about concepts of calculus in order for your day-to-day programs, inventions, and christmas tree sales to come out properly... then you won't. To take it away from math for a second, I don't need to know Swahili in order to do my daily activities and obey traffic laws, and I would never in my wildest dreams actually double-down and argue over Swahili against a person who makes their living doing it.
You're not done when it works, you're done when it's right.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Division by Zero
« Reply #50 on: November 17, 2021, 04:03:52 pm »
seems like we have been there before, 0^0 I mean
just out of curiosity I tried that expression in pari/gp, Maple, Mathematica, Maxima and C
C, pari/gp and Maple gave 1 as the answer
Mathematica gave Indeterminate
Maxima gave expt: undefined: 0^0
I vote for Mathematica and Maxima, although for practical purposes I would use 1 as the answer

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Division by Zero
« Reply #51 on: November 22, 2021, 05:01:08 am »
Don't mean to beat a beaten dead horse, but here's another interesting definition

https://www.wolframalpha.com/input/?i=simplify+1%2F%28gamma%28z%2Fpi+%2B+1%29*gamma%281+-+z%2Fpi%29%29

which works out nicely:

sinc(0) = 1/(Gamma(1)Gamma(1)) = 1/(0! * 0!) = 1
« Last Edit: November 22, 2021, 06:02:41 pm by _vince »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Division by Zero
« Reply #52 on: November 22, 2021, 12:04:23 pm »
Another way to get Div by 0 error is trying to take Mod 0.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Division by Zero
« Reply #53 on: November 22, 2021, 05:20:55 pm »
Mr. _vince, I think something is not right, sin(0)=0 and the link that you gave does not agree with your png