linear solutions

14 views
Skip to first unread message

Anton Sherwood

unread,
Sep 10, 2016, 4:41:35 PM9/10/16
to Sage Support
I haven't guessed the right keywords. How do I solve a set of linear
equations in which the coefficients are symbolic expressions like
a^2-sqrt(b)?

--
*\\* Anton Sherwood *\\* www.bendwavy.org

Michael Orlitzky

unread,
Sep 10, 2016, 4:59:39 PM9/10/16
to sage-s...@googlegroups.com
On 09/10/2016 04:41 PM, Anton Sherwood wrote:
> I haven't guessed the right keywords. How do I solve a set of linear
> equations in which the coefficients are symbolic expressions like
> a^2-sqrt(b)?
>

Try creating vectors/matrices over the symbolic ring "SR", and then use
solve_left or solve_right. For example,

sage: a,b = SR.var('a,b',domain='real')
sage: A = matrix(SR,[[a+b, a-b],[a-b^2,a+b^2]])
sage: z = vector(SR,[1,2])
sage: A.solve_right(z)
(-(a - b)*((b^2 - a)/(a + b) + 2)/((b^2 + (b^2 - a)*(a - b)/(a + b) +
a)*(a + b)) + 1/(a + b), ((b^2 - a)/(a + b) + 2)/(b^2 + (b^2 - a)*(a
- b)/(a + b) + a))


Reply all
Reply to author
Forward
0 new messages