ملف:Time series of the Tent map for the parameter m=2.0 which shows numerical error.svg

الملف الأصلي(ملف SVG، أبعاده 1٬000 × 1٬000 بكسل، حجم الملف: 21 كيلوبايت)

ملخص

الوصف
English: Time series of the Tent map for the parameter m=2.0 which shows numerical error. This is decribed in Math Stack Exchange: "the plot of time series (plot of x variable with respect to number of iterations) stops fluctuating and no values are observed after n=50". Parameter m= 2.0, initial point is random.
التاريخ
المصدر عمل شخصي
المؤلف Adam majewski
إصدارات أخرى
SVG منشأ الملف
InfoField
 
الشيفرة المصدرية لهذا الرسم المتجه صالحة.
 
هذا الرسم المتجهي أُنشئ بواسطة Gnuplot
 
 This plot uses embedded text that can be easily translated using a text editor.

Long description

The problem: "the plot of time series (plot of x variable with respect to number of iterations) stops fluctuating and no values are observed after n=50".


Parameter m= 2.0, initial point is random.

Explanation

"You are experiencing an unfortunately interplay between computer numerics and dynamical systems.

In a binary representation x the signicand part comes with a certain number of bits. Multiplying by two (and mapping the result back into [0,1]) shifts those bits, and the last bit becomes zero. When the significand at the starts is represented by 50 bits it becomes identically zero after 50 iterations.

This happens for a couple of dynamical systems where chaos comes from multiplication by 2, 4 ,8,...

The tent map as defined by f(x)=1−|2x−1|, on [0,1] also works this way by successively putting least significant digit to zero and shifting to the left.

Other examples are:

  • f(x)=4xmod1 (which removes two digits at the time, so it gets constant within 25 iterations only),
  • or a more complicated one:

Again at each iteration at least one more least significant binary digit becomes zero.

On the other hand, f(x)=3xmod1 is chaotic in binary representation (at least sufficiently for you to notice the computer errors).

Similarly f(x)=4x(1−x) on [0,1] is chaotic also in binary arithmetics. Indeed multiplying by 4 sets the two last digits to zero, but the product x(1−x) will make these last two digits 'random' again. So apart from the last two digits (being zero) the numbers obtained on computer from xn+1=4xn(1−xn) will appear random (with respect to a certain calculable distribution) when starting from a random initial number in (0,1).

" H. H. Rugh


Solutions

Maxima Cas src code

Maxima CAS src code

/* 


https://math.stackexchange.com/questions/2453939/is-this-characteristic-of-tent-map-usually-observed
*/

kill(all);
remvalue(all);
ratprint:false; /* a message informing the user of the conversion of floating point numbers to rational numbers is displayed. */
display2d:false;


/* ---------- functions ---------------------------------------------------- */



/* https://en.wikipedia.org/wiki/Tent_map */

f(x) :=	if x<0.5  then m*x else m*(1-x) $
	
	
	
GivePoints(x0, iMax):= block(
	[Points,i,Point],
	i:0,
	x:x0,
	Point:[i,x],
	Points:[Point],
	while (i<iMax)
    	do
    	( 
    		x:f(x),
    		i:i+1,
    		Point:[i,x],
    		Points:endcons(Point, Points)
    	 	
    	),
    	return(Points) 
	


)$

/* const */
m: 2.0;	
x0:random (1.0);

iMax:100;



 Points:GivePoints(x0,iMax);




/* ------- draw --------------------------------------- */
load(draw);
path:"~/maxima/batch/tent/t1/"$ /*  pwd, if empty then file is in a home dir , path should end with "/" */


draw2d(
  user_preamble="set key top right; unset mouse; ",
  terminal  = 'svg,
  file_name = sconcat(path,"p", string(m),"_", string(x0)),
  font_size = 30,
  font = "Liberation Sans", /* https://commons.wikimedia.org/wiki/Help:SVG#Font_substitution_and_fallback_fonts */
  title= "Time series of the Tent map for the parameter m=2.0 ",
  xlabel     = "iteration ",
  ylabel     = "x",
  dimensions = [1000, 1000],
  yrange=[0,1],
  color= blue,
  point_type = filled_circle,
  point_size    =  0.2,
  points_joined =true,
  key = "",
  points(Points)
  
  
  
  )$

