Перейти на страницу файла на Викискладе

Файл:Time series of the Tent map for the parameter m=2.0 which shows numerical error.svg

Материал из Википедии — свободной энциклопедии
Перейти к навигации Перейти к поиску

Исходный файл(SVG-файл, номинально 1000 × 1000 пкс, размер файла: 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
 
Исходный код этого SVG-файла корректен.
 
Это chart было создано с помощью Gnuplot
 
 Этот файл использует встроенный текст, который можно легко перевести через текстовый редактор.

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:ru:Creative Commons
атрибуция распространение на тех же условиях
Этот файл доступен по лицензии Creative Commons Attribution-Share Alike 4.0 International
Вы можете свободно:
  • делиться произведением – копировать, распространять и передавать данное произведение
  • создавать производные – переделывать данное произведение
При соблюдении следующих условий:
  • атрибуция – Вы должны указать авторство, предоставить ссылку на лицензию и указать, внёс ли автор какие-либо изменения. Это можно сделать любым разумным способом, но не создавая впечатление, что лицензиат поддерживает вас или использование вами данного произведения.
  • распространение на тех же условиях – Если вы изменяете, преобразуете или создаёте иное произведение на основе данного, то обязаны использовать лицензию исходного произведения или лицензию, совместимую с исходной.

Краткие подписи

Добавьте однострочное описание того, что собой представляет этот файл
Time series of the Tent map for the parameter m=2.0 which shows numerical error

Элементы, изображённые на этом файле

изображённый объект

У этого свойства есть некоторое значение без элемента в

image/svg+xml

История файла

Нажмите на дату/время, чтобы посмотреть файл, который был загружен в тот момент.

Дата/времяМиниатюраРазмерыУчастникПримечание
текущий18:31, 30 июня 2019Миниатюра для версии от 18:31, 30 июня 20191000 × 1000 (21 КБ)Soul windsurferbetter title
18:44, 28 июня 2019Миниатюра для версии от 18:44, 28 июня 20191000 × 1000 (21 КБ)Soul windsurferbetter title
18:42, 28 июня 2019Миниатюра для версии от 18:42, 28 июня 20191000 × 1000 (21 КБ)Soul windsurferUser created page with UploadWizard

Нет страниц, использующих этот файл.

Глобальное использование файла

Данный файл используется в следующих вики:

Метаданные