On Wed, Oct 28, 2009 at 9:08 PM, Jo <[email protected]> wrote:
>
> Hi,
>
> I need to replace some part of a matrix with an another matrix. I
> tried to use matrix.set_block, but I got an error. I tried few other
> alternative, but they returned all the same error:
>
> "TypeError: unable to convert x (=sin(t1)) to an integer"
>
> I made up a very simple example of a code that actually cause the
> error:
>
> t1=var('t1');
> m1=Matrix([[sin(t1)]]);
> m2=Matrix([[0]]);
> m2[0,0]=m1[0,0]; #error happen here.
> m2;
>
> Can anyone tell me what i'm doing wrong? Or did I just ended up in a
> bug....
>

Try

   m2=Matrix(SR, [[0]]);

Here SR = "symbolic ring".   All entries of a matrix belong to the
same ring.  Your m2 above has entries that are all integers, which is
the smallest ring that contains 0.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to