Dear sage-support group, I am completely new to computer algebra systems and to computer programming, and I hope you'll indulge the following beginner's question. I was wondering if there is a simple way to create a polynomial of degree d in x and y with symbolic coefficients in Sage. Here is what I mean: if I were at the board in class, I might write (in LaTeX transcription) something like
P(x,y) = \sum_{i+j\leq d} a_{ij} x^i y^j, which I would view as an element of \mathbf{Z}[a_{ij},x,y]. I might then impose some linear conditions on the a_{ij} by insisting that P (x_t,y_t) = 0 for a list of points (x_1,y_1), (x_2,y_2), ... . Finally, I might solve the resulting system of linear equations. How would you recommend that I set up something like the a_{ij} and P (x,y) in Sage? In order to make the question more definite, I illustrate it with an example that I took from a lecture of Doron Zeilberger on experimental mathematics. He proposed the question of finding a polynomial of degree d in x and y that vanishes when x and y are specialized to consecutive Fibonacci numbers. The lines below are my attempt at a Sage version of his suggested computer search for a likely solution (originally written in Maple). The program should take the degree d as an input and then provide a parameterized family of polynomials of degree d that are likely candidates. Here is what I came up with, after an enlightening afternoon of studying computer manuals: d = 4 e = d+1 L = [] M = [] for i in range(e): for j in range(e-i): L.append('a_%s_%s' %(i,j)) M.append([i,j]) V = var(' '.join(L)) P = sum(V[j]*x^(M[j][0])*y^(M[j][1]) for j in range(len(L))) E = [P(x=fibonacci(n),y=fibonacci(n+1)) for n in range(1,len(V)+6)] P.substitute(solve(E,V,solution_dict = True)[0]) I could not figure out how to create and reference the variables a_ {ij} conveniently, and so I ended up with the strange lists V and M above. Even though I got my polynomial P and solved the original problem to my satisfaction, I still don't think I know how I would have Sage do something like sum the a_{i.i+1} for 2i+1<=d. Is there a better way to do this sort of thing? Thanks for your help and indulgence, James Parson --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---