C code

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/* 

https://math.stackexchange.com/questions/2453939/is-this-characteristic-of-tent-map-usually-observed

 gcc t.c -Wall
a@zelman:~/c/varia/tent$ ./a.out

*/



/* ------------ constans  ---------------------------- */
double m = 2.0; /* parameter of tent map */
double a = 1.0; /* upper bound for randum number generator */
int iMax = 100;
/* ------------------- functions --------------------------- */


/* 

tent map 
https://en.wikipedia.org/wiki/Tent_map

*/
double f(double x0, double m){

	double x1;
	if (x0 < 0.5) 
		x1 = m*x0;
		else x1 = m*(1.0 - x0);
	return x1;

}



/* random double from 0.0 to a 
https://stackoverflow.com/questions/13408990/how-to-generate-random-float-number-in-c


*/
double GiveRandom(double a){
	srand((unsigned int)time(NULL));
	
	return  (((double)rand()/(double)(RAND_MAX)) * a);

}

int main(void){

	int i = 0;
	double x = GiveRandom(a); /* x0 = random */
	
	for (i = 0; i<iMax; i++){
	
		printf("i = %3d \t x = %.16f\n",i, x);
		x = f(x,m); /* iteration of the tent map */
	}

	return 0;
}

Text code

result:
 
i =   0 	 x = 0.1720333817284710
i =   1 	 x = 0.3440667634569419
i =   2 	 x = 0.6881335269138839
i =   3 	 x = 0.6237329461722323
i =   4 	 x = 0.7525341076555354
i =   5 	 x = 0.4949317846889292
i =   6 	 x = 0.9898635693778584
i =   7 	 x = 0.0202728612442833
i =   8 	 x = 0.0405457224885666
i =   9 	 x = 0.0810914449771332
i =  10 	 x = 0.1621828899542663
i =  11 	 x = 0.3243657799085327
i =  12 	 x = 0.6487315598170653
i =  13 	 x = 0.7025368803658694
i =  14 	 x = 0.5949262392682613
i =  15 	 x = 0.8101475214634775
i =  16 	 x = 0.3797049570730451
i =  17 	 x = 0.7594099141460902
i =  18 	 x = 0.4811801717078197
i =  19 	 x = 0.9623603434156394
i =  20 	 x = 0.0752793131687213
i =  21 	 x = 0.1505586263374425
i =  22 	 x = 0.3011172526748851
i =  23 	 x = 0.6022345053497702
i =  24 	 x = 0.7955309893004596
i =  25 	 x = 0.4089380213990808
i =  26 	 x = 0.8178760427981615
i =  27 	 x = 0.3642479144036770
i =  28 	 x = 0.7284958288073540
i =  29 	 x = 0.5430083423852921
i =  30 	 x = 0.9139833152294159
i =  31 	 x = 0.1720333695411682
i =  32 	 x = 0.3440667390823364
i =  33 	 x = 0.6881334781646729
i =  34 	 x = 0.6237330436706543
i =  35 	 x = 0.7525339126586914
i =  36 	 x = 0.4949321746826172
i =  37 	 x = 0.9898643493652344
i =  38 	 x = 0.0202713012695312
i =  39 	 x = 0.0405426025390625
i =  40 	 x = 0.0810852050781250
i =  41 	 x = 0.1621704101562500
i =  42 	 x = 0.3243408203125000
i =  43 	 x = 0.6486816406250000
i =  44 	 x = 0.7026367187500000
i =  45 	 x = 0.5947265625000000
i =  46 	 x = 0.8105468750000000
i =  47 	 x = 0.3789062500000000
i =  48 	 x = 0.7578125000000000
i =  49 	 x = 0.4843750000000000
i =  50 	 x = 0.9687500000000000
i =  51 	 x = 0.0625000000000000
i =  52 	 x = 0.1250000000000000
i =  53 	 x = 0.2500000000000000
i =  54 	 x = 0.5000000000000000
i =  55 	 x = 1.0000000000000000
i =  56 	 x = 0.0000000000000000
i =  57 	 x = 0.0000000000000000
i =  58 	 x = 0.0000000000000000
i =  59 	 x = 0.0000000000000000
i =  60 	 x = 0.0000000000000000
i =  61 	 x = 0.0000000000000000
i =  62 	 x = 0.0000000000000000
i =  63 	 x = 0.0000000000000000
i =  64 	 x = 0.0000000000000000
i =  65 	 x = 0.0000000000000000
i =  66 	 x = 0.0000000000000000
i =  67 	 x = 0.0000000000000000
i =  68 	 x = 0.0000000000000000
i =  69 	 x = 0.0000000000000000
i =  70 	 x = 0.0000000000000000
i =  71 	 x = 0.0000000000000000
i =  72 	 x = 0.0000000000000000
i =  73 	 x = 0.0000000000000000
i =  74 	 x = 0.0000000000000000
i =  75 	 x = 0.0000000000000000
i =  76 	 x = 0.0000000000000000
i =  77 	 x = 0.0000000000000000
i =  78 	 x = 0.0000000000000000
i =  79 	 x = 0.0000000000000000
i =  80 	 x = 0.0000000000000000
i =  81 	 x = 0.0000000000000000
i =  82 	 x = 0.0000000000000000
i =  83 	 x = 0.0000000000000000
i =  84 	 x = 0.0000000000000000
i =  85 	 x = 0.0000000000000000
i =  86 	 x = 0.0000000000000000
i =  87 	 x = 0.0000000000000000
i =  88 	 x = 0.0000000000000000
i =  89 	 x = 0.0000000000000000
i =  90 	 x = 0.0000000000000000
i =  91 	 x = 0.0000000000000000
i =  92 	 x = 0.0000000000000000
i =  93 	 x = 0.0000000000000000
i =  94 	 x = 0.0000000000000000
i =  95 	 x = 0.0000000000000000
i =  96 	 x = 0.0000000000000000
i =  97 	 x = 0.0000000000000000
i =  98 	 x = 0.0000000000000000
i =  99 	 x = 0.0000000000000000



