I'm quite confused, why do you think this is not implemented? It seems like 
the kind of thing that is so simple, it should "just work." Is there some 
strange complication that could arise by defining it over SR that I'm not 
thinking of? I feel like it should be possible to define the function and 
have it at least try to plug in the input value.

On Friday, November 30, 2018 at 5:44:28 PM UTC-5, Dima Pasechnik wrote:
>
> It seems that doing this kind of thing over SR is not implemented. 
> However, you can do something like this: 
> R.<s>=QQ[] 
> Mz = matrix(R,[[0,1],[1,0]]) 
> Mx = matrix(R,[[1,0],[0,-1]]) 
> M1 = matrix(R,[[1,0],[0,1]]) 
> h = M1 + s*Mx 
>
> sage: h(s=1/2) 
> [3/2   0] 
> [  0 1/2] 
>
> Here h is a matrix with entries in R, and substitution works... 
>
> On Fri, Nov 30, 2018 at 9:59 PM saad khalid <saad...@gmail.com 
> <javascript:>> 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? 
> > 
> > -- 
> > 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...@googlegroups.com <javascript:>. 
> > To post to this group, send email to sage-s...@googlegroups.com 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>

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