0

how to initialize lagrange_polynomial command for Finite Ring . It works for Finite Field,Z and Q . I tried for Ring with finite order, for me its shows ERROR.here is the code:

R = PolynomialRing(Zmod(8), 'x')
R.lagrange_polynomial([(1,2),(2,3),(3,4),(4,5),(5,6),(7,0),(0,1)])

It shows " Attribute Error, Couldn't use Lagrange here". don't know Why . Can anyone help me to fix the Error. Thank you in advance.

HallaSurvivor
  • 38,115
  • 4
  • 46
  • 87

1 Answers1

2

Welcome to MSE! For future reference, these kinds of sage questions might get answered more quickly at ask.sagemath.org, but since you're here I'll happily answer it ^_^.

The issue is that lagrange interpolation only works over a field, which $\mathbb{Z}/8$ notably isn't. When we do lagrange interpolation we have to divide. For instance, say you want to find a line connecting $(1,1)$ and $(3,1)$ in $\mathbb{Z}/8$. Then the method outputs the polynomial

$$ \frac{x-1}{3-1} + \frac{x-3}{1-3} = \frac{x-1}{2} - \frac{x-3}{2} $$

of course, we can't invert $2$ in $\mathbb{Z}/8$!

This is a toy example (obviously the constant $1$ polynomial interpolates these two points) but it showcases the problems with lagrange interpolation over rings that aren't integral domains.


I hope this helps ^_^

HallaSurvivor
  • 38,115
  • 4
  • 46
  • 87
  • Thank you! Finite Ring can have zero divisors.for example in Z4 2*2=4 which is congruent to 0 mod 4 .(product of two non zero elements can be zero).that's why we cant apply Lagrange interpolation in Ring . In this situation we get ZeroDivisionrError! is my understanding crt? – Anitha Gandhi Mar 08 '22 at 05:26
  • Yes! That's basically the idea ^_^ – HallaSurvivor Mar 08 '22 at 06:05