I was trying chatgpt and noticed I was able things I couldn't do
myself alone, I think it can help in learning sage because it's a
good tool (i am making advert for it lol)
I needed some times to obtain what I wanted and as it gives python sometimes there are mistakes with sage, in graphic I prefer sage libs because I know them better than matplotlib with numpy
from sage.all import *
vertices = [(0, 0), (0, 1), (1, 1), (1, 0)]
p = polygon(vertices, fill=False)
def rotate_point(point, angle):
rot = matrix([[cos(angle), sin(angle)],
[-sin(angle), cos(angle)]])
return rot * vector(point)
theta1 = pi / 4
theta2 = pi / 2
rotated_vertices1 = [rotate_point(vertex, theta1) for vertex in
vertices]
rotated_vertices2 = [rotate_point(vertex, theta2) for vertex in
vertices]
# Carré en bas à droite
square_bottom_right = [rotate_point((x + 1, y), theta2) +
vector([1, 1]) for x, y in vertices]
# Carré en haut à droite
square_top_right = [rotate_point((x + 1, y + 1), theta2) +
vector([0, 2]) for x, y in vertices]
# Centrer le losange
center = vector([0.05, 0.05])
offset = vector([0.245, -0.05]) # Ajuster l'offset selon les
besoins
rotated_vertices_centered = [vertex + center + offset for vertex
in rotated_vertices1]
show(p + polygon(rotated_vertices_centered, fill=False,
color='red') +
polygon(rotated_vertices2, fill=False, color='blue') +
polygon(square_bottom_right, fill=False, color='green') +
polygon(square_top_right, fill=False, color='purple'),
gridlines="major", axes=False, figsize=5)

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/eccafd8a-9c02-2c65-1275-73f5531cd106%40gmail.com.

Thanks for appreciating and doing it on cocalc ! I will send few others I have done all over these years (since the beginning of sage) with the help of the list ! But first I must find them back !
best
Henri
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CACLE5GBRFXDSBtzDpZoN7Ai7%2BvaNojpHS2O1pHXrCyg%3DEhydhg%40mail.gmail.com.
I forget to say : I have done it with the windows version
installers 9.2 and I compiled sage-10-1 dev because on ubuntu
(sage-dev 10.1 compiled but not 10.0 a problem with giac on wsl2),
which is a good proof of the facility to get sage working !
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CACLE5GBRFXDSBtzDpZoN7Ai7%2BvaNojpHS2O1pHXrCyg%3DEhydhg%40mail.gmail.com.
thanks to the man in the list I called f3d, I could make a
graphic about a calculation I had done
included : f3d.ipynb and pyramid
Enjoy !
Henri
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CACLE5GBRFXDSBtzDpZoN7Ai7%2BvaNojpHS2O1pHXrCyg%3DEhydhg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/ff2ec91d-5f55-9e0a-6899-cde174068ea0%40gmail.com.
Very good and speedy : Thanks !
Henri
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CACLE5GAB-g%3DfrFwZhybf%3DmaY6Z1j7zLSMVx-PfipzeHog_90cw%40mail.gmail.com.