TU ANUNCIO / YOUR PUBLICITY

AQUÍ PODRÍA ESTAR TU ANUNCIO: / HERE COULD BE YOUR AD E-mail
Mostrando entradas con la etiqueta complex. Mostrar todas las entradas
Mostrando entradas con la etiqueta complex. Mostrar todas las entradas

sábado, 29 de noviembre de 2014

Solving complex type functions / Solución de funciones de tipo complejo


Detrás de la simple ecuación del esponente del número "e" a un número complejo:

Behind the simple equation of the exponent of the number "e" to a imaginary number:

e( a + bi ) = ea · Cos(b) + [ea · Sen(b)]i


Y dando un poco de vueltas a las propiedades de las funciones trigonométricas, la exponencial y el logaritmo. Se llegan con cierta "facilidad" a las soluciones complejas de las funciones siguientes:

And studying the properties of trigonometric functions, exponential and logarithm. We easily get imaginary solutions of the following functions:

Sen( a + bi ) = Sen(a) · Ch(b) + [Cos(a) · Sh(b)]i

Cos( a + bi ) = Cos(a) · Ch(b) + [Sen(a) · Sh(b)]i

Tan( a + bi ) = Tan(a) · (1-Th²(b)) / (1+Tan²(a) · Th²(b) ) +                    + [Th(b) · (1+Tan²(a)) / (1+Tan²(a) · Th²(b) )]i

Logn( a + bi) = Ln(a²+b²)/(2Ln(n)) + [Atn(b/a) /Ln(n)]i

( a + bi )( c + di ) = ef · Cos(g)+ ef · [Sin(g)]i
Donde: Where:
           f = c·Ln((a²+b²)) - d·Atn(b/a)
           g = c·Atn(b/a) + d·Ln((a²+b²))


Sh( a + bi ) = Sh(a) · Cos(b) + [Ch(a) · Sen(b)]i


Ch( a + bi ) = Ch(a) · Cos(b) + [Sh(a) · Sen(b)]i


Este tema es muy escueto pero para mi es un recordatorio obligado cuando me sumerjo en cálculos de tipo complejo.
This topic is very brief but to me is a compelling reminder when I need to calculate with imaginary number.

martes, 11 de noviembre de 2014

Tunaritmos: The changeless tirhd derivative / La inmutable tercera derivada


Era el año 1987 cuando me hice una pregunta ¿Cual sería la función cuya tercera derivada fuera ella misma?. Todo el mundo sabía que d(ex)/dx=ex. Que d2(Sh(x))/d2x=Sh(x) y d2(Ch(x))/d2x=Ch(x). Pero ¿cuales son el trío de funciones que d3(Tn(x))/d3x=Tn(x) .

Les di un nombre, Tunaritmos. No recuerdo porqué. Supongo que tendría una razón para ello. Me dispuse a deducirlas.

It was 1987 when I asked myself: What would be the function whose third derivative was herself ?. Everyone knew that d(ex)/dx=ex, and that d2(Sh(x))/d2x=Sh(x) y d2(Ch(x))/d2x=Ch(x). But, what are the trio of functions that d3 (Tn (x)) / d3x = Tn (x).

I gave them a name, Tunaritmos. I do not remember why. I guess I'd have a reason for it. I started to deduct.



Pensando un poco imaginé cual sería la serie de Taylor que tendrían:

With a little thought, I figured that would be the Taylor series that would have them:

      Tni(x) = 1 + x³/3! + x⁶/6! + x⁹/9! + ... + x³n/(3n)!
      Tnj(x) = x2/2! + x5/5! + x8/8! + ... + x³n+2/(3n+2)!
      Tnk(x) = x/1! + x4/4! + x7/7! + x10/10!+ ... +x³n+1/(3n+1)!

De tal forma que / Compliant to
           
                          Tni(x) + Tnj(x) + Tnk(x) = ex .

APLICANDO LAPLACIANOS


Se sabe que: It is know that:  d3(Tn(x))/d3x=Tn(x)
              Tni(0) = 1.
              Tnj(0) = 0.
              Tnk(0) = 0.

L(y) = L(y''') = p3L(y) – p2y0 – py0' – py0'' →
      L(y)[1-p3] = -p2
     → Tni(x) = [ex +2e-x/2·cos(3x/2)]/3

De igual manera. Similarly:
  L(y)[1-p3] = - 1 → Tnj(x) = [ex -e-x/2·( cos(3x/2) + 3sen(3x/2))]/3
 L(y)[1-p3] = - p → Tnk(x) = [ex -e-x/2·( cos(3x/2) - 3sen(3x/2))]/3

Pensando un poco más, la solución general que satisface: d3(Tn(x))/d3x=Tn(x) es:
Thinking a little more, the general solution that satisfies d3(Tn(x))/d3x=Tn(x) is:

     T(x) = k1·ex + k2·e(-1/2 +√3i)x + k3·e(-1/2 -√3i)x

Or with:  a=(-1/2 +√3i) and b=(-1/2 -√3i)

Tni(x) = 1/3 · (ex + eax + ebx)
Tnj(x) = 1/3 · (ex + aeax + bebx)
Tnk(x) = 1/3 · (ex + beax + aebx)

Nota / Note:  1,a & b son las raices de / Are the roots of 31=1.



LAS GRÁFICAS DE LOS TUNARITMOS

Para valores negativos: For negative values:


Para valores positivos: For positiv values



Falta el saber la utilidad. I do not know its usefulness.

De aquí saltaremos a los triplejos. Complejos de tres dimensiones.
Al igual que existen números complejos : a+bi, por ejemplo. Crearemos los triplejos : a+bi+cj. Pero esos será otra historia.

From here jump to the 3-complex. Imaginary numbers with three dimensions.
There are imaginary numbers as the way (a + bi), for example. We will create the 3complex: a + bi + cj. But those will be another story.

Os dejo un enlace con una hoja de cálculo (en LibreOffice) para obtener estas gráficas:
I leave a connection to a spreadsheet (in FreeOffice) for these graphs:

https://www.dropbox.com/s/acg57ttyldj7bvp/tunaritmos.ods?dl=0















domingo, 2 de febrero de 2014

Taylor n-dimensional nets / Redes de Taylor multidimensionales

Sea un grupo de variables {x, a, b, g}  de las que se sabe (o se supone) que existe una función tal que x=f( a, b, g). El objetivo es encontrar tal función o al menos la que más se aproxime. 
We take a group of variables {x, a, b, g} of which is known (or assumed) that there is a function such that x=f( a, b, g). The goal is to find which function or the closest.

El punto de partida es un conjunto de valores {xn, an, bn, gn}. 
The starting point is a set of values {xn, an, bn, gn}.
El proceso es el siguiente, se elige la primera opción, la más sencilla que es:
The process is as follows, we choose the first option, which is the simplest:

X = f1( a, b, g) = A · an + B · bn,+ C ·  g+ D.  
(Máximo polinomio de primer grado)
        (Maximum linear polynomial)

Para determinar {A, B, C, D} será necesario tener al menos 4 grupos de valores de {x, a, b, g}, en el caso de tener más grupos de valores. Se realizarán tanteos hasta conseguir el error mínimo. El error definido puede ser simple, E=S(xn-Xn o cuadrático E²=S(xn-Xn. Cuando se consigan los valores {A, B, C, D} que hagan mínimo el error, no sólo tendremos una función que ligue {x, a, b, g} sino también la bondad de ésta.
To determine {A, B, C, D} need 4 sets of values ​​of {x, a, b, g}. In case you have more sets of values​​, we will achieve gropings for minimum error. The defined error can be simply, E=S(xn-Xn) or quadratic E²=S(xn-Xn. When we have {A, B, C, D} values ​​that minimize the error, not only we will have a function that links {x, a, b, g} but also the goodness of it.

Continuando con el proceso, este puede complicarse un grado más con la hipotética función:
Continuing the process, this can complicate a degree with the hypothetical function:

X = f2( a, b, g) = Aan² + Banbn  + Cang+ Dbn²  + Ebngn  + Fgn² + Gan + Hbn,+ Ig+ J
(Máximo polinomio de segundo grado)
        (Maximum quadratic polynomial)

El proceso es el mismo. El número mínimo de datos sería de 10 para resolver los valores {A..J} como si se tratara de un sistema de ecuaciones. De igual manera podrían hallarse tales valores con un grupo de datos mayor y encontrar los errores de primer y segundo grado. 
The process is the same. The minimum number of data would be 10 to solve the values ​​{A..J}. As if it were a system of equations. Similarly, these values ​​could be found with a larger group of data and find errors in first and second grade.

De esta forma podríamos con la progresión de polinomios de grado k evaluar los errores de primer y segundo grado 
This could form, with the progression of polynomials of degree k, estimate linear an quadratic errors.


X = fk( a, b, g)  Þ Ek  y Ek²
Si se realizara una gráfica con los valores de E y k estos serían los resultados posibles:
If we perform a graph with the values ​​of E and K, these are the possible results:

Si se ha elegido bien el grupo de variables, es decir que el suceso “x” está reglado con las variables { a, b, g  el resultado se muestra en la figura siguiente:
If you have chosen either the set of variables, ie, that the event "x" is regulated with the variables { a, b, g  the result is shown in next figure:

Gráfico de error asintótico → 0
Asymptotic Graphic Error → 0

Si no se ha elegido bien el grupo de variables por escasez de estas, es decir que el suceso “x” está reglado con las variables { a, b, g  y otras más que no se han tenido en cuenta { d .. w }, el resultado sería el siguiente:
If you have not chosen well the group of variables by shortage of these, ie, that the event "x" is regulated with the variables { a, b, g  and others that have not been taken into account {d .. w}, the result would be:

Gráfico de error asintótico → 0
Asymptotic Graphic Error → 0
Y si no se ha elegido bien la cantidad de datos y estos no fueran suficientes para poder determinar la función buscada, A partir de una determinada interacción los errores serán erráticos. No se podrán establecer conclusiones más allá del ultimo error sin altibajo. El resultado sería:
And if you have not chosen well the amount of data and these are not sufficient to determine the desired function, Starting from a given interaction errors will be erratic. No conclusions may be beyond the last error without bumpiness. The result could be




Gráfico de error asintótico → Valor ≠ 0 y k justificable máximo = 3
 Error Chart asymptotic value → Value ≠ 0 and k = 3 maximum justified
¿Que conclusiones se podrían extrapolar de las gráficas anteriores?
What conclusions we could extrapolate from the above graphs?

En el primer caso se tendría una función determinista que podría deducir sucesos dependientes de las variables estudiadas.
In the first case, we would have a deterministic function and we could deduce dependent events of the studied variables.

En el segundo caso se sabría cual es en nivel al que se puede llegar con el número de variables determinado inicialmente. Es decir, en el ejemplo anteriormente expuesto, que con las variables { a, b, g } el error mínimo el resultado sería creíble el 70% de las ocasiones.
En el segundo caso nosotros sabríamos cual es en nivel al que se puede llegar con el número de variables determinado inicialmente. Es decir, en el ejemplo anteriormente expuesto, que con las variables { a, b, g  el error mínimo el resultado sería creíble el 70% de las ocasiones.

En el tercer caso, no se puede saber si no se añaden más datos al sistema si se llegaría al primer o segundo caso. Aún así sí se puede llegar a una función deductiva y conocer su error. Es decir, en el ejemplo anteriormente expuesto, que con las variables { a, b, g  el error mínimo el resultado sería creíble el 60% de las ocasiones.
In the third case, you can not know if more details are not added to the system if you come to the first or second case. Yet, it is possible to obtain a deductive function and know their error. That is, in the example above, with variables { a, b, g  the minimum error would result credible 60% ​​of cases.

En todos los casos el sistema podría retroalimentarse con nuevos datos y continuar así con la actividad deductiva. Este sistema no soro deduce la formulación a aplicar sino que también el grado de fiabilidad de ésta.
In all cases, the system could be fed back with new data and continue with the deductive activity. This system not only follows the formulation to be applied but also the reliability of it.

La formulación general sería:
The general formulation would be:

1º Dado un sistema {x, an el objetivo será:  x=f(an).
2º Se irá construyendo la pirámide del error: E1, E2, E3,...
donde fk = C0 + S(Cpap) + S S(Cpqapaq)  + S SS (Cpqrapaqar) +  …

3º Se irán obteniendo las parejas [Ek, fk(an)]
4º Se determinará en que caso se está  y se deducirá x conociendo su error

          1 With a system {x, an}, the solution will be: x=f(an). 
          2 The progression of error: E1, E2, E3, ... 
                    where fk = C0 + S(Cpap) + S S(Cpqapaq)  + S SS (Cpqrapaqar) +  …
          3 Couples [Ek, fk(an)] will be obtained 
          4 It will be determined which case is deducted and knowing his error x

Este esquema lo bauticé como de Taylor multidimensional ya que para el caso particular y simple de un sistema {x, an donde n=1, fk resultaría ser un serie polinómica de Taylor.
This scheme I named it like multidimensional Taylor because in the case of a {x, an where n = 1, it would be a polynomial fk Taylor series.

La primera vez que lo utilizara fue en el año 2004 para la evaluación de la accidentalidad de las carreteras gallegas dentro del proyecto X-Enma. Un tipo de SIG que admitía datos de cualquier tipo de las carreteras, geométricos (orientación, peraltes, curvaturas, pendientes...) superficiales (IRD), meteorológicos …
The first time I used it was in 2004 for the assessment of Galician road accidents within the X-Enma project. One type of GIS data admitting any kind of road, geometric (orientation, cambers, bends, earrings ...) surface (IRD), meteorological ...

El resultado final al que llegara fue parecido al segundo caso (con un 60% de fiabilidad). Aún así tal formulación no debería utilizarse como deductiva pero si comparativa, como por ejemplo, la comparación entre variantes soluciones a una carretera determinada, index.html.
The end result we got was similar to the second case (with 60% confidence). The formulation should not be used as a deductive, but comparative, for example, comparing a particular variant solutions road . See; index.html.

No siempre es fácil utiliza esta herramienta en un sólo tramo de obra ya que el número de ensayos no siempre es tan numeroso como para permitir su deducción, o tan completo como para pesar que se tienen todas las variables en juego. Aún así tal herramienta fue programada en C y se puede acceder a ella como un comando.
It is not always easy to use this tool in a single tranche of work as the number of trials is not always so large as to allow deduction, or as complete as you have to weigh all the variables involved. Yet such a tool was programmed in C and can access it as a command.

La elección de C, no es banal, el código fuente es sencillo ya que como se ha comprobado tan sólo es un secuencia de anidación de bucles. Este reiterado proceso iterativo debe ser lo más cercano al código máquina para optimizar la velocidad del proceso. Y, en tercer lugar al disponer del código fuente puede compilarse tanto en Linux como en Windows y por tanto el archivo compilado es accesible dependiendo sólo de su entorno de compilación.
The choice of C, is not trivial, the source code is simple because as has been shown is just a sequence of nesting of loops. This iterative process should be repeated as close to machine code to optimize the speed of the process. And thirdly by providing source code can be compiled on both Linux and Windows and therefore the compiled file is accessible depending only on your build environment.




domingo, 26 de enero de 2014

Special maths used to our programming (Sintegrals and sinderivatives) / Matemáticas especiales usadas para nuestra programación (Sintegrales y siderivadas)

Mucha gente nos ha preguntado cual es la base matemática que hemos aplicado a nuestra programación.
Many people have asked us what is the mathematical basis we have applied to our programming.

Esta a sido muy original y variada. A continuación se expone una de ellas. La hemos denominado Sintegrales
This has been very original and varied. Then one of them is exposed. We have called Sintegrals.

Sintegrales/ siderivadas
Sintegrals / sinderivatives

Para el proceso de caracterización de todos los datos se debe pensar en la resolución de un cuantioso número de cálculos de sumas de términos de una sucesión. En el caso de funciones continuas la resolución de estas está tratado con las conocidas integrales en nuestro caso y dado que los datos de partida son discontinuos, o para entendernos, aplicaciones del conjunto de números naturales a reales, este procedimiento acabaría por darnos datos erróneos.

Procedamos a la siguiente definición:

For the characterization process all data should consider the resolution of a substantial number of calculations of sums of terms of a sequence. In the case of continuous functions solving these integrals is treated known in our case and since the input data are discontinuous, that is applications the set of natural numbers to real, this procedure would eventually give erroneous data.

Proceed to the following definition:

  n=n n=n 
Г(an ) = ∑   an = An 
n=1     n=1 


Por ejemplo. For example:

n=n       n=n 
Г (n)    = ∑ n = (n + 1)·n / 2
n=1       n=1 

de igual manera:
similarly:

Г (1)  = n 
Г (n)  = n²/2 + n/2 
Г (n²) = n³/3 + n²/2 + n/6 
Г (n³) = n⁴/4 + n³/2 + n²/4 
Г (n⁴) = n⁵/5 + n⁴/2 + n³/3 – n/30 
Г (n⁵) = n⁶/6 + n⁵/2 + 5n⁴/12 – n²/12 
etc.
so on.

Si tuviéramos que programar:
If we were to set:

for (i=a to b) {
...
  for (j=c to d) {
...
    for (k=e to f) {
...
      for (n=p to q) {
        s=s+n^2}
      }
...
   }
...
}


El ordenador se vería obligado a realizar ese bucle k veces.

Si este proceso está inmerso en un cálculo de 10 minutos, evitar el bucle tendría una reducción de tiempo de 10/k minutos

The computer would have to make that loop k times. 

If this process is involved in a calculation of 10 minutes, the loop would prevent a reduction of time of 10 / k minutes

for (i=a to b) {
...
  for (j=c to d) {
...
    for (k=e to f) {
...
      s=s0+n^3/3 + n^2/2 + n/6}
      }
...
   }
...
}

Esta última solución, no sólo reduce el código a 1/3 de líneas sino que lo además, y esto es lo importante, reduce el tiempo de cómputo global.

The latter solution not only reduces the code to third line but it also, and this is the most important, this reduces the overall computation time.

Propiedades de las sintegrales:
Properties of sintegrals:

Propiedad distributiva: / Distributive property: Г (α·an+β) = α·Г(an)+β·n 

Si existe el concepto de Sintegral parejo al de integral se presupone que existe el concepto opuesto, la siderivada pareja de la derivada.

If there is even the concept of integral Sintegral assumes that there is the opposite concept, couple siderivative, the derivative.

Si / If  Г(an) = An , entonces / then  Д(An) = an 

Las siderivadas se calculan fácilmente, más aun si se observa que van obteníendose los componentes del triángulo de Tartaglia. 
The siderivatives are easily calculated, even more so if you notice it is collected components Tartaglia triangle.

Д (n) = 1
Д(n²) = 2·n –1
Д (n³) = 3·n² – 3·n + 1
Д (n⁴) = 4·n³ – 6·n² + 4·n – 1
Д(n⁵) = 5·n⁴ – 10·n³ +10·n² – 5·n      + 1
Д(n⁶) = 6·n⁵ – 15·n⁴ + 20·n³ – 15·n²   + 6·n – 1
Д(n⁷) = 7·n⁶ – 21·n⁵ + 35·n⁴– 35·n³   + 21·n²    – 7·n     + 1
Д(n⁸) = 8·n⁷ – 28·n⁶ + 56·n⁵ – 70·n⁴  + 56·n³   – 28·n²  + 8·n     + 1
Д(n⁹) = 9·n⁸ – 36·n⁷ + 84·n⁶– 126·n⁵ + 126·n⁴ – 84·n³  + 36·n²  – 9·n    + 1
Д(n¹⁰) = 10·n⁹– 45·n⁸ +120·n⁷–210·n⁶ +252·n⁵  –210·n⁴ +120·n³ –45·n² +10·n  +1

Como resulta bastante tedioso calcular las sintegrales pero por el contrario las siderivadas se calculan fácilmente con lo que el cálculo del término general por ejemplo a partir de Д (n7) se calculará Г(n6): 

As is quite tedious calculating sintegrals but instead the siderivatives are easily calculated so that the calculation of the general term for example from Д (n7) calculating Г(n6):

Д(n⁷) = 7·n⁶ – 21·n⁵ + 35·n⁴– 35·n³   + 21·n²    – 7·n     + 1 

Luego:  
Then:

n⁷ = 7·Г(n⁶)–21·Г(n⁵)+35·Г(n⁴)–35·Г(n³)+21·Г(n²)–7·Г(n)+1 

Substituyendo y despejando, 
Substituting and solving,

Г(n6) = n⁷/7 + n⁶/2 + n⁵/2 – n³/6 + n/42 



SINTEGRALES DE POTENCIAS: 
SINTEGRALS OF POWERS:

Г(1/2n) = 1 – 1/2n 
Г(1/3n) = [1/2]·[1 – 1/3n] 
.  
Г(1/pn) = [(p – 1)/p]·[1 – 1/p(n+1)] 

Si / If   q=1/p ,
Г(qn) = [1/(1 – q)]·[1 – q(n+1)] 

Para el caso común del número e 
For "e" number:

Г(en) = [1/(1 – e)]·[1 – e(n+1)] 

Para las funciones que se pueden descomponer en términos de en, caso del seno, coseno, seno hiperbólico y coseno hiperbólico. La solución que se obtiene es la siguiente: 

For functions that can be decomposed in terms of in case of sine, cosine, hyperbolic sine and hyperbolic cosine. The solution obtained is:

Г(sen(αx)) = sen(αx)/(2 − 2cos(αx)) − cos(α(x + 1/2))/(2sen(αx/2)) 
Г(cos(αx)) = 1⁄2 + sen(α (x+1/2))/(2sen(α x/2)) 
Г(SH(αx)) = SH(αx)/(2 − 2CH(αx)) − CH(α(x + 1/2))/(2SH(αx/2)) 
Г(CH(αx)) = 1⁄2 + SH(α(x+1/2))/(2SH(αx/2)) 

Y para casos más complejos (importante en nuestro caso ya que suelen aparecer modificaciones por giros): 
And, for more cpmplex cases :  (important in our case because changes usually appear by turns):

Г(sen(αx+β))=[sen(β)−cos(αx+ β)]/[2−2cos(αx)]−[cos(α(x+1⁄2)+β)]/(2sen(αx/2)) 

Al repasar nuestro programa debemos fijarnos donde podemos substituir un bucle por una función equivalente. Este hecho aparentemente tan sencillo nos permitirá disminuir en gran medida el tiempo final de cómputo. 

When reviewing our program we must pay attention where we can replace a loop by an equivalent function. This seemingly simple fact will allow us to greatly reduce the final time of computation.