DrMath for Java用户指南

Online Computer Algebra System 在线计算机代数系统

 

 

Dr. Weiguang HUANG 黄博士有限公司

 

Phone: 电话:   (61) 0413008019 61413008019

E-mail: 电子邮箱: info@DrHuang.com DrHuang@DrHuang.com , drHuang@mail.com

http://www.DrHuang.com/ http://www.DrHuang.com/

http://www.DrHuang.net/ http://www.mathHandbook.com/

 

 

26 Aug. 2000 201411

 

 

Copyright (C) 1990-2000 版权所有(C1990-2014

 

 


Contents 内容

 

1    用户指南...................................................... 6

1         介绍................................................................ 6

1.1          什么是DrMath............................................. 6

1.2       能力........................................................... 6

2  计算.................................................................... 6

2.1  精确计算.......................................................... 7

2.2     不连续的和片面的价值.................................. 8

2.3    未定义和不定式............................................. 8

3  简化.................................................................... 9

3.1  假设域名.......................................................... 9

3.2  比较和测试数字.............................................. 10

4     定义函数,过程和规则................................ 11

4.1      定义函数.................................................... 11

4.1.1    定义条件函数........................................................................................... 12

4.1.2    定义情况函数........................................................................................... 12

4.1.3    定义分段函数........................................................................................... 12

4.1.4    定义递归函数........................................................................................... 13

4.1.5    定义多值函数........................................................................................... 13

4.2    定义程序...................................................... 13

4.3    定义规则...................................................... 14

5      范围.............................................................. 15

5.1    片面极限...................................................... 15

5.2    数值范围:NLim(..................................... 15

6 微分................................................................... 15

6.1    片面的微分.................................................. 15

6.2   微分的定义................................................... 15

7    积分................................................................ 16

7.1  不定积分........................................................ 16

7.2  定积分........................................................... 18

7.3    数值积分:NInt()......................................... 18

8      解方程.......................................................... 19

8.1  求解代数方程................................................. 19

8.2   解方程:Solve(......................................... 19

8.3   解多项式:PSolve(................................... 20

8.4    数值解方程:NSolve()................................ 20

8.5    解微分方程.................................................. 21

8.6   微分求解:DSolve().................................. 21

9   总和及相乘..................................................... 21

9.1    部分和......................................................... 21

9.2    无限和......................................................... 22

10  系列与多项式................................................ 22

10.1    系列........................................................... 22

10.2    多项式....................................................... 22

11          列表和数组,向量和矩阵........................ 23

13     转变............................................................ 23

13.1    转换为数字................................................ 23

14      获取表达式的一部分................................ 23

14.1    获取数据的类型.......................................... 23

14.2    让运营商.................................................... 23

14.3    获得操作数................................................ 24

15     图像............................................................ 24

15.1    绘制直线和圆弧.......................................... 24

15.2    绘函数图 F(X......................................... 24

15.3    绘制参数函数图 X(t)和 y(t................... 24

15.4      在极坐标绘制函数图 f(t........................ 25

15.5    绘制数据.................................................... 25

16    从用户学习.................................................. 25

16.1    从微分学积分............................................. 25

16.2    从简单的积分学习复杂的积分..................... 25

16.3    从不定积分学习定积分................................ 26

16.4  从简单的微分学习复杂微分........................... 26

16.5    从代数学习积分.......................................... 27

16.6    从简单的代数学习复杂的代数..................... 27

16.7    学习与编程................................................ 27

2部分      程序员指南.......................................... 28

17    编程............................................................. 28

17.1    数据类型.................................................... 28

17.1.1    数字...................................................................................................... 28

17.1.2    常量...................................................................................................... 29

17.1.3    变量...................................................................................................... 30

17.1.4   模式....................................................................................................... 31

17.1.5    函数,过程和规则.................................................................................. 31

17.1.5.1    标准数学函数...................................................................................... 31

17.1.5.2    微积分函数......................................................................................... 32

17.1.5.3    测试函数............................................................................................. 33

17.1.5.4    杂项函数............................................................................................. 34

17.1.5.5       用户定义函数................................................................................... 35

17.1.5.6    程序.................................................................................................... 35

17.1.5.7    规则.................................................................................................... 35

17.1.6    方程...................................................................................................... 35

17.1.7    不等式................................................................................................... 36

17.2     表达式...................................................... 36

17.2.1     运营商.................................................................................................. 36

17.2.1.1.   Arithmetic Operators............................................................................... 37

17.2.1.2.   Relational Operators............................................................................... 37

17.2.1.3.     Logical Operators................................................................................. 37

17.2.2   Function Calls......................................................................................... 37

17.3      声明......................................................... 38

17.3.1   Comment Statements.............................................................................. 38

17.3.2   Evaluation Statements............................................................................. 38

17.3.3   Assignment Statements.......................................................................... 38

17.3.4.   Conditional................................................................................................ 39

17.3.5.   Loop......................................................................................................... 39

17.3.9.   Sequence Statements................................................................................ 40

17.4    .............................................................. 40

17.5   Interface with Other Software..................................................................... 41

Part 3 Reference Guide........................................ 42

19   DrMath Environment: Windows and Menus................................................................................. 42

19.1.    文件菜单...................................................... 42

19.1.1.    ............................................................................................................ 42

19.1.2.    导入数据.................................................................................................. 42

19.1.3.   Save Input................................................................................................. 42

19.1.4.   Save Output.............................................................................................. 42

19.1.5.    打印......................................................................................................... 42

19.1.6.    出口......................................................................................................... 42

19.2   Input Window.............................................. 43

19.3   Run Menu................................................... 43

19.4   Graph Menu............................................... 43

19.5   Option Menu............................................... 43

20    Inside DrMath............................................ 44

20.1   Internal Structure........................................ 44

20.2   Internal Format........................................... 45

21 System Extension........................................ 45

22        关键词...................................................... 45

22.1      Keywords in Topic Order.......................... 45

22.2     Keywords in Alphabetical Order................. 49

22.3      Library Name........................................... 49

22.4       词汇表.................................................... 49

23  参考文献........................................................ 59

 


PART 1 1   User's Guide 用户指南

 

1. 1      Introduction 介绍

1.1. 1.1     What is DrMath 什么是DrMath

 

             DrMath (former Visual Math) is an online symbolic math and computer algebra system. DrMath(原可视化数学)是一个在线符号数学和计算机代数系统。

             DrMath is a computer algebra system that can perform exact, numeric, symbolic and graphic computation. DrMath是一个计算机代数系统,可以精确的执行,数字,符号和图形计算。 It manipulates complicated formulas and returns answers in terms of symbols, formulas, exact numbers, tables and graph. 它操纵复杂的公式,并返回答案的符号,公式,确切的数字,表格和图形方面。

             DrMath is an expert system that is able to learn from user's input. DrMath是一个专家系统,其能够从用户输入学习。 If the user only input one formula without writing any code, it will automatically learn many problems related to this formula (eg. it learns many derivatives involving an unknown function f(x) from one derivative). 如果用户只输入一个方案,而无需编写任何代码,它会自动学习与此相关的公式(如学习它涉及一个未知函数fx)从一个微分许多微分物)很多问题。

             DrMath is a symbolic, numeric and graphics computing environment where you can set up, run and document your calculation, draw your graph. DrMath是一个符号,数字和图形计算环境,你可以设置,运行并记录你的计算,绘制你的图形。

DrMath uses external functions as if standard functions since the external functions in library are auto-loaded. DrMath使用外部函数,如果标准函数,因为在库中的外部函数是自动加载。

          DrMath is a programming language, in which you can define conditional, case, piecewise, recursive, multi-value functions and procedures, derivatives, integrals and rules. DrMath是一种编程语言,在其中您可以定义条件,情况下,分段,递归,多值函数和过程,导数,积分和规则。

             It runs on any machine that supports Java. 它在任何支持Java的机器上运行。

 

 

1.2. 1.2      Capabilities 能力

 

             It can provide analytical and numeric answers for: 它可以提供分析和数值答案:

             * *   Differentiation: regular or higher order, partial or total, mixed and implicit differentiation, one-sided derivatives. 微分:定期或更高阶,部分或全部,混合和隐函数的微分,片面的微分。

             * *   Integration: indefinite or definite integration, multiple integration, infinity as a bound, parametric or iterated implicit integration. 积分:不定或定积分,多重积分,无穷如绑定,参数或隐式迭代积分。

             * *   Solution of equations: roots of a polynomial, systems of algebraic or differential equations. 解方程:一个多项式的根,代数或差分方程系统。

             * *   Manipulation of expressions: simplification, factoring or expansion, substitution, evaluation. 操作表达式:简化,保理或扩建,置换,评估。

             * *   Calculation: exact and floating-point numeric computation of integer, rational, real and complex numbers in the range from minus to plus infinity, even with different units.计算:准确,整数,理性,实数和复数从负到正无穷大的范围内,即使有不同单位的浮点数运算。

             * *   Limits: real, complex or one-sided limits, indeterminate forms. 极限:实数,复杂的或片面的极限,不确定的形式。

             * *   Complex: calculation, functions, derivatives, and integration. 复数:计算,函数,微分和积分。

             * *   Sum and product: partial, finite or infinite. 和与积:局部的,有限的还是无限的。

             * *   Series. 系列。       

Also included are: 还包括:

             * *   External functions in library as if standard functions. 在库外部函数,如果标准函数。

             * *   Plot: functions, polar, parametric, and data. 剧情:函数,极坐标,参数和数据。

             * Procedural, conditional, iteration, recursive, functional, rule-based, logic, pattern-matching and graphic programming. *  程序,条件,迭代,递归,函数性,以规则为基础,逻辑,模式匹配和图形编程。

 

2. 2 Calculation 计算

 

            请注意, 大写和小写字母是不同的语言,(如ABC不同abc)。关键字都是小写。

             In the following examples, a line of "In: " means input, which you type in the Input window, then run the program by clicking the "Run" menu; while a line of "Out: " means output. 在下面的例子中,输入:是指输入,您在输入窗口中键入,然后单击=键运行程序,而输出:意味着输出。 You will see both input and output are displayed on two lines with beginning of "In: " and "Out:" in the Output window. 你会看到输入和输出显示在两行的键入开始:在输出窗口和输出 You should not type the word "In: ". 你不应该键入单词键入 Some outputs may be omitted on the examples. 一些输出可以在实例被删去。

# and // are for comment statements. #是注释语句。 You can split a line of command into multi-lines of command by the semi-column ;, similar to Java 您可以通过半列分割线命令进入多行命令 ;,类似于Java .

           Note that you should not be suprised if some functions in the following examples are not working when their libraries are not in the default directory or missing. 请注意,如果在下面的例子有些函数没有工作时,他们的图书馆是不是在默认的目录中缺少,你不应该感到惊讶。

 

 

2.1. 2.1 Exact Calculation 精确计算

 

             DrMath gives the exact value of calculation by default, or the approximate value of numeric calculation when by N(). DrMath给出了计算时用n()的精确值默认情况下,或数值计算的近似值。 Mathematical functions are usually not evaluated until by N(). 数学函数通常不计算,直到由n()。

             DrMath can manipulate units as well as numbers, be used as a symbolic calculator, and do exact computation. DrMath可以操纵装置以及数字,可以作为一个象征性的计算器,做精确的计算。 The range of real numbers is from -Infinity to +Infinity, eg. 实数的范围是从负无穷到正无穷,如。 Ln(Infinity), Exp(Infinity), etc. DrMath contains many algorithms for performing numeric calculations. Ln(无限远),指数(无限)等DrMath包含了许多算法进行数值计算。 eg. 例如: Ln(I), I^I, (2.3)^(-3.2), 2^3^4^5^6^7^8^9, etc. Ln(I, I ^ I,(2.3^-3.2),2 ^ 3 ^ 4 ^ 5 ^ 6 ^ 7 ^ 8 ^ 9等。

             Note that DrMath usually gives a principle value if there are multi-values, but the Solve() and Root() can give all values. 需要注意的是DrMath通常给出一个原则的价值,如果有多个值,但解决()和根()可以给所有的值。

 

             Example: 例如:

             Exact and numeric calculations of 1/2 + 1/3. 1/2 + 1/3 精确和数字计算。

In: 输入:   

1/2+1/3 1/2 +1/3                      

# exact calculation;            #精确计算;

Out: 5/6 输出:

5/6

 

In: 输入:   N(1/2+1/3)

n( 1/2 +1/3    

# numeric calculation;            #数值计算;

Out: 0.8333333333 输出:

0.8333333333

 

             Evaluate the value of the function f(x) at x=x0 by f(x0). x = X0fX0)评估函数fx)的值。

 

             Example: 例如:

             Evaluate Sin(x) when x=Pi, x=180 degree, x=I. 评估的sinx),当x =, x = 180度,X = I

In:输入:   Sin(Pi), Sin(180*Degree)

Sin(Pi),Sin180 *degree

Out: 0, 0 输出:

0,0

 

In: 输入:   Sin(I), N(Sin(I))

Sin(I),N( Sin(I))

Out: Sin(I), 1.175201 I 输出:

SinI),1.175201I

 

             Example: 例如:

             Set the units converter from the minute to the second, then calculate numbers with different units. 从分钟将单位转换到第二个,然后计算不同单位的数字。

In: 输入:   minute:=60*second;

t := 60 s;

In: v := 2 m/s;

In: p := v*t;

In: D0:= 10 *;

In: V * T + D0;

Out: 250 meter; 输出:

250平方米;

 

             Evaluate the expression value by 通过计算表达式的值

                         Replace(y, x, 更换(YX   x0) X0

 

             Example: 例如:

             Evaluate z=x^2 when x=3 and y=4. 评估Z = X ^ 2x = 3y = 4

In: 输入:   z:=x^2;

Z:= X ^ 2;                      

# assign x^2 to z;            #为x ^ 2z;

In: 输入:   Replace(z, x,

Replace( ZX   3); 3;            

# evaluate z when x = 3;            #评估ZX = 3;

Out: 9 输出:

9

 

In: 输入:   

x:=4 X:= 4  ; ;                      

# assign 4 to x;            4分配给x;

In: 输入:   z;

Z;                                  

# evaluate z ; #评估Z;

Out: 16 输出:

16

 

             Note that after assignment of x by x:=4, x should be cleared from assignment by Clear(x) before differentiation (or integration) of the function of x. 注意, x的用x赋值后:= 4x应该从分配清除清除x的函数(x)的分化之前。 Otherwise the x values still is 4 until new values assigned.否则,x值仍是4,直到指定新值。 If evaluating z by the Replace(), the variable x is automatically cleared after evaluation, ie the variable x in Replace() is local variable. 如果评估Z按替换(),变量x被评估后自动清零,即变量x的替换()是局部变量。 The operation by assignment is global while the operation by internal function is local, but operation by external function is global. 通过赋值操作是全球性的,而内部函数的操作是本地的,而是由外部函数的操作是全球性的。 This rule also applies to other operations. 这条规则也适用于其他业务。

             The complex numbers, complex infinity, and most math functions with the complex argument can be calculated. 复数,复数无穷大,并且最数学函数的复杂参数可以被计算出来。

 

             Example . 例子。

In: 输入:   

Sign(1+I), Sign(-1-I), I^2; Ln( 1 + I),Ln(-1-I),I ^ 2;

Out: 1, -1, -1 输出:

1-1-1

 

             Example: 例如:

In: 输入:   

Exp(Infinity); Exp(Infinite;

Out: -Infinity 输出:

-无穷远

 

In: 输入:   

Ln(Infinity); Ln(Infinite;

Out: Infinity 输出:

无限

 

             The built-in constants (eg. Infinity) can be used as numbers in calculation of expressions or functions. 内置的常量(例如,Infinite),可以作为表达式或函数的计算的数字。

 

 

2.2. 2.2    Discontinuity and One-sided Value 不连续的和片面的价值

 

             Some math functions are discontinuous at x=x0, and only have one-sided function value. 有些数学函数是不连续的,在x = X0,而且只有片面的函数值。

 

2.3. 2.3   Undefined and Indeterminate Form 未定义和不定式

 

             If the function value is undefined, it may be indeterminate form (eg. 0/0, Infinity/Infinity), you can evaluate it by Lim(). 如果函数值是不确定的,它可能是不确定的形式(如0/0,无限/无限远),您可以通过林对其进行评估()。

 

 

3. 3 Simplification 简化

 

             DrMath automatically simplifies the output expression. DrMath自动简化了输出表达式。 You can further simplify it by using the built-in variable last in a single line again and again until you are happy with the answer. 您可以使用内置的变量在最后一行一遍又一遍,直到你满意的答案进一步简化它。

             Expressions can be expanded by 表达式可以通过扩展

                         Expand(x) Expand(x)

 

             Example: 例如:

In: 输入:   Expand((a+b)^2); Expand(A + B^ 2;

Out: a^2 + 2 ab + b^2 输出:A^ 2 +2 A B + B ^ 2

 

---------------------------------------------------------------------------------------- -------------------------------------------------- --------------------------------------

............... ...............         Expand(x) .......................................... Expandx..........................................

(a+b)^2 A + B^ 2                to        a^2+2*a*b+b^2 A^ 2 +2 * A * B + B ^ 2

(a+b)^n A + B^ N                to        a^n+ ...... A^ N + ...... +b^n + B ^ N         n is positive integer n为正整数

a*(b+c) A *B + C                to        a*b + a*c A * B + A * C

(b+c)/p B + C/ P                to        b/p + c/p B / P + C / P

 

----------------------------------------------------------------------------------------------- -------------------------------------------------- ---------------------------------------------

where a+b can be many terms or ab. 其中A + B可以是很多方面或AB

 

 

             This output can be further simplified if you know properties of x. 该输出可以,如果你知道的x属性被进一步简化。

             A first way is to evaluate x*Sign(x) by substituting Sign(x) with 1 if x is positive. 第一种方法是用1代替符号(x)如果x为正评估X *符号(x)的。

 

In: 输入:   Sqrt(x^2);

Sqrt(X ^ 2;

Out: x*Sign(x) 输出:

X *Logx

 

 

                         

3.1. 3.1 Assuming Domain 假设域名

 

             A second way is to assume x>0 before evaluation. 第二种方法是,假设x>0时评估之前。 If you assume the variable x is positive or negative, the output expression is simpler than that if you do not declare it.如果假设变量x为正或负,输出表达式较简单,如果你不声明它。

 

In: 输入:   

Assume(x > 0, y <0); If( X> 0Y <0;              

# assume x > 0, y < 0;            #假设x> 0时,Y <0;

Sqrt(x^2), Sqrt(y^2), Sqrt(z^2); f(x_):=If(x_>0, x_, 2x_); f(2), f(-2)

Out: x*Sign(x), y*Sign(y), z*Sign(z); 输出:

2, -4

 

             In this way, all of x is affected until the Assume() is cleared by Clear(). 以这种方式,所有的x的是受影响的,直至假定()是通过清除清除()。 The first method is local simplification, but the second method is global simplification. 第一种方法是局部的简化,但第二种方法是全局的简化。

             By default, Abs(x) < Infinity and all variables are complex, except that variables in inequalities are real, as usual only real numbers can be compared. 默认情况下,Abs(x)的<无限和所有的变量是复数,不同的是在不平等的变量是实数,像往常一样只有实数可以比拟的。 eg. 例如: x is complex in Sin(x), but y is real in y > 1. xSin(x)的复数,但y是真正的在Y> 1

             

             Table 3.1 3.1        Assuming 假设

 

Assume 假设                 Assignment 分配                Meaning 意思                 

 

Assume(x>y) If( X> Y                  x>y := True X> Y:= TRUE                          # assume x > y # 假设X> Y

Assume(x>=y) If( X> = Y               x>=y := True X> = Y:= TRUE          # assume x >= y# 假设X> = Y

Assume(x<y) If( X <Y                  x<y := True X <Y:= TRUE                          # assume x < y # 假设X <Y

Assume(x<=y) If( x <= Y               x<=y := True x <= Y:= TRUE          # assume x <= y # 如果X <= Y

Assume(x==y) If( X = Y                 x==y := True X = Y:= TRUE            # assume x == y # 假设X =Ÿ

Assume(x<>y) If( x <> y               x<>y := True x <> Y:= TRUE          # assume x <> y # 如果X <>Ÿ

IsEven(b) := True IsEven(2:=            # assume b is even #假设b为什

IsOdd2:=            # assume b is odd #假设b为奇数

IsInteger(b) := True IsInteger2:=       # assume b is integer #假设b为整数

IsRational2:=      # assume b is ratio #假设b为比

IsReal2:= TRUE    # assume b is real #假设b为实

IsComplex2:=     # assume b is complex #假设b为复杂

IsNumber2:= TRUE            # assume b is number #假设b为数字

IsFreeYX:= TRUE           # assume y is free of x #假设y是自由的x

Sign(B:= TRUE                      # assume b is positive complex #假设b为正复杂

 

 

             The Assume() can be cleared by Clear(). If( )可以通过清除被清除()。 eg. 例如: Clear(x>y). Clear( X> Y)。

             You can restrict the domain of a variable by assuming the variable is even, odd, integer, real number, positive or negative. 您可以通过假设变量是偶数,奇数,整数,实数,正或负的极限变量的域。

 

             Example: 例如:

 

In: 输入:   IsReal(b) := True;

IsReal( b:= True;

          # assume b is real; #假设b为实;

In: Sqrt(b ^ 2;

Out: Abs(b); 输出:

Abs(b;

 

 

             Table 3.3 3.3  Simplification in different domains 简化在不同的域

---------------------------------------------------------------------------------- -------------------------------------------------- --------------------------------

expression 表达     complex 复杂    real                    x > 0 x> 0

 

Sqrt(x^2) Sqrt(X ^ 2     x Sign(x) X登录(x)         Abs(x) ABSx)的                x x

x*Sign(x) X *符号(x)的             x Sign(x) X登录(x)         Abs(x) ABSx)的                x x

Abs(x)*Sign(x) ABSx)的*符号(x)的         Abs(x) Sign(x) ABSx)的符号(x)的          x x                     x x

Abs(x)/x ABSx)的/ X             Abs(x)/x ABSx)的/ X            1/Sign(x) 1/Sign(x)        1 1

------------------------------------------------------------------------------------- -------------------------------------------------- -----------------------------------

 

 

3.2. 3.2 Comparing and Testing Numbers 比较和测试数字

 

             You can compare two numbers by relational operators: 您可以通过关系运算符比较两个数字:

                         a > b A> B

                         a < b A <B

                         a <= b a<= b

                         a >= b A> = B

                         a <> b a<>b

                         a == b a== b

 

             Example: 例如:

In: 输入:   2 > 1, 2 < 1

2> 12 <1

Out: True, False 输出:

真,假

 

 

             You can compare square of a variable a^2 > 0 if you know the property of the variable. 你可以比较的变量^ 2> 0万,如果你知道变量的属性。

             You can test if x is even, odd, integer, real, number or list by the functions: 你可以测试一下,如果x是偶数,奇数,整数,实数或列表的函数:

                         IsEven(x) IsEven(x)的

                         IsOdd(x) IsOddx

                         IsInteger(x) IsIntegerx

                         IsReal(x) IsRealx

                         IsNumber(x) IsNumberx

                         IsFree(y,x) IsFreeYX

 

             Example: 例如:

In: 输入:   

IsEven(2) IsEven(2                   

# is 2 even ?            2是偶数?

Out: True 输出:

                  

 

             Note that comparison by the Is* functions return either True or False otherwise, but comparison by relational operators gives True, False, or left unevaluated otherwise. 请注意,由是*函数比较返回true,否则返回false,而是通过关系运算符比较提供真,假,或左不计算其他。

 

 

4. 4    Defining Functions, Procedures and Rules 定义函数,过程和规则

 

             Anytime when you find yourself using the same expression over and over, you should turn it into a function. 当你发现自己一遍又一遍地使用同样的表情,你应该把它变成一个函数。   

             Anytime when you find yourself using the same definition over and over, you should turn it into a library. 当你发现自己一遍又一遍地使用相同的定义,你应该把它变成一个图书馆。

             You can make your defined function as if the built-in function, by saving your definition into disk file as a library with the function name plus extension .vm as the filename. 你可以让你定义的函数,就好像内置的函数,通过保存您的定义为磁盘文件作为函数名加上扩展名。虚拟机作为文件名 ​​的库。 eg. 例如: save the factorial function as the factorial.vm file (see Section Libraries). 保存阶乘函数作为factorial.vm文件(见库)。

 

 

4.1. 4.1     Defining Functions 定义函数

 

             You can define your own functions by 您可以通过定义自己的函数

                           f(x_) := x_^2 F( X_:= X ^ 2

             Here are some function definitions: 下面是一些函数的定义:

                           f(x_) := Cos(x_ + Pi/3) F( X_:= Cos(X +π/ 3

                           g(x_, y_) := x_^2 – y_^2 G( X_Y_:=  (X ^ 2 - Y ^ 2)

             The argument in the definition should be the pattern x_. 在该定义中的参数应该是模式X_ Otherwise f() works only for a specific symbolic value, eg.