On Mon, Aug 25, 2008 at 10:28 PM, Tim Lahey <[EMAIL PROTECTED]> wrote:
>
> On Aug 26, 2008, at 1:14 AM, William Stein wrote:
>
>> Sounds good.  Unfortunately I don't understand precisely what
>> you're asking for.  Do you want to do this?
>>
>> sage: x = var('x', ns=1)
>> sage: from sage.symbolic.function import function
>> sage: foo = function('foo',1)
>> sage: expr = foo(x)^2 + foo(x)-1
>> sage: expr
>> foo(x) + foo(x)^2 - 1
>> sage: y = var('y')
>> sage: expr.subs(foo(x)==y)
>> y^2 + y - 1
>>
>> This *already* works in the new pynac symbolics.  I just typed it in.
>>
>> Of course, I'm skipping the "programatically" part...
>>
>
> It's the "programatically" part that makes it a bit more difficult.
> so imagine doing this with foo1 through foon and y1 through yn. So,
> I need to create y1 through yn as needed. I'm not sure how to do
> that since n is only known when the list of foo is read.

What is "the list of foo"?  Is n just the length of a list?  Do you
want to do something like this?

sage: y = [var('y%s'%i) for i in range(10)]
sage: y
[y0, y1, y2, y3, y4, y5, y6, y7, y8, y9]
sage: expr.subs(foo(x) == y[3])
y3^2 + y3 - 1

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to