<jupyter_start><jupyter_text>http://sagecell.sagemath.org/?q=pcefhm<jupyter_code>import numpy as np
import k3d
from matplotlib.tri import Triangulation


def p(x, b, c):
    return -x**3+c*x+b 

x = np.linspace(-0.815, 0.815, 100, dtype=np.float32)

plot = k3d.plot()
green_line = k3d.line(np.stack([3*x**2, x, -2*x**3]).T, shader='mesh', color=0x00ff00, width=0.03)


b = np.linspace(-2, 2, 100, dtype=np.float32)
c = np.linspace(-2, 2, 100, dtype=np.float32)
x = np.linspace(-2, 2, 100, dtype=np.float32)
x, b, c = np.meshgrid(x, b, c)

plane = k3d.marching_cubes(p(x, b, c), level=0.0, scaling=[4,4,4])
plot += plane + green_line

plot.display()
plot1 = k3d.plot()

def b(x,c): 
    return x**3 - c*x 

c = np.linspace(-2, 2, 100, dtype=np.float32)
x = np.linspace(-2, 2, 100, dtype=np.float32)
x, c = np.meshgrid(x, c)
x, c = np.ravel(x), np.ravel(c)
z = b(x,c)

filtr = (z<2.0) & (z>-2.0)

x = x[filtr]
c = c[filtr]
z = z[filtr]

tr = Triangulation(x,c)

mesh = k3d.mesh(np.stack([c, x, z]).T, tr.triangles.astype(np.uint32))

c = np.ones(100, dtype=np.float32)
x = np.linspace(-1.52, 1.52, 100, dtype=np.float32)
line1 = k3d.line(np.stack([c, x, b(x,c)]).T, shader='mesh', width=0.03, color=0xff0000)

c = np.zeros(100, dtype=np.float32)
x = np.linspace(-1.258, 1.258, 100, dtype=np.float32)

line2 = k3d.line(np.stack([c, x, b(x,c)]).T, shader='mesh', width=0.03, color=0xff0000) 

c = -np.ones(100, dtype=np.float32)
x = np.linspace(-1, 1, 100, dtype=np.float32)
line3 = k3d.line(np.stack([c, x, b(x,c)]).T, shader='mesh', width=0.03, color=0xff0000) 

plot1 += mesh + green_line +line1 + line2 + line3
plot1.display()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.22041062801932368, 'fraction_numerical': 0.09722222222222222, 'mean_word_length': 4.3624595469255665, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '135159', 'license': 'MIT', 'n_tokens_mistral': 896, 'n_tokens_neox': 809, 'n_words': 156, 'path': 'Processed_examples/Plane_with_green_line.ipynb', 'repo_name': 'K3D-tools/experiments', 'size': '1656'}