mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 14:20:39 +01:00
[code] Changed the base scripts: polynomial.py instead of fibonacci.py.
Change-Id: If80b20681dc04c5556c9b90bda230c7c3bee58a5
This commit is contained in:
@@ -47,6 +47,19 @@ 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", 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)");
|
||||
|
||||
const ScriptTemplate * ScriptTemplate::Empty() {
|
||||
return &emptyScriptTemplate;
|
||||
}
|
||||
@@ -63,6 +76,10 @@ const ScriptTemplate * ScriptTemplate::Mandelbrot() {
|
||||
return &mandelbrotScriptTemplate;
|
||||
}
|
||||
|
||||
const ScriptTemplate * ScriptTemplate::Polynomial() {
|
||||
return &polynomialScriptTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user