mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/code] Put back the polynomial script
This commit is contained in:
@@ -40,13 +40,18 @@ def mandelbrot(N_iteration):
|
||||
# Draw a pixel colored in 'col' at position (x,y)
|
||||
kandinsky.set_pixel(x,y,col))");
|
||||
|
||||
constexpr ScriptTemplate polynomialScriptTemplate("polynomial.py", "\x01" R"(from pyplot import *
|
||||
x = [1,2,3,4]
|
||||
y = [-1,-2,-3,-4]
|
||||
scatter(x, y)
|
||||
plot(y, x)
|
||||
text(-1,-1,"Coucou")
|
||||
show())");
|
||||
constexpr ScriptTemplate polynomialScriptTemplate("polynomial.py", "\x01" R"(from math import *
|
||||
# roots(a,b,c) computes the solutions of the equation a*x**2+b*x+c=0
|
||||
def roots(a,b,c):
|
||||
delta = b*b-4*a*c
|
||||
if delta == 0:
|
||||
return -b/(2*a)
|
||||
elif delta > 0:
|
||||
x_1 = (-b-sqrt(delta))/(2*a)
|
||||
x_2 = (-b+sqrt(delta))/(2*a)
|
||||
return x_1, x_2
|
||||
else:
|
||||
return None)");
|
||||
|
||||
constexpr ScriptTemplate parabolaScriptTemplate("parabola.py", "\x01" R"(from matplotlib.pyplot import *
|
||||
from math import *
|
||||
|
||||
Reference in New Issue
Block a user