Gnuplot (2): Mathematical Expression

Source: Internet
Author: User
Tags integer division mathematical functions

Before we start to draw a picture, we need to know how the gnuplot expresses the mathematical formula.

  • Addition, subtraction, multiplication, division, multiplication
    Use+,-,*,/,**Indicates
  • Integer and floating point number
    Similar to the C language, gnuplot treats integers and floating-point numbers (real numbers) differently. The integer calculation result is still an integer. Therefore, be especially careful when Processing Integer Division. For example, the result of 7/2 is 3 instead of 3.5.
  • Plural
    Gnuplot supports plural operations. The plural values are represented by a pair of real numbers contained in curly brackets. For example:{3, 5}3 + 5I
  • Mathematical functions
    Gnuplot has rich mathematical functions in almost the same format as the C language. Function names are the same for real numbers and plural numbers. The following link shows the list of predefined functions:
    Http://www.gnuplot.info/docs_4.2/gnuplot.html#x1-5300013.1
  • Custom Functions
    User-Defined Functions are easy, suchF (x) = x + 1Define a mona1 function,F (x, y) = x + yDefines a binary function.
  • π (circumference rate)
    π is used in gnuplotPi.

Here are some examples:

Here we usePrintCommand is to output the result to the screen.

With this knowledge, we can start drawing.

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.