On Tuesday, August 24, 2021 at 5:21:02 PM UTC-7 Oscar wrote:
> Is there a way to run those same examples from Python or do they need
> to be run from the SageMath application?
Only one of the examples shown in the release notes uses Sage's preparser
syntax. So when Sage is installed, you can also use plain python for the
same functionality. Here is an example session in plain python:
$ ./sage -python
Python 3.9.6 (default, Jun 29 2021, 05:25:02)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
from sage.all import var, cos, sin, matrix, pi
>>> x, y = var('x y')
>>> M = matrix([[sin(x), cos(x)], [-cos(x), sin(x)]]); M
[ sin(x) cos(x)]
[-cos(x) sin(x)]
>>> sM = M._sympy_(); sM
Matrix([
[ sin(x), cos(x)],
[-cos(x), sin(x)]])
>>> sM.subs(x, pi/4) # computation in SymPy
Matrix([
[ sqrt(2)/2, sqrt(2)/2],
[-sqrt(2)/2, sqrt(2)/2]])
>>> from sage.all import WeylGroup
>>> W = WeylGroup(["A",1,1])
>>> sW = W._sympy_(); sW
SageSet(Weyl Group of type ['A', 1, 1] (as a matrix group acting on the
root space))
>>> sW.is_finite_set
False
>>> sW.is_iterable
True
>>> sB3 = WeylGroup(["B", 3])._sympy_(); sB3
SageSet(Weyl Group of type ['B', 3] (as a matrix group acting on the
ambient space))
>>> len(sB3)
48
--
You received this message because you are subscribed to the Google Groups
"sympy" 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/sympy/0326a9eb-9dac-4a6d-b928-42e830410b06n%40googlegroups.com.