A concise tutorial on mathematical tools in Linux (I)

Source: Internet
Author: User

This blog has repeatedly mentioned Mathematica, a super mathematical software, but so far I have not found its Linux version, and wine seems useless. In fact, there are many Mathematica-like mathematical software in Linux, among which maxima is the one I use most. Here, I will briefly introduce various maxima functions for your reference and facilitate future queries.

Install: sudo apt-Get install maxima-share
Run: Maxima
Exit: Quit ();

Basic operations
(%i1) 2+3;
(%o1)                                  5
(%i2) 5*6;
(%o2)                                 30
(%i3) %+2;
(%o3)                                 32
(%i4) %o1*%o3;
(%o4)                                 160
(%i5) 4/7+3/4;
                                      37
(%o5)                                 --
                                      28
(%i6) float(%);
(%o6)                          1.321428571428571
(%i7) 2^32;
(%o7)                             4294967296
(%i8) 30!;
(%o8)                  265252859812191058636308480000000
(%i9) float(sqrt(2));
(%o9)                          1.414213562373095

Trigonometric function and logarithm function
(%i1) float(sin(1));
(%o1)                           0.8414709848079
(%i2) sin(%pi/2);
(%o2)                                  1
(%i3) sin(%pi/2)+cos(%pi/3);
                                       3
(%o3)                                  -
                                       2
(%i4) float(sec(%pi/3)+csc(%pi/3));
(%o4)                          3.154700538379252
(%i5) log(1);
(%o5)                                  0
(%i6) float(log(10));
(%o6)                          2.302585092994046
(%i7) log(%e);
(%o7)                                  1
(%i8) log(2^a);
(%o8)                              log(2) a
(%i9) %e^log(2);
(%o9)                                 2

Variable operations
(%i1) a^2-b^2;
                                     2    2
(%o1)                               a  - b
(%i2) a:3;
(%o2)                                  3
(%i3) a^2-b^2;
                                         2
(%o3)                               9 - b
(%i4) b:2;
(%o4)                                  2
(%i5) a^2-b^2;
(%o5)                                  5
(%i6) kill(a);
(%o6)                                done
(%i7) kill(b);
(%o7)                                done
(%i8) a^2-b^2;
                                     2    2
(%o8)                               a  - b

Function operations
(%i1) f(x):=x^2-1;
                                         2
(%o1)                           f(x) := x  - 1
(%i2) f(2);
(%o2)                                  3
(%i3) f(100);
(%o3)                                9999
(%i4) float(f(2/3));
(%o4)                         - 0.55555555555556
(%i5) a:4/5;
                                       4
(%o5)                                  -
                                       5
(%i6) f(a);
                                       9
(%o6)                                - --
                                       25

Polynomial operations (expansion, merging, simplification, and elimination)
(%i1) expand((a+b)^3);
                            3        2      2      3
(%o1)                      b  + 3 a b  + 3 a  b + a
(%i2) factor(a^2-b^2);
(%o2)                          - (b - a) (b + a)
(%i3) ratsimp((x^2-1)/(x+1));
(%o3)                                x - 1
(%i4) eliminate([x^2+x*y+z=0,3*x+5*y+z=0,x-y-2*z^2=1],[y,z]);
                             4      3       2
(%o4)               [- x (8 x  - 2 x  + 19 x  - 50 x + 25)]

Solving Equations
(%i1) solve(x^2-3*x+4/x=5,x);
                         sqrt(5) + 1      sqrt(5) - 1
(%o1)             [x = - -----------, x = -----------, x = 4]
                              2                2
(%i2) funcsolve(f(n)*(n+1)+2*n=1-f(n)/n,f(n));
                                      n (2 n - 1)
(%o2)                        f(n) = - -----------
                                       2
                                      n  + n + 1
(%i3) solve([x+3*y=10,1/x+x*y=4],[x,y]);
                              sqrt(69) - 9      4 sqrt(3) sqrt(23) - 34
(%o3) [[x = 1, y = 3], [x = - ------------, y = -----------------------],
                                   2            9 sqrt(3) sqrt(23) - 75
                                    sqrt(69) + 9      4 sqrt(3) sqrt(23) + 34
                               [x = ------------, y = -----------------------]]
                                         2            9 sqrt(3) sqrt(23) + 75
(%i4) solve(x^2+b*x+c=0,x);
                           2                       2
                     sqrt(b  - 4 c) + b      sqrt(b  - 4 c) - b
(%o4)         [x = - ------------------, x = ------------------]
                             2                       2
(%i5) find_root(x^x=2,x,1,2);
(%o5)                          1.559610469462369
(%i6) find_root(sin(x)=x/2,x,0.1,%pi);
(%o6)                          1.895494267033981

Number Theory
(%i1) mod(100,7);
(%o1)                                  2
(%i2) primep(3214567);
(%o2)                                true
(%i3) next_prime(200);
(%o3)                                 211
(%i4) factor(1001);
(%o4)                               7 11 13
(%i5) factor(30!);
                        26  14  7  4   2   2
(%o5)                  2   3   5  7  11  13  17 19 23 29
(%i6) gcd(200,780);
(%o6)                                 20
(%i7) binomial(7,4);
(%o7)                                 35
(%i8) fib(7);
(%o8)                                 13

Draw function Images
(%i1) plot2d(x^3+2*x^2-3,[x,-2,2]);
*** X11 output driver not found, switching to dumb terminal!
*** If you want to use the X11 output, please install the gnuplot-x11 package

  14 ++-------+--------+--------+--------+-------+--------+--------+-------++
     +        +        +        +        +       +       x^3+2*x^2-3 $$$$$$ $
  12 ++                                                                    $+
     |                                                                    $ |
  10 ++                                                                  $ ++
     |                                                                  $   |
     |                                                                  $   |
   8 ++                                                                $   ++
     |                                                                $     |
   6 ++                                                             $$     ++
     |                                                             $$       |
   4 ++                                                          $$        ++
     |                                                          $$          |
   2 ++                                                        $$          ++
     |                                                      $$$             |
     |                                                     $$               |
   0 ++                                                 $$$                ++
     |                                               $$$$                   |
  -2 ++$$$$$$$$$$$$$$$$$$$$$$$$$$               $$$$$                      ++
     $$       +        +        $$$$$$$$$$$$$$$$ +        +        +        +
  -4 ++-------+--------+--------+--------+-------+--------+--------+-------++
    -2      -1.5      -1      -0.5       0      0.5       1       1.5       2

(%o1)

You can install the gnuplot-x11 to make maxima draw on X:
sudo apt-get install gnuplot-x11
MAXIMA can also draw 3D images. For example, if you execute the following code to draw a sin (x) Cos (y) image, I will not map it. You can try it yourself.
plot3d(sin(x)*cos(y),[x,-2,2],[y,-2,2]);

Be honest
Please indicate the source of the post

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.