First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 0 years ago

AstroG gravatar image

why is sqrt(factorial(l)*factorial(l))-factorial(l) not 0

I am checking solutions of some field equations. The check requires at some point the calculation of something like sqrt(factorial(l)*factorial(l))-factorial(l) where l is a positive integer . Sage gives |l!| - l! rather than 0. It works for explicit values of l. I have also tried declaring l as a positive integer and using .canonicalize_radical() and .simplify_full() as shown in the code snippet below, which has some of the lines commented out. I'm using Sagemath 10.5 on a MacBook Pro with Sequoia 15.3.1

version() var('l') assume(l, 'integer') assume(l>0)

l = 273

x = sqrt(factorial(l)*factorial(l))-factorial(l)

y = x.expand().canonicalize_radical().simplify_full()

z = x.expand().simplify_full().canonicalize_radical()

pretty_print('x = \t', x) pretty_print('y = \t' ,y) pretty_print('z = \t', z)

How might I get round this issue, please?

click to hide/show revision 2
None

why is sqrt(factorial(l)*factorial(l))-factorial(l) not 0

I am checking solutions of some field equations. The check requires at some point the calculation of something like sqrt(factorial(l)*factorial(l))-factorial(l) where l is a positive integer . Sage gives |l!| - l! rather than 0. It works for explicit values of l. I have also tried declaring l as a positive integer and using .canonicalize_radical() and .simplify_full() as shown in the code snippet below, which has some of the lines commented out. I'm using Sagemath 10.5 on a MacBook Pro with Sequoia 15.3.1

version()
var('l')
assume(l, 'integer')
assume(l>0)

assume(l>0)

# l = 273

273 x = sqrt(factorial(l)*factorial(l))-factorial(l)

y sqrt(factorial(l)*factorial(l))-factorial(l) #y = x.expand().canonicalize_radical().simplify_full()

z x.expand().canonicalize_radical().simplify_full() #z = x.expand().simplify_full().canonicalize_radical()

x.expand().simplify_full().canonicalize_radical() pretty_print('x = \t', x) pretty_print('y = \t' ,y) pretty_print('z = \t', z)

z)

How might I get round this issue, please?