On 02/29/2016 10:19 PM, Emerson Misch wrote: > I am new to sage and have little knowledge of its computing power and am > interested in the coding for a few things. > > 1) Creating a vector space V over the field of Svalbard (all reals) or C of a > given dimension n.
sage: VectorSpace(RR,n) or sage: VectorSpace(CC,n) > 2) Finding the dimension and basis of V sage: V = VectorSpace(QQ,3) sage: V.dimension() 3 sage: V.basis() [ (1, 0, 0), (0, 1, 0), (0, 0, 1) ] > 3) creating subspaces U and W of V sage: U = V.subspace([ V([1,1,1]), V([1,1,-1]) ]) sage: W = V.subspace([ V([3,0,1]), V([7,2,0]) ]) > 4) creating the intersection of U and W and the direct sum of U and W. Depends on what you mean by "direct sum." There's, sage: U.direct_sum(W) and sage: U + W The latter will only be a direct sum if you make it one (by having U = W.complement()). Intersection is easy: sage: U.intersection(W) > 5) using the method of least squares to find a linear function that best > matches the data: > > X : (x1,x2,...,xn) > Y: ( y1,y2,...,yn) This depends on the size of the problem. If it's small enough, you can solve it algebraically (there's a matrix formula). -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
