-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathexamples.jl
More file actions
33 lines (21 loc) · 758 Bytes
/
examples.jl
File metadata and controls
33 lines (21 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module Working_function
using IntervalArithmetic
struct Working_func{F<:Function, reg<:Union{Interval, IntervalBox}}
title::String
region::reg
func::F
end
end
module OneDimExamples
using IntervalArithmetic, IntervalOptimisation
import ..Working_function:Working_func
func1 = Working_func("Quadratic equation", (-1..2), x->x*(x-1) )
func2 = Working_func("Cubic equation", (-1..4), x->(x-2)^3-5x )
func3 = Working_func("Quartic equation", (-4..6), x->(x-6)*(x+4)*(7x^2+10x+24) )
end
module TwoDimExamples
using IntervalArithmetic, IntervalOptimisation
import ..Working_function:Working_func
rosenbrock(xx) = ( (x, y) = xx; 100*(y - x)^2 + (x - 1)^2 )
Rosenbrock = Working_func("Rosenbrock function", IntervalBox(-5..5, 2), rosenbrock)
end