polynomial interpolation

643 views
Skip to first unread message

lainme

unread,
Dec 24, 2010, 6:40:03 AM12/24/10
to sage-support
Hi, I want to do polynomial interpolation with sage, such as the
Lagrange Interpolation

I searched the group and reference manual of sage, but only found the
complex interpolation.

Does there a simple way to do this?

Jason Grout

unread,
Dec 24, 2010, 11:34:29 AM12/24/10
to sage-s...@googlegroups.com
On 12/24/10 5:40 AM, lainme wrote:
> Hi, I want to do polynomial interpolation with sage, such as the
> Lagrange Interpolation
>
> I searched the group and reference manual of sage, but only found the
> complex interpolation.


I made this for my numerical analysis class:

http://demo.sagenb.org/home/pub/67/

At the bottom you see Sage's command to do this (look for
R.lagrange...). Scipy also has a lot of interpolation functionality:
http://docs.scipy.org/doc/scipy/reference/interpolate.html

Thanks,

Jason


Martin Albrecht

unread,
Dec 24, 2010, 11:39:23 AM12/24/10
to sage-s...@googlegroups.com

sage: K = GF(32003)
sage: P.<x> = K[]
sage: P.lagrange_polynomial([(K.random_element(),K.random_element()) for _ in
range(10)])
25484*x^9 + 16230*x^8 + 21258*x^7 + 5369*x^6 + 5329*x^5 + 26390*x^4 +
18568*x^3 + 24278*x^2 + 26684*x + 4684

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinr...@jabber.ccc.de

Reply all
Reply to author
Forward
0 new messages