Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage is built on Python, which is not strongly typed. So, you can easily pass a variety of objects in and out of functions. For example:

def example(a,b):
    c = a*b
    return(c)

If you pass matrices into this function, it will pass a matrix out.

a=matrix(2,2,[1,2,3,4])
b=matrix(2,2,[5,6,7,8])
example(a,b)

gives the result

[19 22]
[43 50]