bra1nDump / show-me-chatgpt-plugin

Create and edit diagrams in ChatGPT
https://showme.redstarplugin.com
674 stars 71 forks source link

Sólidos Platônicos Flor da Vida #24

Closed QuebrandoParadigmasMFP closed 1 year ago

QuebrandoParadigmasMFP commented 1 year ago

import numpy as np import matplotlib.pyplot as plt import networkx as nx from sympy import primerange

Função para gerar a sequência de Fibonacci

def fibonacci(n): fib_sequence = [0, 1] while len(fib_sequence) < n: fib_sequence.append(fib_sequence[-1] + fib_sequence[-2]) return fib_sequence

Função para gerar a Flor da Vida

def flower_of_life(n): G = nx.Graph() for i in range(n): G.add_node(i) for i in range(1, n): for j in range(i+1, n): if (i+j)%2 == 1 and (i+j)%3 == 2: G.add_edge(i, j) return G

Função para gerar os números primos até n

def prime_numbers(n): return list(primerange(0, n))

Gerando a sequência de Fibonacci

fib_sequence = fibonacci(167)

Gerando a Flor da Vida

G = flower_of_life(167)

Gerando os números primos

primes = prime_numbers(167)

Plotando a Flor da Vida

pos = nx.spring_layout(G, k=0.4, seed=4) nx.draw(G, pos, node_color='lightblue', node_size=500, with_labels=True) plt.show()

Plotando a sequência de Fibonacci

plt.figure(figsize=(10, 5)) plt.plot(fib_sequence) plt.title('Fibonacci Sequence') plt.xlabel('Index') plt.ylabel('Value') plt.grid(True) plt.show()

Plotando os números primos

plt.figure(figsize=(10, 5)) plt.plot(primes) plt.title('Prime Numbers') plt.xlabel('Index') plt.ylabel('Value') plt.grid(True) plt.show()

bra1nDump commented 1 year ago

Closing at this seems python plotting related which is not supported and we don't have plans for it right now.

I also don't know the language in which this feature is written in so going off an code informed assumption here