sqrt(1/x) and 1/sqrt(x)

31 views
Skip to first unread message

Qian Yun

unread,
Jan 15, 2024, 5:20:50 AM1/15/24
to fricas-devel
sqrt(1/x) no longer simplifies to 1/sqrt(x) after the
"Disable splitting of roots" commit.

But sqrt(1/x) and sqrt(x) are algebraically dependent kernels, right?

So it should be a good idea to do the simplification, to lower the
chance of introducing algebraically dependent kernels.

- Qian

Waldek Hebisch

unread,
Jan 15, 2024, 6:55:14 AM1/15/24
to fricas...@googlegroups.com
On Mon, Jan 15, 2024 at 06:20:45PM +0800, Qian Yun wrote:
> sqrt(1/x) no longer simplifies to 1/sqrt(x) after the
> "Disable splitting of roots" commit.

Well, this was blocked around 2006. Consider x = -1/2 (example
from bug6357.input). After such transform principal branch
rule gives different root.


> But sqrt(1/x) and sqrt(x) are algebraically dependent kernels, right?
>
> So it should be a good idea to do the simplification, to lower the
> chance of introducing algebraically dependent kernels.

Such things (and more) should be handled in 'normalize'. Currently
'normalize' is quite weak when dealing with algebraic kernels,
but this is going to change.

--
Waldek Hebisch

Qian Yun

unread,
Jan 15, 2024, 8:20:29 AM1/15/24
to fricas...@googlegroups.com
Thanks for the explanation...

Now the final puzzle over algebraic number for me is:
why sqrt(4) gives 2, instead of both roots?

- Qian

Nasser M. Abbasi

unread,
Jan 15, 2024, 8:27:52 AM1/15/24
to FriCAS - computer algebra system
isn't the standard that for positive numbers the principle root is always returned? (even though there is negative and positive ones)

Waldek Hebisch

unread,
Jan 15, 2024, 9:08:09 AM1/15/24
to fricas...@googlegroups.com
On Mon, Jan 15, 2024 at 09:20:25PM +0800, Qian Yun wrote:
> Thanks for the explanation...
>
> Now the final puzzle over algebraic number for me is:
> why sqrt(4) gives 2, instead of both roots?

'sqrt' is a function so it must return single value or signal
error. Leaving 'sqrt(4)' unevaluated would lead to serious
troubles later. Error or negative value would be unacceptable
to most users. So, as lesser evil we return 2.

Just an extra remark: In his thesis R. Fateman showed that
returning "posive" value for "positive" arguments (where
positve is extended also to functions, essentially meaning
positive at infinity) leads to consistent choice, in particular
rules about products of roots are satisfied. Taking negative
roots would violate product rule. Fateman later was
sceptical of making choices for functions, but for numbers
since we have to make a choice positive is reasonable
choice.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages