  # Passenger

Members

13

## Everything posted by Passenger

1. If someone divides by zero, your own reason. For example, division by zero is allowed in the generation of the least squares polynomial.
2. /****************************************************************************** * Jouni Aro * * 20.2.20 * * * * The multidimensional algebra * * * * The possibilities of algebra is associated with a sort of tool, with which * * parallel causations can be harnessed and approximated into compact * * functions. When you draw a roughly smooth curve into the screen with the * * mouse, the algebra is able to approximate the given set of dots into a * * short function. The craft of algebra is in its ability to describe * * phenomenons and the nature. * * * * What if you draw curves of different colors into the screen? The white set * * of dots is the temperature, the yellow is the direction of the wind, the * * orange is the time of year, the blue would represent the humidity etc. * * Every set of dots can be described as an individual phenomenon, but what * * about the function, that alone would describe the causations of the whole * * set? * * * * The relation of the function can also be asymmetrical. When the input of * * the weather function can be n number of initations, the output can only be * * a relatively blurry parameter between 0 to 1, whether you should go fishing * * or not. * * * * *** * * * * The computer can be programmed to study mathematics. With the solid axioms * * of algebra and the consistent development of series, the bit monster can * * immerse itself further into geometry and symmetry. In the final solution * * the computer was partly forced to abandon the symbolic concepts which * * include the positive, the negative, the real and the imaginary. The algebra * * doesn't need to share its opinion on in what direction the monitor is put * * on the table. * * * * The algorithms of algebra are constant and its objects can describe * * whatsoever. One of the most beautiful formulae of the algebra is the * * polynomial adaption of the smallest sum of squares: * * * * If the object that is placed in the formula is valid and balanced with * * itself, the algebra will process the substance with rational results, * * otherwise not. A good example is the quaternion. The algebra does not * * editorialise to the inner calculation logic of the quartenion. * * * * *** * * * * i^2 is -1, but what is the object that gives the result of -i when squared? * * There's an interesting connection between the companions of the i, * * |e^(xi+yj+zk+...)| = 1. The multidimensional algebra also connects the pi * * and the number one. pi^z limit on the real axis approaches the value of 1, * * when the z-unit vector is excited further and further from the real axis. * * At the same time, the sum of the absolute values of the axises approaches * * to the pi. * * * * Next up are the simple calculation rules of the recomplex number with the * * C++ examples. The class itself can do almost as such in the MatLab -tool. * * * * ~ recomplex * * ~ order * * ~ specification of class * * ~ addition * * ~ subtraction * * ~ multiplication * * ~ products of vector basis * * ~ division * * ~ abs(recomplex) * * ~ pow(recomplex, int) * * ~ ln(recomplex) * * ~ exp(recomplex) * * ~ pow(recomplex, double) * * ~ pow(recomplex, recomplex) * * ~ sin(recomplex) * * ~ cos(recomplex) * * ~ the port example of the smallest sum of squares * * ~ the connection of the pi and number one * * ~ code attachment * * * * *** * * * * The complex number is a real subset of the recomplex number. Real numbers * * and imaginary numbers for their parts are real subsets of the complex * * number. The prefix "re" points to the feedback, repeating the same basic * * logic in the next scale. * * * * ~~~ order ~~~ * * * * The order goes in power of two, 1, 2, 4, ..., 2^n. The real numbers are * * adjusted with the order of 1. The complex numbers come into effect with the * * order of 2. In the order of 4 the complex numbers get a complex object on * * their side, functioning by the stopper logic. The union of these makes * * simple function maps for the parallel causation phenomena possible, among * * other things. * /*****************************************************************************/ /****************************************************************************** * ~~~ class specification ~~~ * * * * C++ implemented an operator load, when especially the calculation * * operations of the numeric structures on the computer don't differ from the * * regular straightforwardness. * ******************************************************************************/ #include <math.h> #include <stdio.h> #include <conio.h> #include <memory.h> #include <stdlib.h> class recomplex { public: /************************************ * The dimension should be: * * 1, 2, 4, ..., 2^n * * DIMENSION 1 -> real numbers * * DIMENSION 2 -> complex numbers * * DIMENSION 4 -> 4D complex numbers * * DIMENSION 8 -> 8D complex numbers * ************************************/ #define DIMENSION 4 double e[DIMENSION]; recomplex(void); ~recomplex(void); recomplex(double*); recomplex(int); recomplex(int, int); recomplex(int, int, int, int); recomplex(double); recomplex(double, double); recomplex(double, double, double, double); friend void print(recomplex); friend double abs(recomplex); friend recomplex sqrt(recomplex); friend recomplex operator-(recomplex); friend recomplex operator+(recomplex, recomplex); friend recomplex operator-(recomplex, recomplex); friend recomplex operator*(recomplex, recomplex); friend recomplex operator/(recomplex, recomplex); friend recomplex operator*(recomplex, double); friend recomplex operator/(recomplex, double); friend recomplex operator*(double, recomplex); friend recomplex operator/(double, recomplex); friend recomplex pow(recomplex, int); }; /****************************************************************************** * ~~~ addition ~~~ * * * * If you're unfamiliar with the C, a few words about it. The basis of C is * * to save sheets. Every excessive and unnecessary rambling is eliminated * * from the syntax. The operators if C are very effective. For example +=, *=, * * /=, ... perform the operation in question and after that the assignment. * * a.e[n]+=b.e[n] means the same that a.e[n]=a.e[n]+b.e[n]. Because the latter * * style consumes more of paper, the shorter version of the same thing * * a.e[n]+=b.e[n] is used in the C. * ******************************************************************************/ recomplex operator+(recomplex a, recomplex b) { for (int n=0; n<DIMENSION; n++) a.e[n]+=b.e[n]; return a; } /****************************************************************************** * For example: * * * * recomplex A(2, 3, -5, 7); * * recomplex B(7, 5, -3, 2); * * print(A + B); * * * * Prints a value of 9 + 8i - 8j + 9k. * ******************************************************************************/ /****************************************************************************** * ~~~ subtraction ~~~ * ******************************************************************************/ recomplex operator-(recomplex a, recomplex b) { for (int n=0; n<DIMENSION; n++) a.e[n]-=b.e[n]; return a; } /****************************************************************************** * For exsample: * * * * recomplex A(2, 3, 5, 7); * * recomplex B(7, 5, 3, 2); * * print(A-B); * * * * The value of the difference is -5 - 2i + 2j + 5k * ******************************************************************************/ /****************************************************************************** * ~~~ multiplication ~~~ * * * * The multiplication first requires a product definition of the base vectors. * * Looping the product does not editorialise to the formal positive, negative, * * real, imaginary, etc. definitions. The product of the multiplication is * * returned to the sum form so far only in the last loop. * ******************************************************************************/ recomplex operator*(recomplex a, recomplex b) { int *BasisVectors(void); int *R = BasisVectors(); int i, j, n=DIMENSION*2; double x[DIMENSION*2]; double y[DIMENSION*2]; double t[DIMENSION*2]; for (i=j=0; i<DIMENSION; i++, j+=2) x[j+1]=y[j+1]=t[j]=t[j+1]=0.0, x[j]=a.e[i], y[j]=b.e[i]; for (i=0; i<n; i++) for (j=0; j<n; j++) t[R[i*n+j]]+=x[i]*y[j]; for (i=j=0; i<DIMENSION; i++, j+=2) t[i]=(double)(t[j] - t[j+1]); return *(recomplex*) t; } /****************************************************************************** * For exsample: * * * * recomplex A(2, 3, 5, 7); * * recomplex B(7, 5, 3, 2); * * print(A * B); * * * * The outcome is -32 + 32i + 87k. The multiplication is commutative. If A and * * B are complex, the outcome is complex. * * * * recomplex A(2, 3, 0, 0); * * recomplex B(7, 5, 0, 0); * * print(A * B); * * * * You'll get the output -1 + 31i * ******************************************************************************/ /****************************************************************************** * ~~~ the products of the base vectors ~~~ * * * * The products of the base vectors are generated by the recursive function. * * All the products of the base vectors associated with the order of 4 are * * assembled in the chart: * * * * # 1 | -1 | i | -i | j | -j | k | -k | * * ############################################ * * 1 # 1 | -1 | i | -i | j | -j | k | -k | * * ---#----|----|----|----|----|----|----|----| * * -1 # -1 | 1 | -i | i | -j | j | -k | k | * * ---#----|----|----|----|----|----|----|----| * * i # i | -i | -1 | 1 | k | -k | -j | j | * * ---#----|----|----|----|----|----|----|----| * * -i # -i | i | 1 | -1 | -k | k | j | -j | * * ---#----|----|----|----|----|----|----|----| * * j # j | -j | k | -k | i | -i | -1 | 1 | * * ---#----|----|----|----|----|----|----|----| * * -j # -j | j | -k | k | -i | i | 1 | -1 | * * ---#----|----|----|----|----|----|----|----| * * k # k | -k | -j | j | -1 | 1 | -i | i | * * ---#----|----|----|----|----|----|----|----| * * -k # -k | k | j | -j | 1 | -1 | i | -i | * * ---#----|----|----|----|----|----|----|----| * * * * For example ijk = -i, and particularly k^2 = -i. Commutativity remains, * * because still: * * * * ikj = jik = jki = kij = kji = -i * ******************************************************************************/ void GenerateTheProductsOfTheBaseVectors(int *R, int n) { int I=0, J=n-1, i; int X=n, Y=J+n, j; int k=DIMENSION*2; for (i=I; i<=J; i++) for (j=I; j<=J; j++) { R[i*k+X+j]=R[i*k+j]+X; R[(X+j)*k+i]=R[i*k+j]+X; R[(Y-i)*k+Y-j]=J-R[i*k+j]; } if (n+n < DIMENSION*2) { GenerateTheProductsOfTheBaseVectors(R, n+n); } } int* BasisVectors(void) { static int R[DIMENSION*DIMENSION*4]={-1}; if (R == -1) { int FirstThereWasZero=0; R[0x00]=(int)FirstThereWasZero; GenerateTheProductsOfTheBaseVectors(R, 1); } return R; } /****************************************************************************** * ~~~ division ~~~ * * * * In division, a complex conjugate is produced for the divisor, with which * * the divisor and the dividend are multiplied. In the end of every loop step * * there's a half less of axel values of the divisor (the rest are summed up * * to nulls). When the value of the divisor is real, the elements of the * * dividend are divided by the value. For example 2 + 3i + 5j + 7k the mounted * * number is 2 + 3i - 5j - 7k. * ******************************************************************************/ recomplex operator/(recomplex x, recomplex y) { recomplex z; for (int i, n=DIMENSION; n>=2; n/=2) { for (z=y, i=n/2; i<n; i++) z.e[i] = -z.e[i]; x=x*z; y=y*z; } return x/y.e; } /****************************************************************************** * For exsample * * * * recomplex A(2, 3, 5, 7); * * recomplex B(7, 5, 3, 2); * * print(A / B); * * * * The product of division is 0.5488136 - 0.1575801i + 0.7181670j + 0.3977540k.* * If A and B are complex, the result is complex: * * * * recomplex A(2, 3, 0, 0); * * recomplex B(7, 5, 0, 0); * * * print(A / B); * * * * The output of the value is 0.3918919 + 0.1486486i * ******************************************************************************/ recomplex operator/(recomplex x, double k) { for (int i=0; i<DIMENSION; i++) x.e[i]/=(double)k; return x; } recomplex operator*(double k, recomplex x) { for (int i=0; i<DIMENSION; i++) x.e[i]*=(double)k; return x; } recomplex operator*(recomplex x, double k) { return k*x; } recomplex operator/(double k, recomplex x) { return recomplex(k)/x; } /****************************************************************************** * ~~~ abs(recomplex) ~~~ * * * * In the absolute value x is multiplied by its complex conjugate repeatedly. * * The value then returns the breaking power collected by j. * ******************************************************************************/ double abs(recomplex x) { recomplex z; double r, c; int i, j=1, n; for (n=DIMENSION; n>=2; n/=2, j+=j) { for (z=x, i=n/2; i<n; i++) z.e[i]=-z.e[i]; x=x*z; } r=fabs(x.e); c=1.0/(double)j; return pow(r, c); } /****************************************************************************** * For exsample: * * * * recomplex A(2, 3, 5, 7); * * recomplex B(7, 5, 3, 2); * * printf("%25.20f\n", abs(A/B)); * * * * The double of the C is precise, because the absolute value of the result is * * exactly 1.00000000000000000000 * ******************************************************************************/ /****************************************************************************** * ~~~ pow(recomplex, int) ~~~ * * * * The limit of x^0 is 1, when x approaches the null. Calculators have * * variable interpretations, whether the 0^0 is about 1 or is the calculation * * aborted and is the output of the status an error. In the polynomial * * adaption of the smallest sum of squares x^0 has to be 1 also with the x's * * limit null. An exponent n can be a positive or a negative integer. * ******************************************************************************/ recomplex pow(recomplex x, int n) { if (n) { recomplex t=x; int i=n<0? -n: n; for (--i; i; i--) t=t*x; return n>0? t: recomplex(1) / t; } else { return recomplex(1); } } /****************************************************************************** * ~~~ print(recomplex) ~~~ * * * * Somewhere around 20 element, when the marking of the base vector is bigger * * than 'z', the marking of the base vector can be a symbol differentiated * * from the letter. In the calculations themselves the symbols are not * * editorialised. * ******************************************************************************/ void print(recomplex a) { printf("%0.9f ", a.e); for (int n=1; n<DIMENSION; n++) printf("%c %0.9f%c ", a.e[n]<0? '-': '+', fabs(a.e[n]), 'h'+n); printf("\n"); } /****************************************************************************** * These functions still need to be explored * * * * ~~~ ln(recomplex) ~~~ * * ~~~ exp(recomplex) ~~~ * * ~~~ pow(recomplex, double) ~~~ * * ~~~ pow(recomplex, recomplex) ~~~ * * ~~~ sin(recomplex) ~~~ * * ~~~ cos(recomplex) ~~~ * ******************************************************************************/ recomplex::recomplex(void) { memset(this, 0, sizeof(recomplex)); } recomplex::~recomplex(void) { } recomplex::recomplex(double *a) { memset(this, 0, sizeof(recomplex)); for (int i=0x00; i<DIMENSION; i++) e[i]=a[i]; } recomplex::recomplex(int a) { memset(this, 0, sizeof(recomplex)); e=(double)a; } recomplex::recomplex(double a) { memset(this, 0, sizeof(recomplex)); e=(double)a; } recomplex::recomplex(int a, int b) { memset(this, 0, sizeof(recomplex)); e=(double)a; e=(double)b; } recomplex::recomplex(double a, double b) { memset(this, 0, sizeof(recomplex)); e=(double)a; e=(double)b; } recomplex::recomplex(int a, int b, int c, int d) { memset(this, 0, sizeof(recomplex)); e=(double)a; e=(double)b; e=(double)c; e=(double)d; } recomplex::recomplex(double a, double b, double c, double d) { memset(this, 0, sizeof(recomplex)); e=(double)a; e=(double)b; e=(double)c; e=(double)d; } /*************************************************** * Returns the square root of parameter c. Function * * has been implemented in Newton's processing. * ***************************************************/ recomplex sqrt(recomplex c) { int i; recomplex x; double R[DIMENSION]; for (i=0; i<DIMENSION; i++) { int sgn = rand()%0x02? -1: +1; R[i]=sgn*rand()/(double)32767; } x=recomplex((double*)R); for (i=0; i<1024; i++) x=x-(x*x-c)/(2.0*x); return (recomplex)x; } /********************************************** * the mainfunction tests the income swap law. * **********************************************/ int main(void) { recomplex x(0.12, -0.34, 0.56, -0.78); recomplex y(0.98, -0.76, 0.54, -0.32); printf("x = "); print(x); printf("y = "); print(y); printf("\n"); printf("x*y = "); print(x*y); printf("y*x = "); print(y*x); printf("\n"); getch(); return 0; }
3. I calculated this fractal with 4D complex numbers. (j and k axis fractal zoom)
4. Zooming Julia's crowd. I programmed this image sometime in the early millennium.
5. ~~~ least squares fitting example ~~~ For example: One phenomenon related to the time was that at time 1 the value 14 + 8j + 11l - 3n was measured. At time 2, a value of -3 + 10j + 15l - 7n was measured. It was found that the cause-effect of the phenomenon was approximately in accordance with the values: x0 = 1, y0 = 14 + 8j + 11l - 3n x1 = 2, y1 = -3 + 10j + 15l - 7n x2 = 3, y2 = -12 + 14j + 20l - 11n x3 = 4, y3 = -20 + 17j + 23l - 15n x4 = 5, y4 = -25 + 19j + 24l - 17n x5 = 6, y5 = -28 + 22j + 24l - 21n x6 = 7, y6 = -27 + 24j + 23l - 24n x7 = 8, y7 = -25 + 27j + 20l - 27n x8 = 9, y8 = -23 + 27j + 17l - 28n x9 = 10, y9 = -18 + 27j + 13l - 32n x10 = 11, y10 = -13 + 28j + 11l - 33n x11 = 12, y11 = -4 + 28j + 6l - 35n x12 = 13, y12 = 1 + 28j + 2l - 35n x13 = 14, y13 = 9 + 27j - 3l - 35n x14 = 15, y14 = 15 + 26j - 6l - 35n x15 = 16, y15 = 22 + 24j - 10l - 37n x16 = 17, y16 = 26 + 21j - 13l - 37n x17 = 18, y17 = 30 + 21j - 17l - 36n x18 = 19, y18 = 33 + 17j - 18l - 35n x19 = 20, y19 = 34 + 13j - 19l - 33n x20 = 21, y20 = 32 + 11j - 17l - 32n x21 = 22, y21 = 28 + 7j - 15l - 30n x22 = 23, y22 = 22 + 2j - 11l - 29n x23 = 24, y23 = 12 - 2j - 7l - 26n x24 = 25, y24 = -1 - 8j + 0l - 22n Based on the graphical analysis, it was decided to fit a cube parable to the phenomenon. Placing the measured response values in the least squares formula gives the cubic parabola coefficients: f(x) = k0 + k1x^1 + k2x^2 + k3x^3, where k0 = 31.479 + 2.882j + 2.508l + 1.642n k1 = -20.364 + 4.297j + 8.735l - 4.578n k2 = 2.068 - 0.179j - 1.029l + 0.124n k3 = -0.052 + 0.000j + 0.027l + 0.001n the recomplex cube parabola describes the phenomenon well. At initial values of x, the function values are: f (recomplex(1)) = 13.131 + 7.000j + 10.241l - 2.810n f (recomplex(2)) = -1.394 + 10.758j + 16.080l - 7.009n f (recomplex(3)) = -12.409 + 14.152j + 20.185l - 10.950n f (recomplex(4)) = -20.227 + 17.181j + 22.720l - 14.628n f (recomplex(5)) = -25.163 + 19.842j + 23.846l - 18.038n f (recomplex(6)) = -27.528 + 22.134j + 23.725l - 21.175n f (recomplex(7)) = -27.638 + 24.053j + 22.520l - 24.035n f (recomplex(8)) = -25.805 + 25.598j + 20.393l - 26.612n f (recomplex(9)) = -22.342 + 26.766j + 17.506l - 28.903n f (recomplex(10)) = -17.563 + 27.554j + 14.021l - 30.901n f (recomplex(11)) = -11.782 + 27.961j + 10.100l - 32.602n f (recomplex(12)) = -5.311 + 27.984j + 5.906l - 34.002n f (recomplex(13)) = 1.536 + 27.621j + 1.600l - 35.095n f (recomplex(14)) = 8.445 + 26.870j - 2.655l - 35.876n f (recomplex(15)) = 15.103 + 25.728j - 6.697l - 36.342n f (recomplex(16)) = 21.197 + 24.192j - 10.364l - 36.487n f (recomplex(17)) = 26.413 + 22.261j - 13.493l - 36.305n f (recomplex(18)) = 30.438 + 19.932j - 15.924l - 35.794n f (recomplex(19)) = 32.959 + 17.203j - 17.493l - 34.946n f (recomplex(20)) = 33.661 + 14.072j - 18.038l - 33.759n f (recomplex(21)) = 32.232 + 10.535j - 17.397l - 32.226n f (recomplex(22)) = 28.359 + 6.592j - 15.408l - 30.343n f (recomplex(23)) = 21.727 + 2.239j - 11.909l - 28.106n f (recomplex(24)) = 12.024 - 2.525j - 6.737l - 25.509n f (recomplex(25)) = -1.064 - 7.704j + 0.269l - 22.547n Algebra does not take a stand on the quality symbolically agreed for each axis. The unit vector l may represent, for example, snowfall as moles. The real axis, i and its companion features have remarkable automation where different qualities can communicate with each other. Multidimensional algebra is recursively generated from zero.
6. That is, you cannot talk about any technology at code level. A new way to generate pseudorandom numbers was in the next- and rnd-functions. But it doesn't hurt if the forum is forbidden to display the code. At least I enjoy reading other people's codes, and at best I try the other person's code myself.
7. // 64-bit random number generator. // CODE DELETED }
8. Scale over 20 years ago. I program now the fractal carbon colors. Each pixel contains 256 * 256 mosaic information, resulting in an image resolution of 216 (65 536).
10. By eliminating symbolic signs for multiplication, complex spaces are possible. I studied this problem for over a decade until it was resolved. Complex spaces fulfill all municipal conditions. Please find the code below to test the municipal rules. ! Moderator Note No one should have to reverse engineer your code to understand what you are talking about. Explain what you want to say.
11. #include <math.h> #include <stdio.h> typedef unsigned __int64 uint64; #define TRUE 1 #define FALSE 0 #define INC 3 #define NEW 7 #define SEQUEL 9 class rnd64 { public: rnd64(void); ~rnd64(void); uint64 rnd(void); private: int prime_number(int); uint64 next(void); int status; uint64 dx; uint64 dy; uint64 end; uint64 x, y; uint64 R16A; uint64 R16B; uint64 Z; uint64 increaseA; uint64 increaseB; }; rnd64::rnd64(void) { dx=0xfedca201L; dy=0x012357bfL; R16A=(uint64)1; R16B=(uint64)2; Z=Z=0x00; x=5; y=3; end=2; increaseA=0x012357bfL; increaseB=0xfedca201L; } rnd64::~rnd64(void) { } int rnd64::prime_number(int st) { if (st == INC) { x+=2; y=3; if (x>=(1<<16)) x=5; end=unsigned(sqrt(double(x)+0.25)); return SEQUEL; } else { if (!(x%y)) return FALSE; if ((y+=2)>end) return TRUE; return SEQUEL; } } inline uint64 uabs(uint64 &a, uint64 &b) { return a>b? a-b: b-a; } inline void swap(uint64 &a, uint64 &b) { uint64 c=a; a=b; b=c; } uint64 rnd64::next(void) { status=prime_number(NEW); if (status == TRUE) { increaseB-=increaseA; increaseA+=x; prime_number(INC); } else if (status == FALSE) { prime_number(INC); } R16A -= increaseA; increaseA-=dx; R16B += increaseB; increaseB+=dy; if (status==TRUE) swap(R16A, R16B); R16A += (R16A>>32)^(R16B<<32); R16B -= (R16A<<32)^(R16B>>32); return R16A^R16B; } uint64 rnd64::rnd(void) { uint64 p1=next(); if (status==TRUE) { uint64 a, b; uint64 p2=next(); a=b = Z; a=b = Z; ++a[unsigned(p1%2)]; ++b[unsigned(p2%2)]; uint64 A=uabs(a, a); uint64 B=uabs(b, b); if (Z == Z) { if (unsigned(next()%2)) { A=1; B=0; } else { A=0; B=1; } } if (A < B) { ++Z[unsigned(p1%2)]; return p1; } else { ++Z[unsigned(p2%2)]; return p2; } } else { ++Z[unsigned(p1%2)]; return p1; } } void main(void) { rnd64 R; int st=0; uint64 bit; bit=bit=0x00; for (;;) { uint64 P=R.rnd(); ++bit[unsigned(P%2)]; if (st==0 && bit>bit) { printf("%d", bit>bit? 1: 0); st=1; } else if (st==1 && bit>bit) { printf("%d", bit>bit? 1: 0); st=0; } } }
12. k0∑xj0 + k1∑xj1 + k2∑xj2 +,…,+ kn∑xjn+0 = ∑yjxj0 k0∑xj1 + k1∑xj2 + k2∑xj3 +,…,+ kn∑xjn+1 = ∑yjxj1 k0∑xj2 + k1∑xj3 + k2∑xj4 +,…,+ kn∑xjn+2 = ∑yjxj2 . . . k0∑xjn + k1∑xjn+1 + k2∑xjn+2 +,…,+ kn∑xjn+n = ∑yjxjn One of the most beautiful algebra formulas is the least squares polynomial formula.
×