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

You are not logged in.

#2076 2013-01-18 22:55:25

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

Sure, arxiv


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#2077 2013-01-18 22:58:31

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

Hi;

Okay, thanks. I will look at it, in the meantime I use mine because I can understand it.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2078 2013-01-18 23:01:24

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

Hi,

Yeah, me too.
I'll use this only when maxima can't obtain a g.f or recurrence, there are too many functions and options in this!


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#2079 2013-01-18 23:12:57

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

Hi gAr;

Sorry, but I need to rest. Wish I could talk with you more.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2080 2013-01-19 00:02:01

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

No problem, see you later..


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#2081 2013-01-19 13:15:20

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

Hi gAr;

I have some ideas on that square root problem.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2082 2013-01-21 05:02:15

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

Hi bobbym,

What are those ideas?


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#2083 2013-01-21 10:21:46

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

Use the built in square root function, then take the floor and the ceiling of that number. Add one and subtract one to each one. Now square each one and match it to the  number you are testing.

That should take care of round off error either way.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2084 2013-01-21 18:25:29

anonimnystefy
Real Member
From: The Foundation
Registered: 2011-05-23
Posts: 14,845

Re: What do you think?

bobbym wrote:

Use the built in square root function, then take the floor and the ceiling of that number. Add one and subtract one to each one. Now square each one and match it to the  number you are testing.

That should take care of round off error either way.

How is that different from the code code I have proposed?!


“Here lies the reader who will never open this book. He is forever dead.

“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

Offline

#2085 2013-01-21 21:53:46

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

How is that different from the code code I have proposed?!

For one thing, I am proposing testing 4 numbers rather than 2.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2086 2013-01-21 22:09:34

anonimnystefy
Real Member
From: The Foundation
Registered: 2011-05-23
Posts: 14,845

Re: What do you think?

Of those 4 numbers, 2 will never be the square root of the given number, with rounding errors or without...


“Here lies the reader who will never open this book. He is forever dead.

“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

Offline

#2087 2013-01-21 22:18:29

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

Hi;

That may not be the case. For instance and this is just an example:

He gets an answer of 35136.000001. Is that round off from the correct 35135.9999998 or from 35136?

I proposed it as a way of being sure by testing 2 smaller and 2 larger.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2088 2013-01-21 22:26:49

anonimnystefy
Real Member
From: The Foundation
Registered: 2011-05-23
Posts: 14,845

Re: What do you think?

Hi bobbym

We want our number to be a square of an integer, not a real number... Do you have an example in which my code will not get the correct answer and yours will?

Last edited by anonimnystefy (2013-01-21 22:27:17)


“Here lies the reader who will never open this book. He is forever dead.

“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

Offline

#2089 2013-01-21 22:32:21

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

Hi;

These are just suggestions for gAr to consider.

Do you have an example in which my code will not get the correct answer and yours will?

If you are demanding correctnes you do not even know if your idea would always work.

I would presume that an exhaustive test would have to be done on every square with whatever method he chooses.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2090 2013-01-22 00:23:55

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

Hi bobbym,

Good idea, but I liked your integer only suggestion better since the code dealing with integers would be faster than floating points. Also, that algorithm on wikipedia did not even have integer divisions, only shift operations!


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#2091 2013-01-22 00:28:28

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

Hi;

I was not suggesting rewriting a floating point routine. You would be using the built in square root routine as an estimate. It is probably implemented in the math coprocessor and would not use much time at all.

The integer square root does have the advantage of being verified for any other idea you would have to prove that it never missed. That means checking 4 billion square roots once.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2092 2013-01-22 00:33:19

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

Yes, I know you were talking about using the built-in sqrt, but I'm not sure whether that will be faster than our own integer sqrt.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#2093 2013-01-22 00:43:58

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

The speed question is secondary. I have no proof that mine will work in every case. It was just a suggestion.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2094 2013-01-22 01:04:40

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

Hi bobbym,

Okay, thanks for the idea..


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#2095 2013-01-22 02:00:42

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

So you will go with the isqrt routine? You wanted more speed than Sage could provide?


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2096 2013-01-22 02:53:34

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

Yes, I wanted more speed, since looping is a lot slower in sage.
But sage does provide with enough terms in reasonable time to get the g.f / recurrence.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#2097 2013-01-22 02:56:34

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

Perhaps Sage, has a single command that does what you want?


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2098 2013-01-22 03:11:58

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

You mean, to solve the diophantine equation?
I did not search for it yet.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#2099 2013-01-22 03:16:52

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,747

Re: What do you think?

Hi;

No, I meant to determine whether a number is a square or not.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#2100 2013-01-22 03:20:43

gAr
Member
Registered: 2011-01-09
Posts: 3,462

Re: What do you think?

That's already there, I was concerned about the requirement to loop through each integer.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

Board footer

Powered by FluxBB