ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 29 Mar 2017 01:52:02 -0500sympy.physics.quantum Bra and Ket: orthonormal basishttp://ask.sagemath.org/question/37119/sympyphysicsquantum-bra-and-ket-orthonormal-basis/i would like to be able to tell `qapply` from `sympy.physics.quantum` that i have a set (2 in my example) of orthonormal vectors:
from sympy.physics.quantum import Bra, Ket, qapply, Dagger
e0 = Ket('e0')
e1 = Ket('e1')
X = e1*Dagger(e0) + e0*Dagger(e1)
qapply(X * e1)
# -> <e0|e1>*|e1> + <e1|e1>*|e0>
is there a way to tell sage (or sympy in that case) that $\langle e_i|e_j \rangle = \delta_{ij}$?
the best i could come up with is a substituion rule:
# e_rules = [(Dagger(e0)*e0, 1), (Dagger(e1)*e1, 1), (Dagger(e0)*e1, 0), (Dagger(e1)*e0, 0)]
e_rules = {Dagger(e0)*e0: 1, Dagger(e1)*e1: 1, Dagger(e0)*e1: 0, Dagger(e1)*e0: 0}
qapply(X * e1).subs(e_rules)
# -> |e0>
isn't there something more elegant?hiro protagonistWed, 29 Mar 2017 01:52:02 -0500http://ask.sagemath.org/question/37119/Computation of reduced Grobner basishttp://ask.sagemath.org/question/35894/computation-of-reduced-grobner-basis/ Currently I am reading one research paper http://www.ijpam.eu/contents/2010-62-4/11/11.pdf on page 486 equation 9 and 10 are describing an ideal, whereas on page 487 , Grobner basis has been calculated w.r.t ideal associated with ternary Goaly code.I understood the proof on page 486, but unable to compute the Grobner basis by using sage.NileshSat, 03 Dec 2016 07:31:57 -0600http://ask.sagemath.org/question/35894/What is the meaning of string index out of range?http://ask.sagemath.org/question/35909/what-is-the-meaning-of-string-index-out-of-range/ I am dealing with [35,6] linear code over finite filed with 2 elements. I am able to get an output of its generator matrix as 6x35 matrix, but while computing parity check matrix which will be of size 29x35, I am getting following output:
IndexError:string index out of range
Does it mean that its size is two large? If still it is so, how to get that matrix in sage??NileshSun, 04 Dec 2016 06:45:49 -0600http://ask.sagemath.org/question/35909/Integrate piecewise function with change of variablehttp://ask.sagemath.org/question/37114/integrate-piecewise-function-with-change-of-variable/I would like to integrate a piecewise defined function while operating a change of variable. I start by defining the function and another variable involved in the change of variable:
phi(x) = piecewise([([-1,1], (1-abs(x))*(1-abs(x))*(1+2*abs(x)))]);
phi(x) = phi.extension(0);
h=pi/n;
h=h.n();
What I would like to do is integrate the function `phi(x/h-1)` between `0` and `pi` so I try it and results in
integral(phi(x/h-1),x,0,pi)
ValueError: substituting the piecewise variable must result in real number
So I then try to use another variable which I try to define to be 'real'
t=var('t')
assume(t,'real');
integral(phi(t/h-1),t,0,pi)
but it results in the same error... Now I try the "lambda" method since it worked when calling the `plot` function with the same change of variable; but fail again
integral(lambda t: phi(t/h-1),t,0,pi)
TypeError: unable to convert <function <lambda> at 0x16d71f140> to a symbolic expression
Now I try to use another integration method with `definite_integral` but get the same errors, only different for the "lambda" method
definite_integral(lambda x: phi(x/h-1),x,0,pi)
TypeError: cannot coerce arguments: no canonical coercion from <type 'function'> to Symbolic Ring
Is there any way around this? I really do not know what else to try...
jrojasquTue, 28 Mar 2017 18:28:56 -0500http://ask.sagemath.org/question/37114/differences between .sage and .spyx in numerical evaluationhttp://ask.sagemath.org/question/37103/differences-between-sage-and-spyx-in-numerical-evaluation/the question seems very basic, i'm sorry but i could not find an answer in the documentation.
the content of both files `test.sage` and `test.spyx` is identical; it's just
a = 1/sqrt(2)
print a
if i run `test.sage` and with
$ sage test.sage
i get
1/2*sqrt(2)
but the outcome is different from if i run the file `test.spyx` with
$ sage test.spyx
where i get
Compiling test.spyx...
0.707106781187
how can i prevent sage from numerically evaluating $1/\sqrt(2)$ in `.spyx` mode?hiro protagonistTue, 28 Mar 2017 07:33:38 -0500http://ask.sagemath.org/question/37103/Finding lower bounds of a combinatoric function.http://ask.sagemath.org/question/34616/finding-lower-bounds-of-a-combinatoric-function/I am working on a counting function involving prime numbers and managed to construct a sage function that is correct:
def sum_X_subs(plist, plen):
psum = 0
for k in range(plen-1):
ptwo = 2^(plen-k) - 2
psum += sum(mul(psub)*ptwo for psub in Subsets(plist, k))
return psum
# end sum_X_subs
flist = []
plist = [5]; plen = 1
for p in prime_range(7, 41+1):
plist.append(p)
plen += 1
flist.append(sum_X_subs(plist, plen))
flist
# [2, 52, 1162, 28196, 712250, 20379100, 696733730, 25016026280, 1042543611410, 47439135073960]
Now I need a lower bounds function for this:
$$ S = prime~range(5, n)$$
$$f(S) = \sum_{k=0}^{|S|-1} {\left(\left(2^{|S|-k}-2\right)\sum_{T\in \mathcal{P}_{k}(S)} {\prod_{t\in T} {t}}\right)}$$
None of the literature I've found covers anything close to it. (I have a vague memory of an Euler project problem that involved subset products).Maybeso83Sun, 28 Aug 2016 04:53:17 -0500http://ask.sagemath.org/question/34616/How to define an element in a space of Modular Forms and express it as a linear combination of basis elements?http://ask.sagemath.org/question/8680/how-to-define-an-element-in-a-space-of-modular-forms-and-express-it-as-a-linear-combination-of-basis-elements/Hello, I was trying to solve Exercise 1.4.5 in Alvaro Lozano-Robledo's book *Elliptic Curves, Modular Forms and Their L-functions*, which is about representations of integers as sums of 6 squares and its relation to the theta function
$$\Theta(q) = \sum_{j = -\infty}^{\infty} q^{j^2} $$
I need to define the space of modular forms $M_3(\Gamma_1(4))$ in SAGE, which I already did and find a basis for this 2-dimensional space. I was able to this without any problems.
>But now I'm asked to write $\Theta^6(q)$ as a linear combination of the basis elements just found. This prompts me to ask some questions.
>1) How do I define $\Theta(q)$ and how do I check that $\Theta^6(q) \in M_3(\Gamma_1(4))$?
>2) How would I express $\Theta^6(q)$ as a linear combination of the basis elements?
>3) More generally, is there a way in which one can specify some q-series expansion and ask SAGE if it is in a particular space of modular forms and if it is to express it as a linear combination of the basis elements?
I've already searched in the SAGE manual but I only found how to define Eisenstein series and the like. I apologize if my questions are not very well formulated.
Thank you very much in advance for any help.Adrián BarqueroSat, 28 Jan 2012 16:34:33 -0600http://ask.sagemath.org/question/8680/find four positive integers a,b,c,d whose 5th powers sum to the 5th power of another integer e, i.e. find five integers a,b,c,d,e such that a^5+b^5+c^5+d^5=e^5.http://ask.sagemath.org/question/34730/find-four-positive-integers-abcd-whose-5th-powers-sum-to-the-5th-power-of-another-integer-e-ie-find-five-integers-abcde-such-that-a5b5c5d5e5/I am working on Sage Math online , on Windows 10
In 1769, Lenhard Euler conjectured that at least n nth powers are required to obtain a sum that is itself an nth power for n>2. Disprove Euler's conjecture by writing an appropriate function and using it to find four positive integers a,b,c,d whose 5th powers sum to the 5th power of another integer e, i.e. find five integers a,b,c,d,e such that a^5+b^5+c^5+d^5=e^5.
I have tried this, but it seems like not given me what I wanted it. By the way, I am not allow to use "IF" Statement at all.
def calculateValues():
sumoffourvalues = 0
for i in range(2,6):
#display each valueS
print (i)
#calculate each value its power
eachpower = pow(i,5)
#sum of power values of four elements
sumoffourvalues = sumoffourvalues + eachpower
print ("power of sumofforvalues",sumoffourvalues)
#calculating power of fifth element
fifthelementvalue = pow(6,5)
print ("power of fifthelementvalue ",fifthelementvalue)
#Consider like below this way
#a5+b5+c5+d5−e5=0
resultantvalue = sumoffourvalues -fifthelementvalue
print("resultant value is ",resultantvalue)
calculateValues()TalafhaMon, 05 Sep 2016 09:20:27 -0500http://ask.sagemath.org/question/34730/Division algorithm in a polynomial ring with variable coefficientshttp://ask.sagemath.org/question/37098/division-algorithm-in-a-polynomial-ring-with-variable-coefficients/ I am working on an algorithm to divide a polynomial `f` by a list of polynomials `[g1, g2, ..., gm]`. The following is my algorithm:
def div(f,g): # Division algorithm on Page 11 of Using AG by Cox;
# f is the dividend;
# g is a list of ordered divisors;
# The output consists of a list of coefficients for g and the remainder;
# p is the intermediate dividend;
n = len(g)
p, r, q = f, 0, [0 for x in range(0,n)]
while p != 0:
i, divisionoccured = 0, False
print(p,r,q);
while i < n and divisionoccured == False:
if g[i].lt().divides(p.lt()):
q[i] = q[i] + p.lt()//g[i].lt()
p = p - (p.lt()//g[i].lt())*g[i]
divisionoccured = True
else:
i = i + 1
if divisionoccured == False:
r = r + p.lt()
p = p - p.lt()
return q, r
Here is an example of implementing the algorithm:
K.<a,b> = FractionField(PolynomialRing(QQ,'a, b'))
P.<x,y,z> = PolynomialRing(K,order='lex')
f=a*x^2*y^3+x*y+2*b
g1=a^2*x+2
g2=x*y-b
div(f,[g1,g2])
Here is the result:
(a*x^2*y^3 + x*y + 2*b, 0, [0, 0])
(((-2)/a)*x*y^3 + x*y + 2*b, 0, [1/a*x*y^3, 0])
(x*y + 4/a^3*y^3 + 2*b, 0, [1/a*x*y^3 + ((-2)/a^3)*y^3, 0])
(4/a^3*y^3 + ((-2)/a^2)*y + 2*b, 0, [1/a*x*y^3 + ((-2)/a^3)*y^3 + 1/a^2*y, 0])
(((-2)/a^2)*y + 2*b, 4/a^3*y^3, [1/a*x*y^3 + ((-2)/a^3)*y^3 + 1/a^2*y, 0])
(2*b, 4/a^3*y^3 + ((-2)/a^2)*y, [1/a*x*y^3 + ((-2)/a^3)*y^3 + 1/a^2*y, 0])
Error in lines 6-6
Traceback (most recent call last):
and some other error messages.
We can see that it worked well until the leading term is `2b`. it does not recognize the `2b` as a term. I tried:
(x).lt().divides(1)
It gives the answer `False`. But I tried
(x).lt().divides(a)
It gives error message. Is there a way to solve this? Thank you for your help!
KittyLMon, 27 Mar 2017 14:26:48 -0500http://ask.sagemath.org/question/37098/Sagemath won't work with Sierra Operating?http://ask.sagemath.org/question/37092/sagemath-wont-work-with-sierra-operating/ Sagemath cannot work on Sierra OPS on an older MacBookPro?
Is there any other version of Sagemath that will work?Cathy PepinSun, 26 Mar 2017 15:23:19 -0500http://ask.sagemath.org/question/37092/Modular Symbols with Character & Manin Symbolshttp://ask.sagemath.org/question/9215/modular-symbols-with-character-manin-symbols/1) Let $f= q + aq^2 + (a^3 + \frac{1}{2}a^2 +2)q^3 + a^2q^4 + O(5)$ be the level 28, weight 2 newform where $a$ satisfies $x^4 + 2x^3 + 2x^2 + 4x +4$. This modular form has an associated Dirichlet character (which we'll call eps) of conductor 28 mapping $15 \mapsto -1$ and $17 \mapsto (-\frac{1}{2}a^3 - \frac{1}{2}a^2 - a -1)$.
I want to create the space of Modular Symbols
> ModularSymbols(eps,2,1)
When I attempt to do so, I receive this error:
> TypeError: No compatible natural embeddings found for Complex Lazy Field and Number Field in a2 with defining polynomial x^4 + 2*x^3 + 2*x^2 + 4*x + 4
What's going on here? For many Dirichlet characters, the Modular Symbol space is created just fine. What's breaking in this case?
2) As a secondary question, is there any way to create the space of modular symbols
> MS=f.modular_symbols()
in such a way that MS has a manin symbol list?JeffHTue, 07 Aug 2012 08:28:47 -0500http://ask.sagemath.org/question/9215/Grobner basishttp://ask.sagemath.org/question/35918/grobner-basis/Dear Sir, I had again done sage computations for finding a Groebner basis of an ideal in polynomial ring in 35 variables with coefficients from finite field with 2 elements. I am not getting the output of Parity check matrix.Also, as soon as I enter a command I.groebner_basis() No output is coming. Why this is so? What to do , to get an output?
G=matrix(FiniteField(2),[[1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,1,1,0,1,1,1,1,1],
[0,1,0,0,0,0,1,0,1,0,0,0,1,1,0,0,0,0,1,0,0,1,1,0,1,0,1,0,1,1,1,0,1,1,1],
[0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,1,1,1,0,1,1,1,1,0,1],
[0,0,0,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0,1,0,0,1,1,0,1,1,0,1,0,1,1,1,1],
[0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,0,1,0,1,1,0,0,1,0,1,1,0,1,1,1,1,0,1,1],
[0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,1,0,0,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0]])
C=LinearCode(G)
C
Output: Linear code of length 35, dimension 6 over Finite Field of size 2
H=C.check_mat()
Output: No output is coming
ToricIdeal(H)
Output:
Ideal (-z0*z1*z2*z3*z4*z13*z14*z16*z17*z18*z19*z22*z23*z27*z28 + z34,
-z0*z1*z3*z4*z5*z7*z8*z15*z16*z18*z20*z23*z24*z26*z27 + z33,
-z0*z1*z2*z3*z5*z10*z11*z15*z17*z18*z21*z22*z24*z26*z28 + z32,
-z0*z2*z3*z4*z5*z6*z8*z12*z13*z19*z20*z23*z25*z26*z28 + z31,
-z0*z1*z2*z4*z5*z9*z11*z12*z14*z19*z21*z22*z25*z26*z27 + z30,
-z1*z2*z3*z4*z5*z6*z7*z9*z10*z20*z21*z24*z25*z27*z28 + z29) of
Multivariate Polynomial Ring in z0, z1, z2, z3, z4, z5, z6, z7, z8, z9,
z10, z11, z12, z13, z14, z15, z16, z17, z18, z19, z20, z21, z22, z23,
z24, z25, z26, z27, z28, z29, z30, z31, z32, z33, z34 over Rational
Field
P.<z0, z1, z2, z3, z4, z5, z6,z7,z8,z9,z10,z11,z12,z13,z14,z15,z16,z17,z18,z19,z20,z21,z22,z23,z24,z25,z26,z27,z28,z29,z30,z31,z32,z33,z34>=PolynomialRing(FiniteField(3),order='lex')
I=Ideal([-z0*z1*z2*z3*z4*z13*z14*z16*z17*z18*z19*z22*z23*z27*z28
+ z34, -z0*z1*z3*z4*z5*z7*z8*z15*z16*z18*z20*z23*z24*z26*z27 + z33,
-z0*z1*z2*z3*z5*z10*z11*z15*z17*z18*z21*z22*z24*z26*z28 + z32,
-z0*z2*z3*z4*z5*z6*z8*z12*z13*z19*z20*z23*z25*z26*z28 + z31,
-z0*z1*z2*z4*z5*z9*z11*z12*z14*z19*z21*z22*z25*z26*z27 + z30,
-z1*z2*z3*z4*z5*z6*z7*z9*z10*z20*z21*z24*z25*z27*z28 +
z29,z0^3-1,z1^3-1,z2^3-1,z3^3-1,z4^3-1,z5^3-1,z6^3-1,z7^3-1,z8^3-1,z9^3-1,z10^3-1,z11^3-1,z12^3-1,z13^3-1,z14^3-1,z15^3-1,z16^3-1,z17^3-1,z18^3-1,z19^3-1,z20^3-1,z21^3-1,z22^3-1,z23^3-1,z24^3-1,z25^3-1,z26^3-1,z27^3-1,z28^3-1,z29^3-1,z30^3-1,z31^3-1,z32^3-1,z33^3-1,z34^3-1])
I.groebner_basis()
Output: No output is coming.NileshMon, 05 Dec 2016 04:03:07 -0600http://ask.sagemath.org/question/35918/Element-wise product of matriceshttp://ask.sagemath.org/question/37078/element-wise-product-of-matrices/ I am trying to calculate Hadamard product of two matrices.
<pre><code>
def elementwise(M, N):
assert(M.parent() == N.parent())
nc, nr = M.ncols(), M.nrows()
A = copy(M.parent().zero_element())
for r in xrange(nr):
for c in xrange(nc):
A[r,c] = M[r,c] * N[r,c]
return A
ring = PolynomialRing(QQ, 1, 'x')
T = Matrix(ring, [
[1,-x,-x,0],
[-x,1,0,-x],
[0,-x,1,0],
[-x,0,0,1]])
R = Matrix(QQ, [
[1,1,0,1],
[1,1,1,0],
[1,0,0,1],
[0,1,1,0]])
B = ~T
elementwise(B,R)</pre></code>
I get a following mistake
<pre><code>Error in lines 21-21
Traceback (most recent call last):
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 982, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "", line 2, in elementwise
AssertionError</pre></code>
Although elementwise(B,R) does not work, the program calculates elementwise(B,B) and elementwise(R,R) without any mistakes. Probably that's because matrices B and R have different types (B is a dense matrix over general ring and R is a rational dense matrix). What should I do?dmitalSat, 25 Mar 2017 07:48:47 -0500http://ask.sagemath.org/question/37078/Evaluating symbolic expression, when some variables are finally fixedhttp://ask.sagemath.org/question/37057/evaluating-symbolic-expression-when-some-variables-are-finally-fixed/Hello
I'm looking for solution when bigger number of variables is in the picture.
Simple example:
There is relationship I = V/R
then we know that R = 3, with that knowledge let's plot I(V)
<br> in sage it should look something like:
V = var('V')
R = var('R')
I = V/R
R = 3
plot(I)
but above is not working, because in plot(I) I is still V/R not V/3 (knowledge of R=3 is not used), so I'm looking for some operation that turns V/R into V/3, something like
I = evaluate(I)
but such evaluate() apparently does not exist
there are however two different ways <br>
(1) repeat I=V/R after R=3 and in such situation I becomes V/3 as needed <br>
(2) I = I(R=R) and with earlier R=3, I also becomes V/3
<br>both however seems for me be solution(s) for simple expression with just few variables, and not good (not as straightforward as hypothetical I = evaluate(I) for more complex expression with several variables.
Is such evaluate() or so, available already, and I failed to find it?<br>
Is there a (easy) way to implement that proposed evaluate() ?wjurFri, 24 Mar 2017 05:43:58 -0500http://ask.sagemath.org/question/37057/computing order of elliptic curves over binary fieldhttp://ask.sagemath.org/question/8919/computing-order-of-elliptic-curves-over-binary-field/Do you have any information on how to compute order of elliptic curves over binary field in SAGE mathematics software?
Example: I have the following domain parameters which are taken from
p = 0800000000000000000000000000000000000000C9
a = 07B6882CAAEFA84F9554FF8428BD88E246D2782AE2
b = 0713612DCDDCB40AAB946BDA29CA91F73AF958AFD9
x = 0369979697AB43897789566789567F787A7876A654
y = 00435EDB42EFAFB2989D51FEFCE3C80988F41FF883
The problem I am facing is to to know the order of this elliptic curve? I ahve got on the net that it is possible to compute using this library sage.rings.finite_rings.finite_field_ext_pari.FiniteField_ext_pari and it takes these parameters properly with out any error. But there is error while requesting the order of that parameter.
This was what I deed in sage:
FF = sage.rings.finite_rings.finite_field_ext_pari.FiniteField_ext_pari;
order = 2**163;
c = 07B6882CAAEFA84F9554FF8428BD88E246D2782AE2;
b = 0713612DCDDCB40AAB946BDA29CA91F73AF958AFD9
K.<x>= GF(2)[];
K.<k> = FF(order, 'a', modulus = x^163 + x^7 + x^6 + x^3 + 1)[];
K163_curve = EllipticCurve(K,[1,c,0,0,b]);K163_curve
twoforoneTue, 24 Apr 2012 04:15:06 -0500http://ask.sagemath.org/question/8919/Import errorhttp://ask.sagemath.org/question/36926/import-error/Hello everyone,
I'm new to Sagemath and just got a standard subscription for the Sagemath cloud. Whenever I'm trying to import functions from another .sagws file I get the Error "ImportError: No module named mymod".
To be more specific, I created a project containing a file mymod.sagews where I defined a function and I get the ImportError when running a file main.sagews from within the same project, where I call the function defined in mymod. I'm using the command "from mymod import * ".
Can anyone help?
Greetings
Fuzzyfuzzy_logicSun, 12 Mar 2017 17:48:45 -0500http://ask.sagemath.org/question/36926/Create a band matrix with repeating and alternating valueshttp://ask.sagemath.org/question/37065/create-a-band-matrix-with-repeating-and-alternating-values/I have 7 values: a, b, c, d, e, f and g
I would like to construct an m by n matrix in this way:
[ a b c d 0 0 0 0 . . . .]
[ b e f g 0 0 0 0 . . . .]
[ c f a b c d 0 0 . . . .]
[ d g b e f g 0 0 . . . .]
[ 0 0 c f a b c d 0 0 . .]
[ 0 0 d g b e f g 0 0 . .]
[ . . 0 0 c f a b c d . .]
[ . . 0 0 d g b e f g . .]
And so forth...
Therefore, the desired matrix is symmetrical. Values **a** and **e** alternate on the main diagonal; values **b** and **f** alternate on the *1st upper diagonal*; values **c** and **g** alternate on the *2nd upper diagonal*; values **d** and **0** alternate on the *3rd upper diagonal*. I would like to be able to specify the matrix size with m by n parameters (even though the resulting matrix is non-square).
What would be an efficient way to construct this matrix?jrojasquFri, 24 Mar 2017 14:09:22 -0500http://ask.sagemath.org/question/37065/Substitute piecewise function variablehttp://ask.sagemath.org/question/37066/substitute-piecewise-function-variable/I have the following piecewise function:
phi = piecewise([([-1,1], (1-abs(x))*(1-abs(x))*(1+2*abs(x)))]);
phi = phi.extension(0);
It appears to be a valid function since I can obtain/plot its values for any 'x'. But whenever I try to substitute the variable, it does not work. For example,
phi(2)
0
but if I declare another variable 'h' and try to input that variable into the piecewise function, it does not appear to work:
h=pi/2
phi(h)
TypeError: self must be a numeric expression
At first I thought that 'h' was not a 'numeric' or 'real' value, but when I test it, it is a real value:
h.is_real()
True
How can I overcome this? How can I successfully operate a variable substitution in my piecewise function?jrojasquFri, 24 Mar 2017 14:39:26 -0500http://ask.sagemath.org/question/37066/label a point on a 3d graphhttp://ask.sagemath.org/question/37067/label-a-point-on-a-3d-graph/ Hi,
Is it possible to label specific points on a 3d plot? For example, using:
var('x,y')
plot3d(-x^2-y^2, (x, -10, 10), (y, -10, 10))
Then, labeling the vertex as point P.
Thanks!
-ErickreutFri, 24 Mar 2017 15:16:16 -0500http://ask.sagemath.org/question/37067/convert maple16 proc...end proc into SageMath codehttp://ask.sagemath.org/question/37062/convert-maple16-procend-proc-into-sagemath-code/I am trying to convert the use of an array(1..1) AND proc (y) operations operator; piecewise, abs(x),0) end proc; Into similar code in cloud.sagemath.com . Can anyone recommend what sage code I should use? I ended up doing a 'list' rather than an array, but I have no idea what to use for the proc_end proc in Maple. I am bascially plotting points for various functions to show various conditions of differentiability and continuous nature of these functions. So often times I'm plotting from close, small ranges on the real line, like (0,1) or (-1,1). I'm fairly new to sagemath and am still very much learning how to use it. THANK you in advance for any help!ho_ohbotFri, 24 Mar 2017 10:28:07 -0500http://ask.sagemath.org/question/37062/Turning system of linear equations into a matrixhttp://ask.sagemath.org/question/37053/turning-system-of-linear-equations-into-a-matrix/I have a very long list of equations (10^3 order of magnitude), but all linear. There are around 10^2 variables.
I would like to solve these equations in $F_2$, that is, in the field of 2 elements. Questions:
1. Is there a handy-dandy "solve" command in Sage that allows me to list these equations, specify the field in which I want these equations to be interpreted, and Sage returns an answer?
2. Or, is there a handy-dandy way I can input a list of linear equations, and Sage automatically returns a matrix? So long as I can read off which entries/columns of the matrix correspond to which variables in my original equations, I'm happy to then use commands taking matrices as inputs, and use the answer to the question "Solve large system of linear equations over GF(2)" (I would put the link in, but I don't have the karma).noviceThu, 23 Mar 2017 12:03:46 -0500http://ask.sagemath.org/question/37053/I have installed a Virtual VM and Sage on my Windows PC. How do I start an interactive Sage shell?http://ask.sagemath.org/question/29527/i-have-installed-a-virtual-vm-and-sage-on-my-windows-pc-how-do-i-start-an-interactive-sage-shell/I know I am supposed to type "Sage" somewhere, but where? dilettanteMon, 21 Sep 2015 21:09:17 -0500http://ask.sagemath.org/question/29527/use multiple precision by default ?http://ask.sagemath.org/question/37048/use-multiple-precision-by-default/ I don't like that QQ(2.3)^QQ(.51) thing. It's ugly. I just want to write the numbers as they are without any conditions attached. I use mpmath, since it is an external module in python the same problem persists.
>I hope sagemath has an internal built-in way to do it, without extra syntax. I don't like that annoying R.() thing every time I have to write. screened00Thu, 23 Mar 2017 11:28:43 -0500http://ask.sagemath.org/question/37048/How to find solution to the following matrixhttp://ask.sagemath.org/question/37042/how-to-find-solution-to-the-following-matrix/[ a a + 1]
[ a^2 a^2 + a]
Following is the code which tries to find solution to the 2X2 matrix A in field GF(2^4,'a'). I am trying to find solution(vector) x such that Ax=O; where O is a zero vector. The rank of A is 1 and still I am getting trivial solution(zero vector). How to find non-trivial solution of the above matrix
sage: F.<a>=GF(2^4);
sage: A=Matrix(GF(2^4,'a'),[[a,a^4],[a^2,a^5]]);
sage: b=vector(GF(2^4,'a'),2)
sage: A.rank()
sage: A.solve_right(b)
(0, 0)RaghuThu, 23 Mar 2017 00:42:12 -0500http://ask.sagemath.org/question/37042/solving a physic problem using sagehttp://ask.sagemath.org/question/10625/solving-a-physic-problem-using-sage/Hi, I'm new in this community.
I want to solve a physic problem which requires differential equation system solutions.
I don't know if my equations are correctly set. Any suggestion is good. My problem is described by this image: http://img805.imageshack.us/img805/7043/lllzm.png
I have two masses (1/3m the first, 2/3m the second) linked with a rope. The rope is free to slide around a nail (the big black point in the image). The image shows the starting condition: a man keeps the first mass stopped and so the rope is kept stretched by the second mass.
I search three functions describing the kinematics of two masses after the man will leave the fist mass: vertical movement of mass A y(t), vertical movement of mass B j(t), and horizontal movement of mass B x(t).
My Cartesian reference system is x-y system in the image.
I have to solve the following equations:
1. $-\frac{2}{3}mg+T=\frac{2}{3}m \frac{d^2y}{dt^2}$
2. $-\frac{1}{3}mg+S_y=\frac{1}{3}m\frac{d^2j}{dt^2}$
3. $S_x=\frac{1}{3}m\frac{d^2x}{dt^2}$
4. $|T|=\sqrt{S_x^2+S_y^2}$
5. $|y(t)|=\sqrt{x(t)^2+j(t)^2}$
From the forth and the fifth equations I obtain two equations, so I have 5 equations in 5 unknowns. They are:
1) T force sustaining the second mass
2) Sx x-component of force sustaining the first mass
3) Sy y-component of force sustaining the first mass
4) y(t) position of the second mass
5) x(t) x-position of the first mass
6) j(t) y-position of the first mass
I hope my explanation is clear.
How can I obtain my solutions using Sage?
Thank you very much!!pspFri, 18 Oct 2013 07:33:59 -0500http://ask.sagemath.org/question/10625/manipulation of parameter in a plot 2d functionhttp://ask.sagemath.org/question/37032/manipulation-of-parameter-in-a-plot-2d-function/ In Mathematica is possible to plot a function of variables and parameters, giving the possibility to have a slider to change interactively the parameter values. For example this input *Manipulate[Plot[1-a/x, {x, 0, 10}], {a, 0, 20}]* outputs the plot of the function *1-a/x*, where **x** is the variable, so values are on the x-axis, and **a** is a parameter and it's exact value is set on a slide bar, between 0 and 20, that appears with running.
I tried to do that with Sage, using the @interact possibility but I cannot find a solution for that. Could someone help me? pspWed, 22 Mar 2017 06:42:45 -0500http://ask.sagemath.org/question/37032/multi commodity algorithm referencehttp://ask.sagemath.org/question/37028/multi-commodity-algorithm-reference/ Hello,
I'm using "multicommodity_flow()" method for my research and I really like to know what is the reference for the solution used in the code, like a publication, book or article.
Thanks,
AmirAmir19Wed, 22 Mar 2017 03:09:04 -0500http://ask.sagemath.org/question/37028/Multi-Commodity Flow problem, solution referencehttp://ask.sagemath.org/question/37029/multi-commodity-flow-problem-solution-reference/ Hello,
I am using "multicommodity_flow()" method for my research and I would like to know the reference behind the solution, like a paper, book or an article.
Thanks,
AmirAmir19Wed, 22 Mar 2017 03:12:08 -0500http://ask.sagemath.org/question/37029/The curve C: x^2 = 0 has only one irreducible component, but sage says that it is reduciblehttp://ask.sagemath.org/question/37025/the-curve-c-x2-0-has-only-one-irreducible-component-but-sage-says-that-it-is-reducible/ The curve below has only one irreducible component, but sage says that it is reducible:
P.<x,y,z> = ProjectiveSpace(GF(3),2)
C = Curve(x^2)
C.is_irreducible()
C.irreducible_components()
Does that make any sense?g.stiflerTue, 21 Mar 2017 13:55:37 -0500http://ask.sagemath.org/question/37025/How to import the print function from __future__ ?http://ask.sagemath.org/question/37014/how-to-import-the-print-function-from-__future__/I did `from __future__ import print_function`
print('text',end='\n')
But it shows error.screened00Tue, 21 Mar 2017 09:41:27 -0500http://ask.sagemath.org/question/37014/