UserManual:Tools:Formulas: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 11: Line 11:
== Formulas ==
== Formulas ==
Below you'll find some examples and tips how you can use the formulas to create your pattern
Below you'll find some examples and tips how you can use the formulas to create your pattern

[[File:Advice.svg|left|frameless|50x50px]]Important Note:

The formula editor is case sensitiv. So you need to spell the functions right. E.g. <code>'''acosd (wrong)'''</code> is not equal <code>'''acosD (right)'''</code>


=== List of buitlt-in functions ===
=== List of buitlt-in functions ===
Line 37: Line 41:
** E.g.: asinh(90) = 5.19299
** E.g.: asinh(90) = 5.19299
* '''atan''' '''⇒''' Inverse tangent function working with radians, Usage: '''<code>atan(x)</code>'''
* '''atan''' '''⇒''' Inverse tangent function working with radians, Usage: '''<code>atan(x)</code>'''
** The arctangent is the angle whose tangent is the number. The output is an angle in radians in the range -pi/2 to pi/2
** atan(1) = 0.78538
* '''atanD''' '''⇒''' Inverse tangent function working with degrees, Usage: '''<code>atanD(x)</code>'''
* '''atanD''' '''⇒''' Inverse tangent function working with degrees, Usage: '''<code>atanD(x)</code>'''
** The arctangent is the angle whose tangent is the number. The output is an angle in degrees in the interval [-90, 90]
** atanD(1) = 45
* '''atanh''' '''⇒''' Inverse Hyperbolic tangent function, Usage: <code>'''atanh(x)'''</code>
* '''atanh''' '''⇒''' Inverse Hyperbolic tangent function, Usage: <code>'''atanh(x)'''</code>
** Returns the inverse hyperbolic tangent of the elements of <code>X</code>. All angles are in radians.
** atanh(0,99) = 2.64665
* '''avg''' '''⇒''' Mean value of all arguments, Usage: '''<code>avg(arg 1; arg 2; ... arg n)</code>'''
* '''avg''' '''⇒''' Mean value of all arguments, Usage: '''<code>avg(arg 1; arg 2; ... arg n)</code>'''
** Computes the average for all values
** avg(2;3;4) = 3
* '''cos''' '''⇒''' Cosine function working with radians, Usage: '''<code>cos(angle 0 in radians)</code>'''
* '''cos''' '''⇒''' Cosine function working with radians, Usage: '''<code>cos(angle 0 in radians)</code>'''
** Function The cosine of an angle, α, defined with reference to a right triangle is cos (α) = adjacent side hypotenuse = b h.
** cos(1) = 0.540302
* '''cosD''' '''⇒''' Cosine function working with degrees, Usage: '''<code>cosD(angle 0 in degrees)</code>'''
* '''cosD''' '''⇒''' Cosine function working with degrees, Usage: '''<code>cosD(angle 0 in degrees)</code>'''
** Returns the icosine of the elements of <code>X</code>. All angles are in degrees.
** cosD(180) = -1
* '''cosh''' '''⇒''' Hyperbolic cosine function, Usage: '''<code>cosh(angle 0 in radians)</code>'''
* '''cosh''' '''⇒''' Hyperbolic cosine function, Usage: '''<code>cosh(angle 0 in radians)</code>'''
** Returns the hyperbolic cosine of the elements of <code>X</code>. All angles are in radians.
** cosh(0) = 1
* '''degTorad''' '''⇒''' Converts degrees to radians, Usage: '''<code>degTorad(angle 0 in degrees)</code>'''
* '''degTorad''' '''⇒''' Converts degrees to radians, Usage: '''<code>degTorad(angle 0 in degrees)</code>'''
** degTorad converts it's argument deg (an angle in degrees) to radians. (pi radians is 180 degrees)
** degTorad(180) = 3.14159
* '''exp''' '''⇒''' E raised to the power of x, Usage: '''<code>exp(x) where e = 2.718</code>'''
* '''exp''' '''⇒''' E raised to the power of x, Usage: '''<code>exp(x) where e = 2.718</code>'''
** The exponential function is a mathematical function denoted by f(x)<math>f(x) = exp(x)</math> or <math>f(x) = e^x</math>
** exp(0) = 1
** exp(2) = 7.38906
* '''fmod''' '''⇒''' Returns the floating-point remainder of x/y (rounded towards zero), Usage: '''<code>fmod(x; y)</code>'''
* '''fmod''' '''⇒''' Returns the floating-point remainder of x/y (rounded towards zero), Usage: '''<code>fmod(x; y)</code>'''
** Returns the remainder of x divided by y.
** fmod(3.3;2) = 1.3
* '''ln''' '''⇒''' Logarithm to base e (2.71828...), Usage: '''<code>ln(x)</code>'''
* '''ln''' '''⇒''' Logarithm to base e (2.71828...), Usage: '''<code>ln(x)</code>'''
* '''log''' '''⇒''' Logarithm to base 10, Usage: '''<code>log(x)</code>'''
* '''log''' '''⇒''' Logarithm to base 10, Usage: '''<code>log(x)</code>'''
Line 51: Line 76:
* '''log2''' '''⇒''' Logarithm to base 2, Usage: '''<code>log2(x)</code>'''
* '''log2''' '''⇒''' Logarithm to base 2, Usage: '''<code>log2(x)</code>'''
* '''max''' '''⇒''' Max of all arguments, Usage: '''<code>max(arg 1; arg 2; ... arg n)</code>'''
* '''max''' '''⇒''' Max of all arguments, Usage: '''<code>max(arg 1; arg 2; ... arg n)</code>'''
** Returns the max value for all values
** max(2;3;4) = 4
* '''min''' '''⇒''' Min of all arguments, Usage: '''<code>min(arg 1; arg 2; ... arg n)</code>'''
* '''min''' '''⇒''' Min of all arguments, Usage: '''<code>min(arg 1; arg 2; ... arg n)</code>'''
** Returns the min value for all values
** min(2;3;4) = 2
* '''radTodeg''' '''⇒''' Converts radians to degrees, Usage: '''<code>radTodeg(angle 0 in radians)</code>'''
* '''radTodeg''' '''⇒''' Converts radians to degrees, Usage: '''<code>radTodeg(angle 0 in radians)</code>'''
** radTodeg converts it's argument rad (an angle in radians) to degrees. (pi radians is 180 degrees)
** radTodeg(3.14159) = 180
* '''rint''' '''⇒''' Round to nearest integer, Usage: '''<code>rint(float x)</code>'''
* '''rint''' '''⇒''' Round to nearest integer, Usage: '''<code>rint(float x)</code>'''
** The '''<code>rint()</code>''' function rounds the argument to an integral value using the current rounding direction.
** rint(2.3) = 2
** If you want to round to one digit multiply the value first by 10 and divide the result by 10 again: rint(2.356*10)/10 = 2.4
* '''sign''' '''⇒''' Sign function -1 if x<0; 1 if x>0, Usage: '''<code>sign(x)</code>'''
* '''sign''' '''⇒''' Sign function -1 if x<0; 1 if x>0, Usage: '''<code>sign(x)</code>'''
* '''sin''' '''⇒''' Sine function working with radians, Usage: '''<code>sin(angle 0 in radians)</code>'''
* '''sin''' '''⇒''' Sine function working with radians, Usage: '''<code>sin(angle 0 in radians)</code>'''
Line 60: Line 94:
* '''sqrt''' '''⇒''' Square root of a value, Usage: '''<code>sqrt(x)</code>'''
* '''sqrt''' '''⇒''' Square root of a value, Usage: '''<code>sqrt(x)</code>'''
* '''sum''' '''⇒''' Sum of all arguments, Usage: '''<code>sum(arg 1; arg 2; ... arg n)</code>'''
* '''sum''' '''⇒''' Sum of all arguments, Usage: '''<code>sum(arg 1; arg 2; ... arg n)</code>'''
** Computes the sum for all values
** sum(2;3;4) = 9
* '''tan''' '''⇒''' Tangent function working with radians, Usage: '''<code>tan(angle 0 in radians)</code>'''
* '''tan''' '''⇒''' Tangent function working with radians, Usage: '''<code>tan(angle 0 in radians)</code>'''
* '''tanD''' '''⇒''' Tangent function working with degrees, Usage: '''<code>tanD(angle 0 in degrees)</code>'''
* '''tanD''' '''⇒''' Tangent function working with degrees, Usage: '''<code>tanD(angle 0 in degrees)</code>'''