  Project: Testing 18.04
Views: 761
Kernel: SageMath 9.1

# Sage 9.1 on CoCalc

version()

x = var('x')
eq = 6*x^6 - 7*x^5 - 7*x^4 + 7*x^2 + 7*x - 6
sol = solve(eq, x)
sol

show(sol)

plot(eq, (x, -1.1, 1.6))

eq = 6*x^6 - 7*x^5 - 7*x^4 + 7*x^2 + 7*x - 6
complex_plot(eq, (-1.5, 2.1), (-1.5, 1.5))


## Polyhedral geometry

There is now a catalog for common polyhedral cones, e.g.

cones.nonnegative_orthant(5)


New features for polyhedra:

sage: P = polytopes.cube(intervals='zero_one') # obtain others than the standard cube
sage: P = matrix([[0,1,0],[0,1,1],[1,0,0]])*P  # linear transformations
sage: it = P.face_generator()                  # a (fast and efficient) face generator
sage: next(it)

sage: next(it)


sage: f = next(it)
sage: f.normal_cone()                          # normal cone for faces

sage: P.an_affine_basis()


sage: P = polytopes.hypercube(4)
sage: P.flag_f_vector(0,3)                     # flag_f_vector is exposed

P.plot()


## Integral curves over finite fields

A.<x,y> = AffineSpace(GF(16),2)
C = Curve(y^3 + x^3*y + x); C  # Klein quartic

C.function_field()

C.genus()

C.closed_points()

p1, p2 = _[:2]
P1 = p1.place()
P2 = p2.place()
D = 5 * P1 - P2
D.basis_function_space()

f1, f2 = D.basis_function_space()
f1.zeros()


## Generator for cube-connected cycles

graphs.CubeConnectedCycle(3).plot()


## Manifolds

More functionalities in index notation for tensors

E.<x,y> = EuclideanSpace()
v = E.vector_field(-y, x)
t = E.tensor_field(0, 2, [[1, x], [-2*y, x^2]])
v['j']*(t['_ij'] + t['_ji']) == v.contract(2*t.symmetrize())

v

t

v['j'], t['_ij'],  t['_ji']

t.symmetrize()











@interact
def func(k = slider(0, 10, .1), j = (-10, 10), l = range_slider(-5, 5)):
print("k: %s" % k)
print("j: %s" % j)
print("l: [%s, %s]" % l)



var('t y')
plot_slope_field(y - t, (t,0,10), (y,0,6), plot_points=25)






## Cellular Automata

G = cellular_automata.GraftalLace([2,0,3,3,6,0,2,7])
G

G.evolve(42)
G.plot()



init = 200*
init = 0
init = 0
ECA = cellular_automata.Elementary(151, width=200, initial_state=init)
ECA

ECA.evolve(200)
ECA.plot()