ترخيص

أنا، صاحب حقوق التأليف والنشر لهذا العمل، أنشر هذا العمل تحت الرخصة التالية:
w:ar:مشاع إبداعي
نسب العمل إلى مُؤَلِّفه الإلزام بترخيص المُشتقات بالمثل
يحقُّ لك:
  • مشاركة العمل – نسخ العمل وتوزيعه وبثُّه
  • إعادة إنتاج العمل – تعديل العمل
حسب الشروط التالية:
  • نسب العمل إلى مُؤَلِّفه – يلزم نسب العمل إلى مُؤَلِّفه بشكل مناسب وتوفير رابط للرخصة وتحديد ما إذا أجريت تغييرات. بالإمكان القيام بذلك بأية طريقة معقولة، ولكن ليس بأية طريقة تشير إلى أن المرخِّص يوافقك على الاستعمال.
  • الإلزام بترخيص المُشتقات بالمثل – إذا أعدت إنتاج المواد أو غيرت فيها، فيلزم أن تنشر مساهماتك المُشتقَّة عن الأصل تحت ترخيص الأصل نفسه أو تحت ترخيص مُتوافِقٍ معه.

الشروحات

أضف شرحاً من سطر واحد لما يُمثِّله هذا الملف
Time series of the Tent map for the parameter m=2.0 which shows numerical error

العناصر المصورة في هذا الملف

يُصوِّر

٢٨ يونيو 2019

تاريخ الملف

اضغط على زمن/تاريخ لرؤية الملف كما بدا في هذا الزمن.

زمن/تاريخصورة مصغرةالأبعادمستخدمتعليق
حالي18:31، 30 يونيو 2019تصغير للنسخة بتاريخ 18:31، 30 يونيو 20191٬000 × 1٬000 (21 كيلوبايت)Soul windsurferbetter title
18:44، 28 يونيو 2019تصغير للنسخة بتاريخ 18:44، 28 يونيو 20191٬000 × 1٬000 (21 كيلوبايت)Soul windsurferbetter title
18:42، 28 يونيو 2019تصغير للنسخة بتاريخ 18:42، 28 يونيو 20191٬000 × 1٬000 (21 كيلوبايت)Soul windsurferUser created page with UploadWizard

الصفحة التالية تستخدم هذا الملف:

الاستخدام العالمي للملف

الويكيات الأخرى التالية تستخدم هذا الملف:

بيانات وصفية