ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 25 Jun 2020 02:16:50 +0200Multiplying a vector to a listhttps://ask.sagemath.org/question/52213/multiplying-a-vector-to-a-list/Let's say I have a list of forms given by
U = Manifold(4, 'U')
X.<x, y, z, w> = U.chart()
f = U.diff_form(3, 'f')
f[0, 1, 2] = x^2
g = U.diff_form(3, 'g')
g[0, 1, 2] = y^2
h = U.diff_form(3, 'g')
h[0, 1, 2] = z^3
List = [f, g, h]
So I have a list of 3 elements, each a 3-form.
Let's assume I have a list of vectors given by
ListofVectors = [(0, 1, 1), (0, 2, 1), (1, 2, 3)]
I want to do a dot product but the problem is Sage won't
let me make `List` into a vector so I can do like
List.dot_product(ListofVectors[i]) for i < len(ListforVectors)
Basically, I want a new list with `[g + h, 2*h + g, f + 2*g + 3*h]`. Is there a way to dot product a list of forms with a list of vectors? Again, I think the main issue is I can't turn List into a vector for the dot product function to make sense.whatupmattThu, 25 Jun 2020 02:16:50 +0200https://ask.sagemath.org/question/52213/Is there an easy way to get the matrix of coefficients from a product of a matrix and a vector?https://ask.sagemath.org/question/45376/is-there-an-easy-way-to-get-the-matrix-of-coefficients-from-a-product-of-a-matrix-and-a-vector/I have a matrix multiplication of the form
$$ B = A x $$
or
$$
\begin{pmatrix} a_{11} x_1 + a_{12} x_2 + a_{13} x_3 \\\ a_{21} x_1 + a_{22} x_2 + a_{23} x_3 \\\ a_{31} x_1 + a_{32} x_2 + a_{33} x_3 \end{pmatrix} = \begin{pmatrix}
a_{11} & a_{12} & a_{13}\\\
a_{21} & a_{22} & a_{23}\\\
a_{31} & a_{32} & a_{33}
\end{pmatrix}
\cdot
\begin{pmatrix}
x_1 \\\
x_2 \\\
x_3
\end{pmatrix}
$$
Is there a way in Sage to factor $B$ in a way where I give it $x$ and it returns $A$?
Edited from a question posted by someone else at the Mathematica StackexchangenikolaussucherFri, 08 Feb 2019 20:40:39 +0100https://ask.sagemath.org/question/45376/define new vectorhttps://ask.sagemath.org/question/26198/define-new-vector/ hi i'm new in sage , I have two vectors
v1=vector([8,-10,12]) <br>
v2=vector([9,4,-6])
i want to create a third one which is parallel with v1 and also the scalar product of v2 and v3 is equal to 1440
(x,y,z)=var('x,y,z') <br>
v3=vector([x,y,z])
solve([v1.dot_product(v3)==1440,v2.cross_product(v3)==0],x,y,z)
i want to get something like this: [x= , y= , z= ] <br>
but the result: []
dan6252Mon, 16 Mar 2015 03:15:30 +0100https://ask.sagemath.org/question/26198/Using dot for graphshttps://ask.sagemath.org/question/10977/using-dot-for-graphs/The graphs should be rendered by 'dot', but layout='graphviz' fails due to an error in the distribution's dot2tex package.
So I came up with the following:
#auto
def dot(g, otype='png'):
dottmpfile = 'g'+str(g.graphviz_string().__hash__())+otype
g.graphviz_to_file_named(dottmpfile, edge_labels=True)
import subprocess
subprocess.call(['dot', '-T'+otype, '-o', dottmpfile+'.'+otype, dottmpfile])
os.remove(dottmpfile)
Which allows to generate graphs like this:
g = DiGraph({'a' : ['a', 'b'], 'b' : ['b','c'], 'c' : ['d'], 'd' : ['c']}, loops=True)
dot(g)
Is there a better way of calling dot straight?pothosSat, 01 Feb 2014 17:33:54 +0100https://ask.sagemath.org/question/10977/May there is a bug in notebookhttps://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/ I'd like to use R in notebook worksheet. I mean, I have the R evaluation chosen at the top, and when I use TAB to call auto completion I do not get correct names.
For example,after I hit "shapiro" and press TAB ,the auto-completion returns "shapiro_test",but in R,this function is "shapiro.test".
Many other function with "." are returned instead of "_".Is there any solution?
shahuwangTue, 08 May 2012 11:18:08 +0200https://ask.sagemath.org/question/8946/