I'm trying to do some least squares linear algebra. I built a matrix from
lists that I converted into column vectors and used the 'augment' function.
I used the matrix to compute a least squares solution, and I have an
solution vector, but it's type is making my life difficult.
When I type() an entry in the vector, I get:
'sage.modules.free_module_element.FreeModuleElement_generic_dense'
I want to pull the entries of this vector and use them as coefficients in a
polynomial. My solution is the 3-vector I called x. This attempt at
defining a quadratic
s=var('s')
f(s)=x[0]*s^2+x[1]*s+x[2]
plot(f(s),(s,0,2))
gives me this error
Error in lines 2-2 Traceback (most recent call last): File
"/cocalc/lib/python3.9/site-packages/smc_sagews/sage_server.py", line 1230,
in execute exec( File "", line 1, in <module> File
"/ext/sage/9.4/local/lib/python3.9/site-packages/sage/calculus/all.py",
line 170, in symbolic_expression return SR(x) File
"sage/structure/parent.pyx", line 898, in
sage.structure.parent.Parent.__call__
(build/cythonized/sage/structure/parent.c:9338) return mor._call_(x) File
"sage/structure/coerce_maps.pyx", line 161, in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(build/cythonized/sage/structure/coerce_maps.c:4622) raise File
"sage/structure/coerce_maps.pyx", line 156, in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(build/cythonized/sage/structure/coerce_maps.c:4514) return
C._element_constructor(x) File "sage/symbolic/ring.pyx", line 416, in
sage.symbolic.ring.SymbolicRing._element_constructor_
(build/cythonized/sage/symbolic/ring.cpp:7464) raise TypeError(f"unable to
convert {x!r} to a symbolic expression") TypeError: unable to convert
(-4.87852077236756*s^2 + 19.9617665490168*s + 4.00810430656697) to a
symbolic expression
I feel like I'm in type hell. Can someone help me get back into the right
Universe for this work? My scouring of Google hasn't turned up anything
helpful.
Jason
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sage-support/3661e2c3-eb5c-40ee-abff-32c240d18b69n%40googlegroups.com.