Diagram Designer's expression evaluation tool (expressions Evaluator)

Source: Internet
Author: User
Tags integer division natural logarithm

Software version: Diagram Designer (version 1.24)

Diagram Designer's expression evaluation tool

Evaluation tool for Diagram Designer's expression:

The use of this expression evaluation tool is described in more detail in the program's Help manual. (In the "Expression Evaluator" section of the "Using Diagram Designer", but the content is in English)

It says that the expression evaluation tool has the following characteristics (notable Features):

    1. Trigonometric functions (compute trigonometric functions)

    2. Hyperbolic functions (computational hyperbolic function)

    3. logical operators (logical operator)

    4. Named user variables can be created and used (user can customize name and use variables)

    5. Recursive descent parsing (ie. handles nested terms) (Recursive descent analysis method)

    6. Equations can be programmed and used later (it is possible to write equations and use them later)

    7. Multi-line programming with a single result (multi-line output individual results)

    8. Some constants built-in, more can is added by user using expressions (in addition to constants that have been written, users can add more expressions)

    9. Equation Solving (roots, minimums, etc.) and plotting-plots can be inserted into diagrams (solution equation, draw function image)

In the help document, for each part of the editor, this article will follow these salutation:

where "expression area" is where the user types the expression, "result area" is where the tool displays the results of the calculation, "Available Functions & User Vars, etc" in the lower left corner is currently registered in the editor functions and variables, can be used directly.

Second, the expression evaluation method

The user can enter text in the following three formats in the expression area:

1): variable_name=variable_contents;

Assign a value to a variable, you can create a new variable, or you can update the value of an existing variable. such as: abc=123; Delegate assigns 123 to the variable ABC

2): Function_name (function_variable) =expression_in_variable;

Create a function where the function can only have one argument, such as: F (x) =x^2; Yes, but: f (x, y) =x^2+y^2; No, you can't.

3) Expression_to_evaluate

Evaluates an expression, such as entering sin (1), which displays "0.841470984808" in the result area

Third, operator

The following operators can be used in an expression evaluation tool:

Operator Description information
& Logic and (not 0 numbers are considered true)
| Logical OR (not 0 numbers are considered true)
= Equals, the value on both sides of the equal sign returns 1, otherwise 0 is returned.
# Not equal, the value on both sides of the equal sign returns 0, otherwise 1 is returned.
> is greater than or equal, the result is true returns 1, otherwise returns 0
< is greater than or equal, the result is true returns 1, otherwise returns 0
+ Addition operation
- Subtraction operation, minus sign
* Multiplication (multiplied)
/ Division operation (divided by)
% "Note" For the remainder operation
^ Exponentiation, X^y represents the Y power of X

"Note": In the remainder operation, the statement in the Help manual is not accurate. The original text in the Help is

Result is the remainder of the integer division, eg.  16.1%3.03 is equivalent to 16/3. Remainder (result) In this example is 1.

That is, all non-integers are converted to integers when modulo is done, but this assertion cannot be established by a 16/3 value of 1, and the value of 16.1%3.03 is 0.95.

Iv. Constants

The default constants within an expression evaluation tool are as follows:

Constant Value
E 2.718281828459 (natural logarithm)
Inf Infinity (≈1/0) (infinity, value inf)
Kb 1024 (2 of 10 Parties)
Mb 1048576 (2 of 20 Parties)
Pi 3.14159265359 (PI)

The constants here are just a few of the most basic constants

Five, function

1) Trigonometric Functions

Trigonometric function return value
COS (x) cosine function, X is radians
Arccos (x) Inverse cosine function
Sin (x) sine function, X is radians
Arcsin (x) Inverse chord function
Tan (x) Tangent function, X is radians
arctan (x) Inverse tangent function
Cot (x) cotangent function

Note: There is no inverse cotangent function in the trigonometric function, nor is there any trigonometric functions such as secant, redundancy, normal vector, Yu Yi, etc.

2) Hyperbolic function

Hyperbolic functions return value
Cosh (x) Hyperbolic cosine cosh (x) = (ex + e-x)/2
Arccosh (x) Inverse hyperbolic cosine
Sinh (x) Hyperbolic sine sinh (x) = (ex-e-x)/2
Arcsinh (x) Inverse hyperbolic sine
Tanh Hyperbolic tangent tanh (x) = Sinh (x)/cosh (x)
Arctanh (x) Inverse hyperbolic tangent

3) Take the whole function

Take integer function return value
Ceil (x) Take the ceiling and return the smallest integer larger than x
Floor (x) Take the floor and return the largest integer smaller than x
Frac (x) Gets the fractional part of a real number
Round (x) Similar to rounding, returns the nearest integer to the real number entered, where 0.5 will be abandoned instead of in, such as 4.5 will be rounded to 4, 4.51 will be entered into 5

4) Random number

Random number
return value
RAND (x) Returns the real number between 0-x, using the white noise generator to generate
RANDN (x) Returns the Gaussian random number, X is the standard deviation

5) exponential function and logarithmic function

Logarithmic functions return value
EXP (x) exponential function exp (x) = ex
ln (x) Logarithm of base e (natural logarithm)
LOG10 (x) Logarithm with base 10 (common logarithm)
LOG2 (x)
Logarithm with base 2

6) Other functions

Other functions return value
ABS (x) Absolute
Bin (x) Convert binary numbers to decimal
FAC (x) Calculate factorial
sqrt (x) Calculate the square root of arithmetic
Vi. equation of solution

Diagram Designer can solve some of the simplest equations, as follows:

Function Description
Num. Guess The solution used to guess the equation is meaningless when used alone, with a default value of 0.500000001
Num.argmin (expression,x) Num.argmin (f (x), x), gets the minimum value of the function f (x) =expression, such as the value of Num.argmin ((x-1) * (x-1) +4,x) is 1.000000001
Num.min (expression,x) Num.min (f (x), x), gets the value of the function f (x) =expression when the minimum value is taken, such as Num.min ((x-1) * (x-1) +4,x) is 4
Num.root (expression,x) Gets the equation expression=0 at Num. Guess near the root, such as Equation x^2+5*x+4=0, at Num. When the guess is 0.500000001 (the default), Num.root (x^2+5*x+4,x) returns-1, in Num. Guess is 6 o'clock and returns 4
Num.solve (equation,x) Gets the equation equation at Num. Guess near the root, such as Equation x^2+5*x+5=1, at Num. When the guess is 0.500000001 (the default), Num.solve (x^2+5*x+5=1,x) returns-1, in Num. Guess is 6 o'clock and returns 4
Seven, drawing function image

Draw the function image to use the plot function, using: Plot (expression,x)

The image drawn is a function f (x) =expression image, Input: Plot (4*x^3+3*x^2-2*x+1,x) The resulting image is:


Press the Copy button in the plot window and click "Paste" (paste, shortcut shift+ins) in Diagramdesigner "Ctrl + V" or the right-mouse menu, You can copy the image of this function to Diagrampane, as shown in:

END

Diagram Designer's expression evaluation tool (expressions Evaluator)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.