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

You are not logged in.

## #2076 2013-01-19 21:55:25

gAr
Star Member

Offline

### 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."

## #2077 2013-01-19 21:58:31

bobbym

Offline

### 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.

## #2078 2013-01-19 22:01:24

gAr
Star Member

Offline

### 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."

## #2079 2013-01-19 22:12:57

bobbym

Offline

### 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.

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

gAr
Star Member

Offline

### 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."

## #2081 2013-01-20 12:15:20

bobbym

Offline

### 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.

## #2082 2013-01-22 04:02:15

gAr
Star Member

Offline

### 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."

## #2083 2013-01-22 09:21:46

bobbym

Offline

### 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.

## #2084 2013-01-22 17:25:29

anonimnystefy
Real Member

Offline

### 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?!

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #2085 2013-01-22 20:53:46

bobbym

Offline

### 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.

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

anonimnystefy
Real Member

Offline

### 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...

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

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

bobbym

Offline

### 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.

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

anonimnystefy
Real Member

Offline

### 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-22 21:27:17)

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

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

bobbym

Offline

### 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.

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

gAr
Star Member

Offline

### 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."

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

bobbym

Offline

### 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.

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

gAr
Star Member

Offline

### 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."

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

bobbym

Offline

### 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.

## #2094 2013-01-23 00:04:40

gAr
Star Member

Offline

### 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."

## #2095 2013-01-23 01:00:42

bobbym

Offline

### 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.

## #2096 2013-01-23 01:53:34

gAr
Star Member

Offline

### 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."

## #2097 2013-01-23 01:56:34

bobbym

Offline

### 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.

## #2098 2013-01-23 02:11:58

gAr
Star Member

Offline

### 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."

## #2099 2013-01-23 02:16:52

bobbym

Offline

### 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.

## #2100 2013-01-23 02:20:43

gAr
Star Member

Offline

### 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."