Created
          April 6, 2018 08:45 
        
      - 
      
- 
        Save ceptreee/fb4fa937d588d2364fca395a307404c5 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | using Plots; gr(); | |
| ENV["PLOTS_TEST"] = "true" | |
| using IntervalArithmetic | |
| N = 27 | |
| x0 = @interval(0.11) | |
| x0_sol = 0.11 | |
| f(x) = 4*x*(1-x) | |
| sol(n, x0) = ( 1 - cos(2^n * acos(1-2x0) ) ) / 2 | |
| x_sol = sol.(1:N, x0_sol) | |
| xhi = zeros(N) | |
| xlo = zeros(N) | |
| x = x0 | |
| for n in 1:N | |
| x = f(x) | |
| xhi[n] = x.hi | |
| xlo[n] = x.lo | |
| end | |
| plot(1:N, xlo, label="lo", ls=:dash) | |
| plot!(1:N, xhi, label="hi", ls=:dash) | |
| plot!(1:N, x_sol, label="exact") | |
| savefig("IA.png") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | using Plots; gr(); | |
| ENV["PLOTS_TEST"] = "true" | |
| using IntervalArithmetic | |
| setprecision(Interval,500) | |
| N = 251 | |
| x0 = @interval(0.11) | |
| x0_sol = big"0.11" | |
| f(x) = 4*x*(1-x) | |
| sol(n, x0) = (big"1" - cos(big"2"^n*acos(big"1"-big"2"*x0)))/big"2" | |
| x_sol = sol.(1:N, x0_sol) | |
| xhi = zeros(N) | |
| xlo = zeros(N) | |
| x = x0 | |
| for n in 1:N | |
| x = f(x) | |
| xhi[n] = x.hi | |
| xlo[n] = x.lo | |
| end | |
| plot(1:N, xlo, label="lo", ls=:dash) | |
| plot!(1:N, xhi, label="hi", ls=:dash) | |
| plot!(1:N, x_sol, label="exact") | |
| savefig("IA_500.png") | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment