On Friday, November 30, 2018 at 3:59:40 PM UTC-6, saad khalid wrote:
>
> Hi all, 
>
> I'm not sure what is happening, but I defined some matrices:
> Mz = matrix([[0,1],[1,0]])
> Mx = matrix([[1,0],[0,-1]])
>




 

> M1 = matrix([[1,0],[0,1]])
>
> And then I tried defining a function where I multiply these matrices by 
> some variable and add them together:
>
> h(s) = M1 + s*Mx
> h(.1)
> However, when I try to compute this h(.1), the function doesn't plug in .1 
> in for s in the function, and it returns:
>
> [ s + 1      0]
> [     0 -s + 1]
>
>
> What exactly is happening?
>

I am using the lambda notation for matrix functions.  It works very well

m1=matrix([[2,3],[1,6]]);m2=matrix([[3,6],[9,1]])
f=lambda s:m1+s*m2
f(.4) 

-- 
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