Ask Your Question
0

what happened to square_root() for rationals?

asked 2013-02-11 15:21:08 +0100

anonymous user

Anonymous

I have some old code that takes the square_root() of rational numbers. This function seems to be long gone. How do I replace its functionality?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-02-11 15:29:46 +0100

fidbc gravatar image

updated 2013-02-13 10:49:10 +0100

For a rational number x, it seems that x.sqrt(extend=False) emulates square_root().

Update: Changed sqrt() to x.sqrt(extend=False).

Thanks to @kcrisman and @sopsku for their comments!

edit flag offensive delete link more

Comments

No I am sure they are different in their behavior.

sopsku gravatar imagesopsku ( 2013-02-11 15:41:50 +0100 )edit

Or are you thinking of `sqrt_approx` - deprecated since http://trac.sagemath.org/sage_trac/ticket/4611 ?

kcrisman gravatar imagekcrisman ( 2013-02-11 20:46:05 +0100 )edit
0

answered 2013-02-12 13:41:53 +0100

sopsku gravatar image

I found online an old (ver 1.4.1) sage manual that says that square_root() for rationals: "Return the positive rational square root of self, or raises a ValueError if self is not a perfect square."

So with this information is easy enough to code up a simple function to replace it.

I do wonder why it went away and or if it has been renamed or replaced somehow.

edit flag offensive delete link more

Comments

2

In this case, maybe `x.sqrt(extend=False)` would do the job.

fidbc gravatar imagefidbc ( 2013-02-12 14:02:31 +0100 )edit

Wow, 1.4.1 - that is REALLY old. This functionality has probably been gone for quite a few years, long before any deprecation policy. I think that fidelbc should update his answer with that so you can accept it.

kcrisman gravatar imagekcrisman ( 2013-02-13 10:24:12 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-02-11 15:21:08 +0100

Seen: 275 times

Last updated: Feb 13 '13