I think you got it, but I'm just adding this below in case someone else is
also interested:

Here, this sequence defines a symbolic x, and that function f, and then
checks the types

x = var('x')
f=lambda x: x*sin(x)
type(f)
type(f(x))

and f(x) is still a symbolic expression.

Now we change x to be a floating point number

x = 9.81
type(f(x))

which gives us a *number* as a result.

And adding on top of your "conversion into symbolic expression", another
POV is that you can use python functions to construct
​ ​
an
​ ​
 expression
​
programmatically. E.g. less trivial:

def builder(v1, n):
    ex = 1 + v1
    for i in range(n):
        ex = (i + v1) * ex^2
    return ex

x = var('x')
builder(x, 5)

gives (x + 4)*(x + 3)^2*(x + 2)^4*(x + 1)^40*x^16

-- harald

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to