using Plots using LaTeXStrings function func_f(x) @assert -2 <= x <= 2 "Input not in the domain of definition." if x < 0 return -x^2 elseif 0 ≤ x ≤ 1 return x else return x^2 + 1 end end function plot_f() #Initialization x = -2:0.1:2 #Processing y = func_f.(x) #Postprocessing p = plot(x,y,label=nothing) scatter!(x,y,label=nothing) xlabel!(L"-2 \leq x \leq 2") #LaTeXStrings is needed here, notice the L before the string. ylabel!("f(x)") return p end plot_f() """ This is how we want your submissions for the exams to be written, here plot_f provides a function that does everything immediately for the user, which takes care of Initialization, Processing and Postprocessing. """