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, 18 Mar 2021 18:56:33 +0100Taking elements in solve and multiplying to a polynomialhttps://ask.sagemath.org/question/56231/taking-elements-in-solve-and-multiplying-to-a-polynomial/So I want a function that solves a system of two equations and the move those numerical results to polynomials f and g.
def PolynomialCoefficient(fcn1, fcn2):
var ('a b')
eqn1 = 2*a + 2*b == 0
eqn2 = 3*a - b == 1
List = solve([eqn1, eqn2], a, b)
Now I want to move this to `a*f(x)+b*g(x)` without hitting solve each time
and manually typing what `a` and `b` are. For example,
`PolynomialCoefficient(x, y)` should output `1/4 x - 1/4 y`.
The issue is `len(List)` outputs 1. If it was length 2 with `a` in first slot
and `b` in 2nd slot, I could do
Poly = List[0]*fcn1 + List[1]*fcn2
return Poly
Any ideas on how to move `a` and `b`?whatupmattThu, 18 Mar 2021 18:56:33 +0100https://ask.sagemath.org/question/56231/Coefficient of Polynomial of Differential Forms and displaying List for differential formshttps://ask.sagemath.org/question/52136/coefficient-of-polynomial-of-differential-forms-and-displaying-list-for-differential-forms/The coefficient function gives us the coefficient of a polynomial. For example,
g(x)=3*x^(2)
g.coefficient(x^(2))
Just started learning differential forms, so using notation here-
https://ask.sagemath.org/question/40345/differential-forms-best-package/
U = Manifold(4, 'U')
X. < x,y,z,w > = U.chart()
f = U.diff_form(4, 'f')
f[0,1,2,3]=3*x^(2)
f.display()
(f[0,1,2,3]).coefficient(x^(2))
I want to work backwards. For example, given a 4-form named Form, Form[0,1,2,3] gives me the polynomial of the form. I wish to find the coefficient of this polynomial the same way. So from above, I should be getting 3. But I get:
'ChartFunctionRing_with_category.element_class' object has no attribute 'coefficient'.
Question 1: How do I fix this?
Question 2: Suppose I have a list of 4-forms called List. From the link above, I can view every form in List by doing
List[1].display().
However, how do I quickly view all the forms?
List.display() gives me an error so can I only view the forms term by term?
QuestionwhatupmattMon, 22 Jun 2020 01:32:55 +0200https://ask.sagemath.org/question/52136/In booleanpolynomialring how we can find coefficient?https://ask.sagemath.org/question/48531/in-booleanpolynomialring-how-we-can-find-coefficient/ Let x1 ,x2,x3, v1,v2,v3 be the variable in a booleanpolynomialring. Let
F = 1+ x1*v1*v2 + x2*v1*v2 + x1*v3+ x2*x3+ v1
Now what is the coefficient of v1*v2?
In this case it will be x1+x2.
How can I find this using sagemath.
I try to use F.coefficient(v1*v2). But it not work.
Plese help. RahulMon, 28 Oct 2019 05:48:35 +0100https://ask.sagemath.org/question/48531/How can I map functions into polynomial coefficientshttps://ask.sagemath.org/question/48492/how-can-i-map-functions-into-polynomial-coefficients/Let's say I have the following expression (from a wide range of possibilities) :
pol = 3*a*x^(-b)*log(x)*b^2 - 6*a*b*c*sin(x*b) + 3*a*c^2 + 5
And I want to extract the coefficients of the polynomial over the polynomial ring over a & c, so that these result in:
a^0*c^0 : 5
a^1*c^0 : 3*x^(-b)*log(x)*b^2
a^0*c^1 : 0
a^1*c^1 : -6*b*sin(x*b)
etc.
How can I define the polynomial ring?
How can I map an existing expression that defines "pol" (which is the result of other manipulations) into such ring?Edgar BrownFri, 25 Oct 2019 03:07:32 +0200https://ask.sagemath.org/question/48492/