On Mon, Apr 17, 2017 at 7:53 PM, David White <
dav...@gmail.com> wrote:
> Hello,
>
> I am trying to use Sage in my class with some basic problems about matrices.
> Several of the problems in the book are of the form “find all values of k
> such that … is consistent” where the … is some linear system where k
> appears. If doing these problems by hand, one would take the determinant and
> solve for the values of k where the determinant is not zero. Sometimes the
> linear system is large, so I want to be able to use the .determinant()
> command (or .echelon_form() for similar problems) on a matrix where k is an
Is this an example of what you want?
sage: k = var("k")
sage: A = matrix(SR, [[-1,20],[20,k]])
sage: det(A)
-k - 400
sage: solve(det(A)==0,k)
[k == -400]
> element. However, Sage is not letting me create such a matrix object,
> because it does not recognize my assume() command telling it that the
> variable k is rational (or real, for that matter; neither works).
>
> I’m trying to mimic what is going on here:
>
http://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/assumptions.html
>
> When I type the following code, I get an error saying Sage is "unable to
> convert k to an element of a rational field" (I get this error with and
> without the assume())
>
> var('k')
> assume(k,'rational')
> v = vec(QQ,[k,k,k])
>
> Can someone please tell me how to make variables and matrices play nicely
> together?
>
> --
> 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.
> To post to this group, send email to
sage-s...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/sage-support.
> For more options, visit
https://groups.google.com/d/optout.