File:Number smaller then one after repetitive squaring.svg

Original file(SVG file, nominally 1,000 × 1,000 pixels, file size: 14 KB)

Summary

Description
English: Number smaller then one after repetive squaring. Also : radius abs(z) = r < 1.0 after some iterations using f0(z) = z*z
Date
Source Own work
Author Adam majewski

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Maxima CAS code

 /*  
batch file for Maxima CAS
 */ 



kill(all);
remvalue(all);





GiveList(r0):=
   /*  computes forward orbit of point r0
   and saves it to the list for draw package */
block(
 [r,l,i],
 r:r0, /* first point  */
 l:[[0,r]], 
 for i:1 thru 65 step 1 do
        ( r:r*r,
          l:endcons([i,r], l)),
         
 return(l) 
)$


compile(all);

/* ----------------- computations -------------------------------*/


l:GiveList(9.9999999999999956e-01);



/* ---------------- draw ------------------------------- */

path:"~/maxima/batch/julia/hyperbolic/0/"$ /*  if empty then file is in a home dir */
/* draw it using draw package by */
 load(draw); 
/* if graphic  file is empty (= 0 bytes) then run draw2d command again */
 draw2d(
  terminal  = 'svg,
  file_name = sconcat(path,"p"),
  user_preamble="set size square;set key top right",
  title= "Radius r<1.0 after iterations using function f(r)=r*r",
  dimensions = [1000, 1000],
  yrange = [-0.01,1.01],
  /*xrange = [ZxMin,ZyMax],*/
  xlabel     = "iteration ",
  ylabel     = "radius",
  point_type = filled_circle,
  points_joined =true,
  point_size    =  0.5,
  color         = red,
    
  
  key = "radius",
  points(l)
 
 );

C src code

/* 


gcc i.c -Wall

./a.out
*/


#include <stdio.h>
#include <float.h> // DBL_EPSILON
 
 int main()
 {
    
    double r = 1.0 - DBL_EPSILON; // maximal double value < 1.0
    double i = 0.0; // iteration number
         
    //check r value 
    if ( r != 1.0 )
     printf("initial r = %.16f and is good \n", r);
     else printf("r is not good, increase epsilon!!! \n");


     do 
     {
        r*=r; // r*r = r^2
        i+=1.0; // increase iteration number
	printf("r = %.16e after i = %.0f iterations   \n", r,i);
      }
     while ( r > DBL_MIN); // isnormal


     printf("final r = %.16e after i = %.0f iterations   \n", r,i);

    return 0;
 }

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

22 November 2015

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current12:30, 22 November 2015Thumbnail for version as of 12:30, 22 November 20151,000 × 1,000 (14 KB)Soul windsurferUser created page with UploadWizard

The following page uses this file:

Metadata