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.Fri, 05 Feb 2021 03:23:24 +0100How can I get the right notation?(e^3x)https://ask.sagemath.org/question/55585/how-can-i-get-the-right-notatione3x/ I'd like to match the order between constant and variable. For example, generally we write a tangent function as e^3x, but in sage It is reversed lik xe^3 and the code is
var('x')
print(e ^ 3 * x)
How can I get the right notation?wnghks2516Fri, 05 Feb 2021 03:23:24 +0100https://ask.sagemath.org/question/55585/Indexing variables in a list comprehensionhttps://ask.sagemath.org/question/54503/indexing-variables-in-a-list-comprehension/ Suppose I create the polynomial ring R = PolynomialRing(QQ, ['lambda%s'%i for i in [1 .. g]] + ['psi%s'%i for i in [1 .. n]]).
If I want to create a list comprehension which creates a list of perhaps all the lambdas, what is the notation used at the beginning of the list comprehension?
i.e. [lambdai for i in [1 .. g]]. Laughematician760Tue, 01 Dec 2020 23:03:40 +0100https://ask.sagemath.org/question/54503/Diamond brackets <> and square brackets [] notationshttps://ask.sagemath.org/question/50560/diamond-brackets-and-square-brackets-notations/Are there some documentation on diamond bracket notation:
```
R.<w> = PolynomialRing(QQ)
```
and square bracket notation:
```
R.<y> = QQ['y'];
```
There is some documentation in [Constructors for polynomial rings docs](http://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/polynomial/polynomial_ring_constructor.html) but it looks superficial on this topic.
Are there some complete explanation with all the details behind the scene?
Is it only for polynomial rings or for some other objects? Is it SageMath addition?petRUShkaSun, 05 Apr 2020 20:27:28 +0200https://ask.sagemath.org/question/50560/Displaying mathematical notation as "strings"https://ask.sagemath.org/question/34784/displaying-mathematical-notation-as-strings/ Hello!
I can't seem to find if there is a command (or if sage is even capable) to display mathematical notation as a string to be printed, rather than evaluated.
For example, if I try;
foo = exp(x)
foo2 = str(foo)
Then using "foo2" displays e^x, rather than the actual superscript x. Although this isn't terribly surprising to me, I'm curious if there is a way to get the actual correct notation?
An even more important one would be limit notation. I can't figure out how to display the text "Lim" with "x -> 0" underneath the text "Lim" at all in sage.
If these features aren't possible that would be good to know, but it seems like a common and straight forward issue. Unfortunately googling gets drown in irrelevant hits and I don't know the appropriate term to search for. A pointer in the right direction would be much appreciated.Jason021Fri, 09 Sep 2016 16:24:17 +0200https://ask.sagemath.org/question/34784/Interpreting solution of a system of linear equationshttps://ask.sagemath.org/question/10430/interpreting-solution-of-a-system-of-linear-equations/Hi I am solving the following system:
var('C_at C_au C_bt C_bu I J k_1 k_2 gamma_1 gamma_2')
ss = solve([I-k_1*C_at,k_1*C_at - gamma_1*C_au, k_2*C_bu - gamma_2*C_bt, k_2*C_bu - gamma_2*C_bt],C_at,C_au,C_bt,C_bu)
ss
and I get the following solution:
[[C_at=I/k_1,C_au=I/?_1,C_bt=k_2*r8/?_2,C_bu=r8]]
what is **r8**?
fccoelhoTue, 13 Aug 2013 11:27:35 +0200https://ask.sagemath.org/question/10430/Changing notation in differential formshttps://ask.sagemath.org/question/10204/changing-notation-in-differential-forms/Dear all:
I'm trying to compute the curvature of a Schwarzschild metric using differential forms (Cartan formalism),
sage: reset()
sage: var('t,r,theta,phi')
sage: coords = [t,r,theta, phi]
sage: U = CoordinatePatch((t,r,theta, phi))
sage: Omega = DifferentialForms(U)
sage: X = function('X', r, latex_name=r"\Xi")
sage: f = exp(X)
sage: vi =[]
sage: for i in xrange(len(coords)):
... vi.append(DifferentialForm(Omega,1))
sage: vi[0][0] = f
sage: vi[1][1] = 1/f
sage: vi[2][2] = r
sage: vi[3][3] = r*sin(theta)
sage: dvi=[]
sage: for i in xrange(len(coords)):
... dvi.append(diff(vi[i]))
...
sage: dvi
[-e^X(r)*D[0](X)(r)*dt/\dr, 0, dr/\dtheta, sin(theta)*dr/\dphi + r*cos(theta)*dtheta/\dphi]
I'd like to know if it's possible to manipulate the result in a way that:
- the term `D[0](X)(r)` in the last line could be written as `X'(r)` or just `X'`.
- the `dvi` is expressed in terms of the `vi`-forms instead of the `Omega`-basis.
Any help is thanked.DoxFri, 07 Jun 2013 12:36:47 +0200https://ask.sagemath.org/question/10204/Nice naming of variables with subscript or superscript, avoiding variable names like phi_jm1_np1 ($\phi_{j-1}^{n+1}$)https://ask.sagemath.org/question/9996/nice-naming-of-variables-with-subscript-or-superscript-avoiding-variable-names-like-phi_jm1_np1-phi_j-1n1/In my worksheets I have many variables with subscripted/superscripted names like *phi_jm1_np1*, where the mathematical notation is simple, $\phi_{j-1}^{n+1}$. Is there a compact notation, or simply a better way, of dealing with subscripts and superscripts using sage?boyfarrellSat, 06 Apr 2013 10:46:25 +0200https://ask.sagemath.org/question/9996/Forcing Prime Notationhttps://ask.sagemath.org/question/9564/forcing-prime-notation/I want sage to implicitly differentiate a function for me, say
d/dx f(x)^2 = 2f(x)* f'(x).
I can do this by entering:
var('x')
f=function('f', x)
(f^2).diff(x)
This returns
2 f(x) D[0] (f) (x)
which is correct, but hard for me to read. Can I make sage return:
2 f(x) f'(x)
Thanks.hwong557Mon, 26 Nov 2012 00:19:07 +0100https://ask.sagemath.org/question/9564/Should evaluating 1.0e-15 produce an Unhandled SIGILLhttps://ask.sagemath.org/question/9053/should-evaluating-10e-15-produce-an-unhandled-sigill/Since downloading Sage 5.0 evaluating 1.0e-15 produces an Unhandled SIGILL in the notebook on Mac OSX. Has the input format changed from what it was in 4.7?
Now it seems I have to type 1.0*10.0^-15 (a lot more characters!)
...or is this a bug?
sage: 10.0^-1
0.100000000000000
sage: 1.0e-1
------------------------------------------------------------------------
Unhandled SIGILL: An illegal instruction occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and is not properly wrapped with sig_on(), sig_off(). You might
want to run Sage under gdb with 'sage -gdb' to debug this.
Sage will now terminate.
------------------------------------------------------------------------martinBSat, 09 Jun 2012 12:40:06 +0200https://ask.sagemath.org/question/9053/Why is 3e1 not equivalent to 30?https://ask.sagemath.org/question/8983/why-is-3e1-not-equivalent-to-30/I thought that 3e1 is completely equivalent to 30.
However, it is not:
sage: (1/30).n(digits=30)
0.0333333333333333333333333333333
sage: (1/3e1).n(digits=30)
0.0333333333333333328707404064062
Then I thought that 3e1 is always 53-bit real number or something like that.
But I was wrong again:
sage: 1/3e1.n(digits=30)
0.0333333333333333333333333333333
Now I am just confused. Is this a bug? If not, how should I
understand the second input above, and where can I find it documented? (Sage 5.0)kkumerFri, 01 Jun 2012 07:47:51 +0200https://ask.sagemath.org/question/8983/