Current location - Training Enrollment Network - Mathematics courses - Excuse me, how to realize the common operations of advanced mathematics on matlab?
Excuse me, how to realize the common operations of advanced mathematics on matlab?
1, verify matrix operation

We have all done matrix operations, and we probably all have a feeling that it is complicated. For matrix operations with multiple rows and columns, it is more prone to errors. How to test the learning effect? This requires verification of the results. The answers of reference books are inevitably wrong. If they are practical questions, where can they come from? There is another way, and that is to solve it through programming. But it's too much trouble. For example, when considering the product of two matrices A and B, the realization in C language is not just a set of double-loop problems. Double cycle is of course necessary for matrix product, and there are many other problems to be considered: how to treat A and B as a complex matrix; How to consider when one of them is a complex matrix; How to manage when all are real coefficient matrices; In this way, there are four branches in a program, and these four situations are considered respectively. Then we have to judge whether these two matrices are multiplicative. Therefore, without a certain amount of time, it is impossible to write a subroutine in C language that takes into account various situations. However, with tools like MATLAB, the problem becomes very simple. We only need to open MATLAB and do simple operations in the command window to complete the operation.

For example, calculate A*B, where A= 1 2 3 B= 3 4 5.

7 8 9 6 7 8

5 4 3 8 9 4

Type in the command window of MATLAB.

& gt& gta =[ 1 2 3; 7 8 9; 5 4 3];

& gt& gtb =[3 4 5; 6 7 8; 8 9 4];

& gt& gtA.*B

ans =

3 8 15

42 56 72

40 36 12

Where "a = [12 3; 7 8 9; 5 4 3]; b =[3 4 5; 6 7 8; 8 9 4]; "is a negative statement, and the rows in the matrix are marked with"; " Separate the marks. A.*B stands for a * B.

This example is simple, but it is enough to illustrate the meaning. MATLAB can complete any matrix operation you need, including some common transformations. In the future, when you encounter complex matrix operations with multiple rows and columns, you can easily solve everything with MATLAB.

2. Scientific operation

Common calculations such as sine, cosine, tangent and tangent can be realized by ordinary programming languages, and even more complicated calculators can be solved. But can they do derivative and integral operations? I find it difficult. MATLAB can use its symbolic operation toolbox to analyze and deduce this function, and get such as higher derivative, integral, Taylor power series expansion and so on. Using functions such as diff (), simple () and Taylor (), the derived results can be directly obtained. For some questions, we must first determine the direction of solving problems, and then answer them in detail. We can use MATLAB to guess our thinking direction and see if it meets the requirements of the topic. This can save a lot of calculation time, and it is very helpful to correctly grasp the requirements of the topic and determine the direction of doing it.

For example, when calculating the extreme value of a function, the derivative can be used to solve it. However, the existing function itself is very complicated and it is very troublesome to deduce. This problem can be easily solved by analytic deduction of MATLAB. The following example illustrates the simplicity of the derivation process in MATLAB.

Example:

distinguish

& gt& gtsyms x;

& gt& gtf=x.^3*sin(x);

& gt& gt difference (f)

ans =

3*x^2*sin(x)+x^3*cos(x)

"syms x" defines a variable x and diff () is a derivative function. Specific usage can be obtained in the help.

Find the second derivative

& gt& gtsyms x;

& gt& gtf=x.^3*sin(x);

& gt& gtdiff(f,x,2)

ans =

6*x*sin(x)+6*x^2*cos(x)-x^3*sin(x)

Step 3: Draw.

In the study of advanced mathematics, we often encounter some problems about graphics. Some need us to draw accurate figures and then analyze them carefully; Some graphics themselves are given by expressions, which are often beyond our imagination, and we don't know their types at all; Others can be imagined, but the drawing ability is poor and it is difficult to describe. These difficulties affect our normal study.

Drawing graphics in C and other languages is also a difficulty, but using advanced languages such as MATLAB, only a few intuitive statements are needed to complete this work. And the generated graphics are beautiful and accurate, and the sentences can be transplanted to another machine without modification, and the results are exactly the same, as shown below.

Example: chart made.

Type in MATLAB:

& gt& gtx =-2:0.0 1:2;

& gt& gty=x.^3-x.^2-x+ 1;

& gt& gt drawing (x, y)

The following results were obtained:

A more complicated example comes from the 3d demonstration of MATLAB.

> 〉z = peak value (25);

> grid (z);

Very simple, just display a few commands intuitively. (Pay attention to case, MATLAB is sensitive to case)

It can be seen that MATLAB is very powerful in drawing. Not only can you draw a plan, but you can also draw a three-dimensional picture. You can also draw point distribution, histogram and so on according to your requirements. Anything you can think of can basically satisfy you. As long as you need such an intuitive performance, MATLAB can easily help you achieve it.

Having said so much, it has always been a general statement. On the one hand, the function of MATLAB is too powerful to elaborate one by one, on the other hand, I don't want to turn this short article into a piece of help from MATLAB. (Details can be found in MATLAB) I'm just writing about my experience in using MATLAB here.

MATLAB is a basic tool that college students, master students and doctoral students must master. It is becoming a useful tool for teaching numerical linear algebra and other advanced applied mathematics courses. Understanding and using MATLAB as soon as possible is helpful to mathematics learning.