Calculation of square level roots
This model displays the calculation of the roots of a quadratic equation.
A quadratic equation is an algebraic equation of the second degree with a general form:
𝑎𝑥^2+𝑏𝑥+𝑐=0, 𝑎≠0
The model itself is shown in the picture below.
Next, we add an auxiliary function of the model and specify the coefficients of the equation.
In [ ]:
# Enabling the auxiliary model launch function.
function run_model( name_model)
Path = (@__DIR__) * "/" * name_model * ".engee"
if name_model in [m.name for m in engee.get_all_models()] # Checking the condition for loading a model into the kernel
model = engee.open( name_model ) # Open the model
model_output = engee.run( model, verbose=true ); # Launch the model
else
model = engee.load( Path, force=true ) # Upload a model
model_output = engee.run( model, verbose=true ); # Launch the model
engee.close( name_model, force=true ); # Close the model
end
sleep(5)
return model_output
end
Out[0]:
In [ ]:
a = 1;
b = 7;
c = 5;
Let's run the model and output the calculated tax amount.
In [ ]:
run_model("Root_Quadratic_Equation") # Launching the model.
Discriminant = collect(simout["Root_Quadratic_Equation/Discriminant"]);
x1 = collect(simout["Root_Quadratic_Equation/x1"]);
x2 = collect(simout["Root_Quadratic_Equation/x2"]);
println("Discriminant: " * string(Discriminant.value))
println("x1: " * string(x1.value))
println("x2: " * string(x2.value))
Conclusion
In this example, we have demonstrated the possibilities of using Engee for everyday tasks.