gpt4 book ai didi

Sage:找到给定元素的指定基的线性组合?

转载 作者:行者123 更新时间:2023-12-04 06:06:04 28 4
gpt4 key购买 nike

给定一个向量空间 V,一个基 B(元组列表,每个元组的大小对应于 V 的维度并在同一字段上)和向量 v - 什么是找到元素的(唯一)线性组合的 sage 命令B 给 v?

最佳答案

IIUC,你可能想做这样的事情:

sage: basis = [(2,3,4),(1,23/4,3), (9,8/17,11)]
sage: F = QQ
sage: F
Rational Field
sage:
sage: # build the vector space
sage: dim = len(basis[0])
sage: VS = (F**dim).span_of_basis(basis)
sage: VS
Vector space of degree 3 and dimension 3 over Rational Field
User basis matrix:
[ 2 3 4]
[ 1 23/4 3]
[ 9 8/17 11]

然后,在场上构建了向量空间:
sage: # choose some random vector
sage: v = vector(F, (19/2, 5/13, -4))
sage: v
(19/2, 5/13, -4)
sage:
sage: # get its coordinates
sage: c = VS.coordinate_vector(v)
sage: c
(-470721/19708, 59705/4927, 24718/4927)
sage: parent(c)
Vector space of dimension 3 over Rational Field
sage:
sage: # aside: there's also .coordinates(), but that returns a list instead
sage:
sage: # sanity check:
sage: VS.basis_matrix().transpose() * c
(19/2, 5/13, -4)
sage: VS.basis_matrix().transpose() * c == v
True

关于Sage:找到给定元素的指定基的线性组合?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8343889/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com