Ciao everyone !
I'm trying to make some computation with matrices (with some variables
x,y,z). For that, I'm following the document :
http://www.sagenb.org/home/pub/217/
When I type (in a notebook) the following, it works :
++++++++++++++++++++
A = matrix([[7, 0, 0], [0, -2, 4], [0, 6, 0]])
I3 = identity_matrix(QQ, 3)
L = var('L')
CE1 = det(L*I3 - A)
print(CE1)
++++++++++++++++++
It produces the characteristic polynomial of the matrix A.
But the slightest change produce a wide variety of crashes or unexpected
thinks. For example, if I define an itermediate matrix B build from A :
+++++++++++++++++++++++++++++
A = matrix([[7, 0, 0], [0, -2, 4], [0, 6, 0]])
I3 = identity_matrix(QQ, 3)
L = var('L')
B = L*I3 - A
print(B)
CE1 = det(L*I3 - A)
print(CE1)
++++++++++++++++++++++++++
produces :
-------------------------------------------------------------------------
Maxima crashed -- automatically restarting.
execfile("/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y")
print "\x01r\x01e4"
>>> print "\x01r\x01e3"
r e3
>>>
execfile("/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y")
b4
Maxima crashed -- automatically restarting.
execfile("/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y")
print "\x01r\x01e4"
>>> print "\x01r\x01e3"
r e3
>>>
execfile("/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y")
b4
Maxima crashed -- automatically restarting.
execfile("/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y")
print "\x01r\x01e4"
>>> print "\x01r\x01e3"
r e3
>>>
execfile("/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y")
b4
Maxima crashed -- automatically restarting.
Traceback (click to the left for traceback)
...
TypeError: unable to make sense of Maxima expression 'sage26[3,3]' in
SAGE
-------------------------------------------------------------------------
If I copy/paste exactly these lines in the terminal interface of sage, I
get the expected result :
+++++++++++++++++++++++++++++++++++
$ sage
----------------------------------------------------------------------
| SAGE Version 3.0.5, Release Date: 2008-07-11 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: A = matrix([[7, 0, 0], [0, -2, 4], [0, 6, 0]])
sage: I3 = identity_matrix(QQ, 3)
sage: L = var('L')
sage: B = L*I3 - A
sage: print(B)
[L - 7 0 0]
[ 0 L + 2 -4]
[ 0 -6 L]
sage: CE1 = det(L*I3 - A)
sage: print(CE1)
(L - 7) (L (L + 2) - 24)
sage:
++++++++++++++++++++++++++++++++++++++++++++
Any ideas ?
My aim is to do the following :
I would like to define 4 matrices q0,q1,q2,q3 and then a function which
creates a linear combination of them:
+++++++++++++++++++++++++
def Q(w1,w2,w3):
s = q0+w1*q1+w2*q2+w3*q3
return s
x = var('x')
print Q(x,1,3)
+++++++++++++++++++++++++++
That construction produces very different results when I try slight
differences.
Any help is much welcome.
Thanks
Have a good day
Laurent
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---