(* %use "Hotspot/hotspot.fsh";; *) (* A simple example of the use of the difference equation solver *) %use "Difference_equations/difference.fsh";; %use "Statistics/statistics.fsh" ;; %use "Statistics/norms.fsh" ;; let epsilon = 0.1 ;; let near b x y = l2_norm (zipop subtract_float x y) <. epsilon ;; let hotspot x = diff_solver_outer (fun x -> 0.0) // temperature on boundary is 0.0 (fun x -> mean x +. 1.0) // new temperature is average of neighbours +1 (ones #x) (ones #x) // nearest neighbours only near // convergence test x // initial value ;; let hotspot1 = hotspot (copy {4:float_shape} 0.0) ;; let hotspot2 = hotspot (copy {3,4:float_shape} 0.0) ;;