DrMath for Java用户指南
Online Computer Algebra System 在线计算机代数系统
Dr. Weiguang HUANG 黄博士有限公司
Phone: 电话: (61) 0413008019 61413008019
E-mail: 电子邮箱: DrHuang@DrHuang.com ,
26 Aug. 2000 2014年1月1日
Copyright (C) 1990-2000 版权所有(C)1990-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
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). 如果用户只输入一个方案,而无需编写任何代码,它会自动学习与此相关的公式(如学习它涉及一个未知函数f(x)从一个微分许多微分物)很多问题。
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的机器上运行。
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. * 程序,条件,迭代,递归,函数性,以规则为基础,逻辑,模式匹配和图形编程。
请注意, 大写和小写字母是不同的语言,(如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. 请注意,如果在下面的例子有些函数没有工作时,他们的图书馆是不是在默认的目录中缺少,你不应该感到惊讶。
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 = X0由f(X0)评估函数f(x)的值。
Example: 例如:
Evaluate Sin(x) when x=Pi, x=180 degree, x=I. 评估的sin(x),当x =丕, x = 180度,X = I。
In:输入: Sin(Pi), Sin(180*Degree)
Sin(Pi),Sin(180 *degree)
Out: 0, 0 输出:
0,0
In: 输入: Sin(I), N(Sin(I))
Sin(I),N( Sin(I))
Out: Sin(I), 1.175201 I 输出:
Sin(I),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, 更换(Y,X, x0) X0)
Example: 例如:
Evaluate z=x^2 when x=3 and y=4. 评估Z = X ^ 2当x = 3和y = 4。
In: 输入: z:=x^2;
Z:= X ^ 2;
# assign x^2 to z; #为x ^ 2到z;
In: 输入: Replace(z, x,
Replace( Z,X, 3); 3);
# evaluate z when x = 3; #评估Z当X = 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赋值后:= 4,x应该从分配清除清除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),可以作为表达式或函数的计算的数字。
Some math functions are discontinuous at x=x0, and only have one-sided function value. 有些数学函数是不连续的,在x = X0,而且只有片面的函数值。
If the function value is undefined, it may be indeterminate form (eg. 0/0, Infinity/Infinity), you can evaluate it by Lim(). 如果函数值是不确定的,它可能是不确定的形式(如0/0,无限/无限远),您可以通过林对其进行评估()。
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) .......................................... Expand(x)..........................................
(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 *Log(x)
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> 0,Y <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. x是Sin(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为什
IsOdd(2):=真 # assume b is odd #假设b为奇数
IsInteger(b) := True IsInteger(2):=真 # assume b is integer #假设b为整数
IsRational(2):=真 # assume b is ratio #假设b为比
IsReal(2):= TRUE # assume b is real #假设b为实
IsComplex(2):=真 # assume b is complex #假设b为复杂
IsNumber(2):= TRUE # assume b is number #假设b为数字
IsFree(Y,X):= 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) ABS(x)的 x x
x*Sign(x) X *符号(x)的 x Sign(x) X登录(x) Abs(x) ABS(x)的 x x
Abs(x)*Sign(x) ABS(x)的*符号(x)的 Abs(x) Sign(x) ABS(x)的符号(x)的 x x x x
Abs(x)/x ABS(x)的/ X Abs(x)/x ABS(x)的/ X 1/Sign(x) 1/Sign(x) 1 1
------------------------------------------------------------------------------------- -------------------------------------------------- -----------------------------------
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> 1,2 <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) IsOdd(x)
IsInteger(x) IsInteger(x)
IsReal(x) IsReal(x)
IsNumber(x) IsNumber(x)
IsFree(y,x) IsFree(Y,X)
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,而是通过关系运算符比较提供真,假,或左不计算其他。
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文件(见库)。
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. 否则,函数f()仅适用于一个特定的象征意义,比如工作。 x when defining f(x):=x^2. x定义当f(x)的:= X ^ 2。 The pattern x_ should be on both sides of the assignment. 图案X_应该在分配的两侧。
Once defined, functions can be used in expressions or in other function definitions: 一旦定义,函数可以在表达式或其它函数定义中使用:
y := f(3.2) Y:= F(3.2)
z := g(4.1, -5.3) Z:= G(4.1,-5.3)
Example: 例如:
Define a new function for x^2, then evaluate it. 定义一个新的函数对于x ^ 2,然后评估它。
In: 输入: g(x) := x^2;
G(X):= X ^ 2;
In: G(2),G(a), g(x); G(X);
Out: g(2), g(a), 输出:
G(2),G(a) x^2; X ^ 2;
# work only for a symbolic value x; 只为一个象征性的值x工作;
In: 输入:
f(x_) := x_^2; F(X_):= X ^ 2;
In: F(2),F(A);
Out: 4, a^2 输出:
4,^ 2
# work for any value; 对于任何值工作;
You can define a conditional function by the If() function: 您可以通过If( )函数定义一个条件函数:
f1(x_) := If(x_>0 , F1(X_):= If( X> 0, 1) 1),
f2(x_) := If(x_>0 , x_^2 , x_) F2(X_):= If( X> 0,X_^ 2,X)
On the first definition by If(), when f1() is called it gives 1 if x>0, or left unevaluated otherwise. 论如果(),当f1()被调用的第一个定义,它提供了1当x> 0,或左不计算其他。 On the second definition by the If(), when f2() is called it gives x^2 if x>0, x if x<=0, or left unevaluated otherwise. 由如(), 当f2的()被调用第二个定义它给出x ^ 2当x> 0, x如果x <= 0,或左未计算的除外。
You can define a function evaluated only for numbers by 您可以通过定义计算函数只对数字
f(x_) := If(IsNumber(x_) , x_^2) F( X_):= If( IsNumber(X),X ^ 2)
This definition is different from the definition by f(x_) := x_^2. 这个定义是从由f(X_)的定义不同:=X_ ^ 2。 On the latter, when f() is called, it gives x^2, regardless whatever x is. 关于后者,当f()被调用时,它给出x ^2,无论什么x是。On the former, when f() is called, it gives x^2 if x is a number, or left unevaluated otherwise.关于前者,当函数f()被调用时,它给出x^2,如果x是一个数字,或左未计算的除外。
Example: 例如:
evaluate to x^2 only if x is number, by defining a conditional function. 评估为x ^ 2仅当x是数字,通过定义一个条件函数。
In: 输入:
f(x_) := If(IsNumber(x_) , x_^2); F(X_):= If( IsMunber(X),X ^ 2);
In: F(2),F(A);
Out: 4, f(a); 输出:
4,F(A);
In: 输入:
f(x_) := If(x_>0 , x_^2); F(X_):= If( X_> 0,X_ ^ 2);
In: F(2), f(-2), f(a);
Out: 4, f(-2), f(a); 输出:
4,F(-2),F(A);
In: 输入:
f(x_) := If(x_>0 , x_^2 , x_); F(X_):= If( X_> 0,X_ ^ 2,X_);
In:F(2), f(-2), f(a)
Out: 4, 2, f(a); 输出:
4,2,F(A);
You can define the case function by different pattern name. 您可以根据不同的模式名称来定义情况函数。 The case function is similar to the case statement in BASIC language. 此函数类似于BASIC语言的case语句。
Example: 例如:
In: 输入:
f(x_) := If( x_ > 0 And x_ < 1 , 1); F(X_):= If( X_> 0,X_ <1,1);
In:F(U_):= If( U_> 1 And U_ <2,2);
In: F(V_):= If( V_> 2 And V_ <3,3);
In: F(0.2),F(1.2),F(2.2);
Out: 1, 2, 3; 输出: 1,2,3;
You can define a piece-wise function. 你可以定义一个分段函数。
Example: 例如:
define 确定
/ x / X if x < 0 如果x <0时
f(x) = F(X)= 0 0 if x = 0 如果x = 0
\ x^2 \ X ^ 2 if x > 0 如果x> 0时
then evaluate f(-2), f(0), f(3), f(a). 然后评估F(-2),F(0),F(3),F(A)。
In: 输入:
f(x_) := If(x_<0, x_, x_^2); F(X_):= If( X_ <0,X_,X_ ^ 2);
In: F(-2), f(0),F(3), f(a)
Out: -2, 0, 9, f(a); 输出:
-2,0,9, f(a)
You can define a recursion function. 你可以定义一个递归函数。
Example: 例如:
In: 输入:
factorial(1) := 1; fac( 1):= 1;
In:fac( N_):= If( N_> 1,(N_-1)* fac(N_-1));
You can define a function with the multi function values. 您可以与多值函数定义一个函数。
Example: 例如:
In: 输入:
squreroot(x_) := (Sqrt(x_), 0-Sqrt(x_)); squreroot(X_):=(Sqrt(X_),0-Sqrt(X_));
In: squreroot(4);
Out: 2, -2 输出:
2,-2
You can define a function as a procedure by 您可以通过定义一个函数作为一个程序
f(x_) := Block(command1, command2, ..., command_N) F( X_):= Block( 命令1,命令2,... )
By default, all variables in Block() are local. 默认情况下,封锁所有变量()是本地的。 The multi-statement should be grouped by Block(). 多语句应该由 Block()进行分组。 The Block() only outputs the result of the last statement as its value. Block()只输出最后一条语句作为其值的结果。 The multi-line statement must be terminated by the ;. 多行语句必须由被终止;
Example: 例如:
define a numeric integration procedure nint() and calculate integral of x^2 from x=1 to x=2 by call nint(). 定义一个数值积分程序 NInt(),并计算积分的X ^ 2从x = 1到x = 2时,由呼叫NInt()。
In: 输入:
nint(y_,x_,a_,b_) := Block( NInt(Y_,X_,A_,B_):= Block(
dd:=(b_-a_)/50, Y:=(B_-A_)/ 50,
aa:=a_+dd, AA:= A_ +日,
bb:=b_-dd, BB:= B_-DD,
y0:=Replace(y_, x_ , a_), Y0:= Replace( Y_,X_,A_)
yn:=Replace(y_, x_ , b_), YN:= Replace( Y_,X_,B_)
(Sum(y_,x_,aa,bb,dd)+(y0+yn)/2)*dd); (森(Y_,X_,AA,BB,日)+(Y0 + YN)/ 2)*日);
In: NInt(χ^ 2, x,1,2);
You can define transform rules. 您可以定义变换规则。 Defining rules is similar to defining functions. 定义的规则是类似于定义函数。 In defining functions, all arguments must be simple variables, but in defining rules, the first argument can be a complicated expression. 在界定函数,所有参数都必须是简单的变量,但是在定义规则,第一个参数可以是一个复杂的函数。
Example: 例如:
Define log rules. 定义日志规则。
In: 输入: log(x_ * y_) := log(x_) + log(y_); 登录(X_ * Y_):= 日志(X_)+日志(Y_);
In: 输入: log(x_ ^ n_) := n_*log(x_); 登录(X_ ^ N_):= N_ *日志(X_);
In: 输入: log(a*b); 登录(A * B);
Out: log(a) + log(b); 输出:日志(a)+日志(b);
Example: 例如:
In: 输入: Sin(-x_) := 0-Sin(x_);
Sin(-X_):= -Sin(X_);
In:Sin(-A);
Out: -Sin(a); 输出:
-Sin(A);
Example: 例如:
Define derivatives (see Chapter Defining ). 定义微分(见第二章定义)。
In: 输入: D(f(x_), x_) := Sin(x_);
D(F(X_),X_):= Sin(X_);
In: D(F(T),T);
Out: Sin(t); 输出:
Sin(T);
Example: 例如:
Define integrals (see Chapter Indefinite Integration). 定义积分(见第四章不定积分)。
In: 输入: Int(f(x_),x_) := Sin(x_);
Int( F(X_),X_):= Sin(X_);
In: Int( F(T),T);
Out: Sin(t); 输出:
Sin(T);
Example: 例如:
Define the trig simplification rules. 定义三角函数化简规则。
In: 输入:
simplify(Sin(x_)^2, x_) := 1/2*(1-Cos(x_)); sim(sin(X_)^ 2,X_):= 1/2 *(1-Cos(X_));
In: sim(sin(x)^ 2,x)
Out: 1/2 (1 - Cos(x)); 输出:
1/2(1 – Cos(x));
Example: 例如:
Define 定义拉普拉斯 transform rules. 变换规则。
In: 输入:
laplace Laplace( (Sin(t_), t_) := 1/(t_^2+1);Sin(T_),T_):= 1 /(T_ ^ 2 +1);
In: Laplace( S(Sin(s), s);in(S),S);
Out: 1/(s^2 + 1); 输出:
1 /(S ^ 2 + 1);
If symbolic limit falls, you should try numeric limit by 如果象征性的极限下跌,你应该尝试数字的极限
NLim(y, x,x0) NLim( Y,X,X0)
Differentiate an expression y with respect to x by 微分的表达式 y对x :
D(y, x) D( Y,X)
Differentiate y in the n order ( n > 0 ) by Y的n阶微分(N> 0):
D(y, x, n) D( Y,X,N)
Example: 例如:
Differentiate Sin(x) and x^(x^x). 微分 sin(x)和X ^X ^ x 。
In: D(Sin(x), x);输入:
D(x^(x^x), x); D(Sin(x),x)
Out: Cos(x); 输出:
Cos(x)
In: 输入: D(x^(x^x), x);
D(x ^x ^ x,x);
Out: x^(x^x) (x^(-1 + x) + x^x Ln(x) (1 +
Ln(x))); 输出:
X ^(X ^ X)(X ^(-1 + X)+ X ^ x *Ln(X)(1 + Ln(X)));
Example: 例如:
Differentiate the expression f=Sin(x^2+y^3)+ 微分表达式 f = Sin(X ^ 2 + Y ^ 2)+ Cos COS (2*(x^2+y^3)) with respect to x, and with respect to both x and y. (2 *(X ^ 2 + Y^3))关于x,并相对于x和y。
In: 输入: f := Sin(x^2+y^3)+
F:= Sin(X ^ 2 + Y ^ 2)+ Cos Cos( (2*(x^2+y^3));2 *(X ^ 2 + Y ^ 3));
In: D( F,X);
Out: 2 x 输出:
2* Cos COS (x^2 + y^3) - 4 x Sin(2 (x^2 + y^3)); (X ^ 2 + Y ^ 3) - 4×Sin(2(X ^ 2 + Y ^ 3));
In: 输入:
D(D(f, x), y); D(D(F,X),Y);
Out: -6 xy^2 Sin(x^2 + y^3) - 12 xy^2 输出:
-6 XY ^ 2 sin(x ^ 2 + Y ^ 3) - 12 XY ^ 2 Cos COS (2 (x^2 + y^3)); (2(X ^ 2 + Y ^ 3));
Defining derivatives is similar to defining rules. 微分的定义是类似定义规则。 You only need to define derivatives of a simple function, as DrMath automatically apply the chain rule to its complicated function. 你只需要定义一个简单的函数的微分工具DrMath自动应用链式法则其复杂的函数。
Example: 例如:
In: 输入: D(f(x_),x_) := Sin(x_);
D(F(X_),X_):= Sin(X_);
In: D(F(X), X);
Out: Sin(x); 输出:
Sin(x)
In: 输入: D(f(x^6), x)
D( F(X ^ 6), x)
Out: 6 x^5 Sin(x^6) 输出:
6×^ 5 * sin(x ^ 6)
You can find integrals of x^m*Exp(x^n), x^m*Exp(-x^n), Exp((a*x+b)^n), Exp(-(a*x+b)^n), x^m*Ln(x)^n, Ln(a*x+b)^n, etc., (where m and n are any real number). 你可以找到X ^ M * Exp(X ^ n)的积分,X ^ M * Exp(-X ^ n)的地契((A * X + B)^ N),Exp( - (A * X + B )^ N), x ^ M * Ln(x)的n次方,Ln(A * X + B)^ n等,(其中,m和n为任意实数)。
It is recommended that before you do symbolic integration, you should simplify integrand, eg. 建议你做象征性的整合之前,您应该简化被积函数,例如: expand the integrand by Expand(). 通过展开扩大Expand()。
If symbolic integration fails, you should add integral rules into the Int.vm library file, then do integration again (see Chapter Learning From User). 如果象征性的整合失败,您应该添加积分规则到Int.vm库文件,然后再做整合(见第三章学习从用户)。
Find the indefinite integrals of expr by 通过查找expr的不定积分
Int(expr, x) Int(EXPR,X)
Find the double indefinite integrals by 通过查找双不定积分
Int(Int(expr, x), y) Int(Int(EXPR,X),Y)
Note that the arbitrary constant is not represented. 需要注意的是,不表示任意常数。
Example: 例如:
Find integrals of 1/a, 1/b and 1/x, knowing a >0, b is real. 找1 /a,1 / b和1 / x的积分,知道> 0,b是实数。
In: 输入: Assume(a>0), IsReal(b):=True;
If( a> 0),IsReal(b):= True;
In:Int(1 / A,A),Int(1 / B,B),Int(1 / X,X);
Out: Ln(a), Ln(Abs(b)), Ln(x*Sign(x)); 输出:
Ln(A),Ln(ABS(b)),Ln(X *Log(X));
Example: 例如:
Find indefinite integrals. 求不定积分。
In: 输入: Int(Sin(a*x+b), x);
Int(Sin(A * X + B),X);
Out: -Cos(b + ax)/a; 输出:
-Cos(B + A*X);
In: 输入: Int( Sin(x)/x^2, x);
Int(Sin(X)/ X ^ 2,X);
Out: ci(x) - Sin(x)/x; 输出:
CI(X) -sin(x)/ x;
In: 输入:
Int( x*Sin(x), x); Int(X *Sin(x),x);
Out: -x 输出:
-X *Cos COS (x) + Sin(x); (x)+sin(x);
In: 输入: Int(Sin(x)*Cos(x), x);
Int(Sin(x)* Cos(x),x);
Out: (1/2)*Sin(x)^2; 输出:
(1/2)*Sin(x)^ 2;
In: 输入:
Int( E^(x^6), x); Int(E ^(X ^ 6),x);
Out: 1/6 Ei(-5/6, x^6); 输出:
1/6 EI(-5 / 6,X ^ 6);
In: 输入:
Int( x^2*Exp(x), x); Int(X ^ 2 * Exp(x), x)
Out: Ei(2, x); 输出:
EI(2,x)
In: 输入:
Int( Exp(x)/Sqrt(x), x); Int( Exp(X)/ Sqrt(x), x)
Out: Ei(-0.5, x); 输出:
EI(-0.5,x)
In: 输入: Int(x^1.5*Exp(x), x);
Int(X ^ 1.5 * Exp(x), x)
Out: Ei(1.5, x); 输出:
EI(1.5,x)
In: 输入: Int(Sin(x)*Exp(x), x);
Int( Sin(x)* Exp(x), x)
Out: 1/2 * (Sin(x) - Cos(x)) * e^x; 输出: 1/2 *(Sin(X) -Cos(X))* E ^ x
In: 输入: Int( x*Ln(x), x);
Int(x * Ln(x), x)
Out: -1/4 x^2 + 1/2 x^2 Ln(x); 输出:
0/4 X ^ 2 +1 / 2×^ 2 Ln(x)
In: 输入:
Int( Ln(x)^6, x); Int( Ln(x)^6,x)
Out: Li(6, x); 输出:
Li(6x);
In: 输入:
Int( Ln(x)/Sqrt(x), x); Int( Ln(x)/ Sqrt(x), x)
Out: -4 Sqrt(x) + 2 Sqrt(x) Ln(x); 输出:
-4 Sqrt(x)+ 2 Sqrt(x) *Ln(x)
In: 输入:
Int( 1/(x), x); Int(1 /(x), x)
Out: Ln((x) Sign(x)); 输出:
Ln(x);
Example: 例如:
Find the line integral. 找线积分。
In: 输入: x:=2*t; X:= 2 * T;
In: 输入: y:=3*t; Y:= 3 * T;
In: 输入: z:=5*t; Z:= 5 * T;
In: 输入: u:=x+y; U:= X + Y;
In: 输入: v:=xy; 五:= X*Y;
In: 输入: w:=x+y+z; W:= X + Y + Z;
In: 输入: Int(u*D(u,t)+v*D(v,t)+w*D(w,t), t); Int( U * D(U,T)+ V * D(V,T)+ W * D(W,T),T);
Out: 63 t^2; 输出:
64 T ^ 2;
Example: 例如:
Integrate x^2*e^x, then expand it by the mean of the packages "ExpandEi.vm" (expand Ei(n,x)). 整合χ^ 2 * E ^ x,则通过包“ExpandEi.vm”(ExpandEI( N,X))的平均展开。 The packages "ExpandGa.vm" (expand Gamma(n,x)) and "ExpandLi.vm" (expand Li(n,x)) are similar one. 该软件包“ExpandGa.vm”(ExapndGa(N,X))和“ExpandLi.vm”(ExpandLi(N,X))是相似的。
In: 输入:
Int(x^2*Exp(x), x); Int(X ^ 2 * Exp(x), x)
Out: Ei(2,x); 输出:
EI(2,x)
In: 输入: ExpandEi(Ei(2, x));
ExpandEi(EI(2,x));
Out: x^2 Exp(x) - 2 x Exp(x) + 2 Exp(x); 输出:
X ^ 2 Exp(X) - 2×Exp(x)+2 Exp(x)
Defining integrals is similar to defining rules. 限定积分是类似定义规则。
Example: 例如:
In: 输入: Int(f(x_), x_) := Sin(x_); 诠释(F(X_),X_):= Sin(X_);
In: 输入: Int(f(t), t); 诠释(F(T),T);
Out: Sin(t); 输出: 仙(T);
Find definite integrals by external functions 定积分函数
Int(expr, x , xmin , xmax) Int(expr, x,XMIN,XMAX)
Int(expr, x , xmin , singularity , xmax) Int(expr, x,XMIN,奇异性,XMAX)
Example: 例如:
Find the definite integral of y=Exp(1-x) with respect to x taken from 0 to infinity. 发现为y = Exp(1-x)的相对于从0取到无穷x中的定积分。
In: 输入: Int(Exp(1-x), x , 0 , Infinity);
Int(Exp(1-x), x,0,Infinite)
Out: E; 输出:
E
Example: 例如:
do discontinuous integration of 1/x^2 and 1/x^3 with discontinuity at x=0. 做1 / X ^ 2和1 / X ^ 3连续整合间断在x = 0。
In: 输入: Int(1/x^2, x , -1 , 2);
Int(1 /x^ 2, x,-1,2)
# singularity at x=0; #奇点在x = 0;
Out: Infinity; 输出:
无限远
In: 输入: Int(1/x^3, x , -1 , 1);
Int(1 / x ^ 3, x,-1,1)
# singularity at x=0; #奇点在x = 0;
Out: 0 输出:
0
In: 输入:
Int(Sqrt((x-1)^2), x , 0 , 2); Int(Sqrt((x-1)^ 2), x,0,2)
# singularity at x=1; #奇点在x = 1;
Out: 1 输出:
1
DrMath can detect singularity, but sometime it cannot, in this case you must provide singularity. DrMath可以检测奇异性,但有时它不能在这种情况下,你必须提供奇点。
Example: 例如:
In: 输入: Int(1/(x-1)^2, x , 0 , 1 , 2);
Int(1 /(x-1)^ 2, x,0,1,2)
# provide singularity at x=1; #奇异提供在x = 1;
Out: Infinity 输出:
无限
Example: 例如:
In: 输入: Int(1/x, x , I , 2*I);
Int(1 / X,X,I,2 * I)
Out: Ln(2) 输出:
Ln(2)
The external function 数值积分函数
NInt(y, x , xmin , xmax) NInt(Y,X,XMIN,XMAX)
Example: 例如:
Compare numeric and symbolic integrals of 4/(x^2+1) with respect to x taken from 0 to 1. 相对于取从0到1×比较的4 /(X ^ 2 +1)数值和符号的积分值。
In: 输入: NInt(4/(x^2+1), x , 0 , 1);
NInt(4 /(X ^ 2 +1),X,0,1)
Out: 3.1415 输出:
3.1415
In: 输入: N(Int(4/(x^2+1), x , 0 , 1));
N(Int(4 /(X ^ 2 +1),X,0,1))
Out: 3.1416 输出:
3.1416
The equations can be operated (eg. +, -, *, /, ^, Expand(), D(), Int()). 该方程可被操作(例如,+, - ,*,/,^,Expand(),D(),Int())。 The operation is done on both sides of the equation, as by hand. 在操作完成对等式的两边,如通过手。 You can find roots of polynomial, algebraic equations, systems of equations, differential and integral equations. 你可以找到方程,微分和积分方程的多项式,代数方程,系统的根。
You can assign equations to variables. 您可以指定方程的变量。
Example: 例如:
In: 输入:
eq1:= x + y = 3; EQ1:= X + Y = 3;
In:EQ2:= X - Y = 1;
In: EQ1 + EQ2;
Out: 2 x = 4; 输出:
2×= 4;
In: 输入: eq1-eq2;
EQ1,EQ2;
Out: 2 y = 2; 输出:
2 Y = 2;
Example: 例如:
Solve an equation Sqrt(x+2*k) - Sqrt(xk) = Sqrt(k), then check the solution by substituting the root into the equation. 求解方程 Sqrt(X +2 * K) - Sqrt(X - K)= Sqrt(k)时,则通过根代入方程查询的解决方案。
In: 输入:
eq1 := Sqrt(x + 2*k) - Sqrt(x - k) = Sqrt(k); EQ1:= Sqrt(X + 2 * K) - Sqrt(X- K)= Sqrt(K);
Out: eq1 := Sqrt(x + 2*k) - Sqrt(x - k) =
Sqrt(k); 输出:
EQ1:= Sqrt(X + 2 * K) - Sqrt(X- K)= Sqrt(K);
In: 输入: eq1^2;
EQ1 ^ 2;
Out: ((2*k + x)^0.5 - ((-k) + x)^0.5)^2 = k; 输出:
((2 * K + x)^ 0.5 - ((-K)+ X)^ 0.5)^ 2 = K;
You can solve algebraic equations step by step, as above. 你可以一步解决代数方程组的步骤,方法同上。 This method is useful in teaching, eg. 这种方法在教学非常有用,例如。 showing students how to solve equations. 展示学生如何求解方程。
The Solve() functions 求解方程函数
Solve(expr1 = expr2, x) Solve(表达式1 =表达式2,x)
solve a polynomial and systems of linear equations on one step. 解决上一个步骤的线性方程组的多项式和系统。 All of the real and complex roots of the equation will be found by Solve(). 所有方程的实数和复数根将通过Solve()中找到。 The function Solve() outputs a list of roots when there are multi-roots. 函数,可以Solve()输出根目录的列表,当有多个根。 You can get one of roots from the list. 你可以得到一个根从列表中。
Example: 例如:
Solve a+b*x+x^2 = 0 for x, save the root to x. 解决A + B * X + X ^ 2 = 0的x的根存于x。
In: 输入: Solve(a+b*x+x^2 = 0, x);
Solve(x^2+5x+6 = 0,x)
Out: (-b/2 + Sqrt((b/2)^2 - a), 输出:
-2, -3;
Example: 例如:
Solve x^3 + x^2 + x + 5 = 2*x + 6. 求x ^ 3 + X ^ 2 + X + 5 = 2 * X + 6。
In: 输入: N(Solve(x^3+x^2+x+5 = 2*x+6, x));
N(Solve( X ^ 3 + X ^ 2 + X +5 = 2 * X 6,X));
Out: (1, -1, -1) 输出:
(1,-1,-1)
The function Solve() not only solves for a simple variable x but also solves for an unknown function, eg. 函数,可以Solve()不仅解决了一个简单的变量x,但也解决了一个未知的函数,例如。 Ln(x). Ln(X)。
Example: 例如:
Solve the equation for Ln(x). 解方程为Ln(x)的。
In: 输入:
Solve(Ln(x)^2+5*Ln(x) = -6, Ln(x)); Solve( Ln(x)^ 2 +5 * Ln(X)= -6,Ln(X));
Out: (-2, -3); 输出:
(-2,-3);
The external function 外部函数
PSolve(f(x), x) PSolve( F(X), x)
solves f(x)=0 for x. 解决 F(X)= 0对于x。 It is similar to Solve(), but it only can solve polynomial with order < 3. 它类似于 Solve(),但它只能解决多项式顺序<3。
eg. 例如:
In: 输入: PSolve(x^2+5*x+6, x);
PSolve( χ^ 2 +5 * X +6,X);
Out: (-2, -3) 输出:
(-2,-3)
数值求解代数方程
NSolve(f(x) , x) NSolve(F(X),X)
NSolve(f(x) , x,x0) NSolve(F(X), X,X0)
numerically solves an algebraic equation with an initial value x0. 数值求解代数方程的初始值x0。 By default x0=1. 默认情况下,X0 = 1。 NSolve() only gives one solution near x0, omitting other solutions. NSolve()只给出了一个解决方案附近X0,省略其他的解决方案。
Example: 例如:
In: 输入: NSolve( Cos(x) - x, x);
NSolve( Cos(X) - X,X);
Out: x = 0.73911289091; 输出:
X = 0.73911289091;
In: 输入: NSolve( Sin(x) , x,0);
NSolve( Sin(X), X,0);
Out: x = 0; 输出:
X = 0;
# only gives one solution near x0=0; #只给出了近X0 = 0一个解决方案;
In: 输入: NSolve( Sin(x) , x,3);
NSolve( Sin(X), X,3);
Out: x = 3.14; 输出:
X = 3.14;
# only gives one solution near x0=3; #只给出了近X0 = 3一个解决方案;
You can solve the differential equations: 你可以求微分方程数值解:
y'(x) = f(x) Y'(X)= F(X)
by integrating the equation. 通过积分方程。
Example: 例如:
solve y'(x)=Sin(x) by integration. 通过积分解决Y'(X)= Sin(X)。
In: 输入:
Int( D(y(x),x) = Sin(x), x) Int( D(Y(X),X)= Sin(X),x)
Out: y(x) = constant - Cos(x) 输出:
Y(X)=常数-Cos(x)
You can compute partial, finite or infinite sums and products. 你可以计算局部,有限的还是无限的总和,相乘。 Sums and products can be differentiated and integrated. 款项和相乘可以分化和整合。 You construct functions like 您构造函数一样 Taylor 泰勒polynomials or finite Fourier series.多项式或有限傅里叶级数。 The procedure is the same for sums as products so all examples will be restricted to sums. 该过程是相同的款项,所以相乘的所有实例将被限制的款项。 The general formats for these functions are: 一般格式为这些函数是:
Sum(expr, x , xmin , xmax) Sum( expr,XMIN,XMAX)
Sum(expr, x , xmin , xmax , dx) Sum( expr,XMIN,XMAX,DX)
Product(expr, x , xmin , xmax) Product( expr,XMIN,XMAX)
Product(expr, x , xmin , xmax , dx) Product( expr,XMIN,XMAX,DX)
The expression expr is evaluated at xmin, xmin+dx, ... 表达式expr求值在XMIN,XMIN + DX,... up to the last entry in the series not greater than xmax, and the resulting values are added or multiplied. 到该系列中不大于XMAX大于最后一个条目,将所得值相加或相乘。 The part "step dx" is optional and defaults to 1. 部分“一步DX”是可选的,默认为1。 The values of xmin, xmax and dx can be any real number. 的XMIN,XMAX和DX的值可以是任意实数。
Here are some examples: 下面是一些例子:
Sum(j, j from 1 to 10) Sum(十,J从1到10)
for 1 + 2 + .. 为1 + 2 + .. + 10. +10。
Sum(3^j, j , 0 , 10 , 2) Sum( 3 ^Ĵ,J,0,10,2)
for 1 + 3^2 + ... 1 +3 ^ 2 + ... + 3^10. + 3 ^ 10。
Here are some sample 下面是一些示例 Taylor 泰勒polynomials:多项式:
Sum(x^j/j!, j , 0 , n) Sum(X ^ J / J 1,J,O,N)
for Exp(x). 对于Exp(X)。
Sum((-1)^j*x^(2*j+1)/(2*j+1)!, j , 0 , n) Sum((-1)^Ĵ*x ^(2 * j +1)/(2 * j +1)!,J,0,n)
for Sin(x) of degree 2*n+2. 因为罪(x)的程度2 * N +2。
部分和(符号总和)
PartialSum(f(x),x) PartialSum( F(x), x)
finds the partial sum (symbolic sum).
Example: 例如:
Find the sum of 1^2 + 2^2 ... 求1 ^ 2 +2 ^ 2的总和...... + n^2. + N ^ 2。
In: 输入: PartialSum(n^2, n)
PartialSum( N ^ 2,N)
Out: 1/6 n (1 + n) (1 + 2 n) 输出:
1/6 N(1 + N)(1 +2 N)
The function 该函数
InfiniteSum(f(x), x) InfiniteSum(F(X), x)
finds the infinite sum, ie Sum(f(x), x , 0 , Infinity). 找无限的总和,即 Sum(F(X),X,0,Inf)。
Example: 例如:
In: 输入: InfiniteSum(1/n!, n);
InfiniteSum( 1 / N,N!)
Out: E 输出:
E
The functions 该函数
Taylor Taylor(f(x), x)( F(X), x)
Taylor Taylor(f(x), x, order)( F(X),X,n)
Taylor Taylor( (f(x), x, order, x0)F(X),X,n,X0)
to find the 找到 Taylor 泰勒 series at x=x0.系列在x = X0。 The argument (order) is optional and defaults to 5. 该参数 n(阶数)是可选的,缺省值为5。
Example: 例如:
Find the power series expansion for 找到幂级数展开的 Cos Cos((x) at x=0.x)在x = 0处。
In: 输入: Taylor
Taylor(Cos(x), x)
Out: 1 - 1/2 x^2 + 1/24 x^4; 输出:
1 - 1/2 X ^ 2 + 1/24 X ^ 4;
The series expansion of f(x) is useful for numeric calculation of f(x). 该系列展开式 f(x)的是对的f 数值计算很有用(X)。 If you can provide derivative of any function of f(x) and f(0), even though f(x) is unknown, you may be able to calculate the function value at any x, by series expansion. 如果您可以提供f的任意函数的导数(x)和F(0),即使F(x)是未知的,则可以计算出函数值在任意的x,通过级数展开。 Accuracy of calculation depends on the order of series expansion. 计算的精确度取决于串联扩展的顺序。 Higher order, more accuracy, but longer calculation time.高阶,更准确,但更长的计算时间。
Polynomials are automatically sorted in order from low to high. 多项式顺序从低到高自动排序。
You can factor polynomials in order < 5 with respect to x by 您可以通过因式分解,以<5对x
Factor(poly, x) Factor( expr,x)
eg. 例如:
In: 输入: Factor(x^2+5*x+6, x)
Factor( X ^ 2 +5 * X 6,X)
Out: (2 + x) (3 + x) 输出:
(
2 + x)(3 + x)
Different types of data may be converted each other. 不同类型的数据可以互相转换。
The complex number is converted to the real number by 复数转换为实数
Re(z), Im(z), Abs(z), Arg(z), Sign(z) Re(Z),Im(Z),Abs(Z),精氨酸(Z),登录(Z)
The real number is converted to the integer number by 实数转换为整数
Floor(x) Floor(x)
Ceil(x) Ceil(x)
The rational number is converted to the real number by 合理数量由转换为实数
N(x) N(x)的
You can get type of data by 你可以通过数据类型
Type(x) Type(x)
In: 输入: Type(2);
Type(2)
Out: Integer 输出:
整数
You also can get operators by 您还可以通过获得运营商
Type(x) Type(x)
In: 输入: Type(a>b);
Type(A> B);
Out: > 输出:
>
In: 输入:
Type(Sin(x)); Type( sin(x));
Out: Sin() 输出:
SIN()
DrMath includes extensive facilities for graphing.包括图形广泛的设施。
You can plot a function of y = f(x) on the xy-plane by external function: 绘制 y = f(x)在xy平面上的函数:
Plot(f(x),x) Plot( F(X),X)
Plot(f(x),x,xmin,xmax) Plot( F(X),X,XMIN,XMAX)
Plot(f(x),x,xmin,xmax,ymin,ymax) Plot( F(X),X,XMIN,XMAX,YMIN,YMAX)
Plot(f(x),x,xmin,xmax,ymin,ymax,NoPoint) Plot( F(X),X,XMIN,XMAX,YMIN,YMAX,NoPoint)
f(x) can be either a function F(X)可以是一个函数,用绑定变量x或涉及x上的表达。 For example, you could graph the parabola with the command Plot(x^2,x). 例如,您可以使用绘制命令绘制抛物线 Plot(X ^ 2,X)。
The xmin and xmax are range of x-axis, the ymin and ymax are range of y-axis. 在Xmin和XMAX是x轴的范围,则y最小和y是y轴的范围。The default values are xmin=-5, xmax=5, ymin=-5, and ymax=5.默认值是XMIN = -5,XMAX = 5,y最小= -5,和YMAX= 5。The values of xmin, xmax, ymin, ymax are real numbers, such thatXMIN,XMAX,YMIN,YMAX的值是实数,使得 xmin < xmax XMIN<XMAX and和 ymin < ymax.YMIN <y最大。 Thses values tell DrMath that the visible screen corresponds to a portion of the xy-plane with值告诉DrMath,该可视屏幕对应于xy平面的一部分与 xmin <= x <= xmax XMIN <= X <= x最大 and 和 ymin <= y <= ymax. YMIN <= Y <= y 最大。
The operator Plot() plots one point (x,f(x)) for each pixel on the x-axis, and connects successive points. 操作图()绘制1点(x,F(X)),用于在x轴的每个像素,并连接的连续点。
如果你希望你的圆圈和方块看起来正确的也就是说,如果你想要一个垂直单位,真正做到相同的距离为一个水平单元-你应该选择窗口参数,使横轴为1.4倍,只要垂直轴。
Example 5.2: 例5.2:
plot x^3 and Sin(x). X ^ 3和Sin(x)。
In: 输入:
Plot(x^3,x); Plot(X ^ 3,X),
In: Plot( Sin(x),x)
You can plot the parametric functions of x=x(t) and y=y(t) by 您可以绘制出 X = X(t)和Y = Y(t)的参数函数图.
ParametricPlot(x(t),y(t),t) ParametricPlot( X(t),Y(T),T)
ParametricPlot(x(t),y(t),t,tmin,tmax) ParametricPlot( X(t),Y(T),T,TMIN,TMAX)
ParametricPlot(x(t),y(t),t,tmin,tmax,ymin,ymax) ParametricPlot( X(t),Y(T),T,TMIN,TMAX,YMIN,YMAX)
Example: 例如:
In: 输入:
ParametricPlot(Sin(t),Sin(2*t),t) ParametricPlot( Sin(T),Sin(2 * T),T)
You can graph the portion of a polar curve 您可以绘制一个极坐标曲线的部分 r = f(t) that lies in the window with external function: R = F(t)的那在于与外部函数的窗口:
PolarPlot(f(t),t) PolarPlot(F(T),T)
PolarPlot(r, t,tmin,tmax) PolarPlot(R,T,TMIN,TMAX)
PolarPlot(r, t,tmin,tmax,rmin,rmax) PolarPlot(R,T,TMIN,TMAX,RMIN,RMAX)
f(t) can be a function with bound variable t or an expression involving t. 函数f(t)可以用绑定变量t或涉及吨表达式的函数。
Example: 例如:
Plot a circle 绘制一个圆 r = 1 in polar coordinates. R = 1的极坐标。
In: 输入: PolarPlot(1,t)
PolarPlot(1,t)
The variable t covers the domain (0, 2*Pi); you can change this default by specifying a range for t: 变量t覆盖域(0,2 * Pi),你可以通过指定一个范围内为t更改此默认值:
PolarPlot(1, t,0,Pi) PolarPlot( 1,T, 0,Pi)
You can plot data in a data file by the Import menu. 你可以通过菜单导入数据文件中的数据绘制。
One of the most important feature of DrMath is its ability to deduce and expand its knowledge. 其中DrMath的最重要的特点是它的演绎和扩大其知识的能力。 If you provide it with the necessary facts, DrMath can solve many problems that were unable to be solved before. 如果你向它提供必要的事实,DrMath可以解决很多问题,无法前得到解决。 The followings are several ways in which DrMath is able to learn from your input. 以下是几种方式DrMath能够从您的输入来学习。
You supply a simple indefinite integral, and in return, DrMath will perform the related complicated integrals. 你提供一个简单的不定积分,而作为回报,DrMath将执行相关的复杂的积分。
Example: 例如:
Check whether DrMath has already known the following integrals or not. 检查DrMath是否已经公知以下的积分或没有。
In: 输入:
Int(f(x), x); Int( F(X)中,x);
Out: Int(f(x), x); 输出:
Int( F(X),X);
In: 输入: Int((2*f(x)+x),
x);
Int( (2 * F(X)+ X)中,x);
Out: Int((2*f(x)+x), x); 输出:
Int( (2 * F(X)+ X),X);
In: 输入: Int(Int(f(x)+y),
x), y);
Int( Int( F(X)+ Y),X),Y);
Out: Int(Int(f(x)+y), x), y); 输出:
Int( Int( F(X)+ Y),X),Y);
Supply, like in the previous examples, the information: integral of f(x) is f(x) - x; then ask the indefinite integral of 2*f(x)+x, and a double indefinite integral of 2*f(x) + x, and a double indefinite integral of respect to both x and y. 供应,像在前面的例子中,该信息:整体的f(x)是F(X) - X上;然后问2 * F(X)+ X,以及2 * F双不定积分不定积分( x)的+ X和关于x和y的双重不定积分。 Change the first line, and then run the program again. 改变第一行,然后再次运行程序。
In: 输入: Int(f(x_),
x_) := f(x_) – x_;
诠释(F(X_),X_)= F(X_) - X_;
In: 输入: Int(2*f(x)+x,
x);
Int( 2 * F(X)+ X,X);
Out: 2*f(x) - 2*x + 1/2*x^2; 输出:
2 * F(X) - 2 * X + 1/2 * X ^ 2;
In: 输入:
Int(Int(f(x)+y, x), y);; Int( Int( F(X)+ Y,X),Y)
Out: f(x)*y - x*y + x*y^2 输出:
F(X)* Y - X * Y + X * Y ^ 2
You can also ask DrMath to perform the following integrals: 您也可以要求DrMath执行下列积分:
Int(Int(f(x)+y^2, x), y), Int( Int( F(X)+ Y ^ 2,x)中,Y),
Int(Int(f(x)*y, x), y), Int( Int( F(X)* Y,X),Y),
Int(x*f(x), x), Int( X * F(X)中,x),
triple integral of f(x)-y+z, or others. 的f三重积分(X)-Y + Z,或其他。
You continue to ask indefinite integral. 你继续问不定积分。
In: 输入:
Int(Int(f(x)+y, x , 0 , 1), y , 0 , 2); Int( Int( F(X)+ Y,X,0,1),Y,0,2);
Out: 2 f(1) 输出:
2 F(1)
DrMath can learn complicated derivatives from a simple derivative, even though the function to be differentiated is an unknown function, instead of standard function.可以从简单的微分学习复杂的微分,即使是未知函数,而不是标准函数。
Example:例如:
微分 Differentiate f(x^2)^6, where f(x) is an unknown function.F(X ^ 2)^ 6,其中f(x)是一个未知函数。
In: 输入: D(f(x^2)^6,
x);
D( F(X ^ 2)^ 6,X);
Out: 12 xf(x^2)^5 f'(x^2); 输出:
12 X*F(X ^ 2)^ 5 F'(X ^ 2);
Output is only the part derivative. 输出仅部分微分。 f'(x^2) in the output suggest that you should teach DrMath f'(x_). F'(X ^ 2)的输出建议你应该教DrMath F'(X_)。 eg. 例如: the derivative of f(x) is another unknown function df(x), ie f'(x_) = df(x), assign f'(x_) with df(x) and run it again. f的导数(x)是另一个未知函数DF(x)的,即F'(X_)= DF(x)的分配F'(X_)与DF(x)和再次运行它。
In: 输入: D(f(x_),x_)
:= df(x_);
D(F(X_),X_)= DF(X_);
In: D(F(X ^ 2)^ 6,X);
Out: 12 xf(x^2)^5 df(x^2); 输出:
12 XF(X ^ 2)^ 5(X ^ 2);
This time you get the complete derivative. 这个时候你获得完整的函数。
If you show DrMath algebra, DrMath can learn integrals from that algebra. 如果你表现出DrMath代数,DrMath可以从代数学习积分。
Example : 例如:
Input f(x)^2=1/2-1/2*Cos(2*x), then ask for the integral of f(x)^2. 输入F(X)^ 2 = 1/2-1/2 * COS(2 * x),则要求f的积分(x)^ 2。
In: 输入: f(x)
:= 1/2-1/2*Cos(2*x);
F(X)= 1/2-1/2 * COS(2 * x)
In: Int( F(X),x);
Out: 1/2 x - 1/4 Sin(2 x); 输出:
1/2× - 1/4(2个);
DrMath is very flexible. DrMath是非常灵活的。 It learned to solve these problems, even though the types of problems are different, eg. 它学会了解决这些问题,尽管问题的类型是不同的,例如。 learning integrals from derivatives or algebra. 学习从代数积分。
DrMath has the ability to learn complicated algebra from simple algebra. DrMath有从简单的代数学习复杂的代数的能力。
Example: 例如:
Transform log(x*y) into log(x)+log(y) in an expression. 改造日志(X * Y)到日志(x)的+日志(Y)中的表达式。
The
difference between learning and programming is as follows: the learning process
of DrMath is very similar to the way human beings learn, and that is
accomplished by knowing certain rule that can be applied to several problems. 学习和编程之间的区别如下:DrMath的学习过程是非常相似人类学习的方式,这是由知道可以应用到一些问题一定规则来实现的。 Programming is different in the way that the
programmers have to accomplish many tasks before he can begin to solve a
problem. 编程是不同的方式,程序员必须完成许多任务,才可以着手解决一个问题。 First, the programmer defines many
subroutines for the individual integrands (eg. f(x), f(x)+y^2, 2*f(x)+x,
x*f(x), etc.), and for individual integrals (eg. the indefinite integral,
definite integral, the indefinite double integrals, indefinite triple
integrals, definite double integrals, definite triple integrals, etc.), second,
write many lines of program for the individual subroutines, (ie to tell the
computer how to calculate these integrals), third, load these subroutines,
finally, call these subroutines. 首先,程序员定义了许多子程序对个人积式(如:F(X)中,f(x)的+ Y ^ 2,2 * F(X)+
X,X*F(X)等),并为个人积分(如不定积分,定积分,不定二重积分,三重不定积分,定积分的两倍,三重积分,等),
第二,写多少行程序对个人子程序,(即告诉计算机如何计算这些积分),
第三,加载这些子程序,
最后,调用这些子程序。 That is precisely what DrMath do not
ask you to do.
这正是DrMath不要求你做。
In one word, programming means that programmers must provide step-by-step procedures telling the computer how to solve each problems. 总之,编程意味着程序员必须提供一步一步的程序告诉计算机如何解决每个问题。 By contrast, learning means that you need only supply the necessary facts (usually one f'(x) and/or one integral of f(x)), DrMath will determine how to go about solutions of many problems. 相比之下,学习意味着你只需要提供必要的事实(通常是一个F'(x)和/或一个不可分割的f(x)的),DrMath将决定如何去许多问题的解决方案。
If the learning is saved as a library, then you do not need to teach DrMath again when you run DrMath next time. 如果学习被保存为一个图书馆,那么,当你下一次运行DrMath,你就不需要再教DrMath。
DrMath is an interpreter, and runs a DrMath program in the Input window, which is written by any editor in the text (ASCII) file format. DrMath是一个解释器,并运行DrMath程序在输入窗口,这是写在文本(ASCII)文件格式的编辑器。
DrMath language is a procedure language, which is executed from top to bottom in a program, like BASIC, FORTRAN, or PACSAL. DrMath语言是一种程序语言,这是从顶部到底部中的程序来执行,如BASIC,FORTRAN或PACSAL。 It also is an expression-oriented language and functional language. 它也是一种面向表达式的语言和函数式语言。
The DrMath program consists of a number of statements. 该DrMath程序由若干语句。 The most useful statement contains expressions, the expression includes data, and the most important data is functions. 最有用的语句包含表达式,该表达式包含数据,而最重要的是数据的函数。
The structure of DrMath language is: 的DrMath语言的结构是:
data -> expression -> statement -> program 数据- >表达- >报表- >程序
Note that upper and lower case letters are different in DrMath language, (eg. abc is different from ABC).需要注意的是大写和小写字母是不同的DrMath语言,(如ABC是ABC不同)。
In the following examples, a line of "In: " means input, which you type in the Input window, run the program by clicking the menu "Run"; 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. 一些输出可以在实例被删去。
The data types in DrMath language is the numbers, constants, variables, functions, equations, arrays, array index, lists, list index, and strings. 在DrMath语言中的数据类型是数字,常量,变量,函数,方程,数组,数组的索引,列表,列表索引和字符串。所有数据可以被操作。 It is not necessary to declare data to be which type, as DrMath can recognise it.没有必要申报数据是何种类型,如DrMath可以识别它。
The types of numbers are integer, rational, real (floating-point), and complex numbers in the range from -infinity to infinity. 号码类型是整数,理性的,真正的(浮点),和复杂的数字从无穷大到无穷远的范围内。
In fact, the range of the input real numbers is 实际上,输入的实数的范围是
-Infinity, -(10^300)^(10^300) to -10^(-300), 0, 10^(-300) to (10^300)^(10^300), Infinity. -∞, - (10 ^ 300)^(10 ^ 300)到-10 ^(-300),0,10 ^(-300)〜(10 ^ 300)^(10 ^ 300),无限远。
The range of the output real numbers is the same as input when the switch numeric := off, but when the switch numeric := on, it is 输出实数的范围是相同的输入时,开关数字:=关闭,但是当开关数字:=上,它是
-Infinity, -1.E300 to -1.E-300, 0, 1.E-300 to 1.E300, Infinity. -无穷远,-1.E300到1.E-300,0,1.E-300 1.E300,无穷远。
It means that the number larger than 1.e300 is converted automatically to Infinity, the absolute values of the number less than 1.e-300 is converted to 0, and the number less than -1e300 is converted to -Infinity. 这意味着,比1.e300数字越大则自动转换到无限远,小于1.E-300数的绝对值被转换为0,且小于-1E300数转换为负无穷大。
For examples: 举例来说:
------------------------------------------- -------------------------------------------
Numbers 数字 Type 类型
23 23 integer 整数
2/3 2/3 rational 理数
0.23 0.23 real 实数
2+3*I 2 +3 *I complex复数
2.3+I 2.3 + I complex 复数
--------------------------------------------- ---------------------------------------------
That "a" and "b" are the same means ab = 0, while that they are different means ab <> 0. “一”和“b”是相同的手段AB = 0,而它们是不同的装置,AB <> 0。
The constants are the unchangeable values. 常量是不变的值。有一些内置的常量。 The name of these built-in constants should be avoided in the user-defined constants.应避免在用户定义的常量这些内置常量的名称。
------------------------------------------------------------------ -------------------------------------------------- ----------------
Built-in Constants 内置常量 Meanings 含义
Pi:=3.1415926536 Pi:= 3.1415926536 圆周率。
E:=2.7182818285 E:= 2.7182818285 自然对数的底。
I:=Sqrt(-1) I:= SQRT(-1) the imaginary sign of complex numbers.复数的虚数标志。
Infinity Inf 无穷大。
-Infinity –Inf 负无穷大。
UndefinedUndef the undefined value, eg.未定义的值,例如:indeterminate forms:不确定的形式:
0/0, Infinity/Infinity, 0*Infinity, 0^0, etc. 0/0,无限/无限,0 *无穷大,0 ^ 0等。
True True 真
False False 假
-------------------------------------------------------------------- -------------------------------------------------- ------------------
The Infinity can be computed as if numbers. 无穷大可以计算为,如果数字。
Example: 例如:
In: 输入: Infinity+2;
Inf+2;
Out: Infinity 输出:
无限
Notice that the discont and undefined constants are different. 注意,discont和未定义的常数是不同的。 If the value of an expression at x=x0 is discont, the expression only has the one-sided value at x=x0 and this one-sided value is evaluated by x=x0+zero or x=x0-zero. 如果在x = X0的表达式的值是discont,表达式仅具有单面值在x = x0和这个片面值由X = X0 +零或x = X0-零评价。 If the value of an expression at x=x0 is undefined, the expression may be evaluated by the function lim(). 如果在x = X0表达式的值是不确定的,表达式可以由函数LIM进行评估()。
Example: evaluate Exp(1/x) and Sin(x)/x at x=0. 例如:评估地契(1 / x)和的sin(x)/ X的在x = 0。
In: 输入:
f(x_) := Exp(1/x); F(X_)= EXP(1 / x)
Out: f(x_) := Exp(1/x); 输出:
F(X_)= EXP(1 / x)
In: 输入:
f(0); F(0);
Out: Discont; 输出:
不连续;
# f(0) is discontinuity, only has one sided value; #F(0)是不连续,仅具有一个双面值;
In: 输入: Replace(Sin(x)/x,
x , 0);
Replace(sin(x)/ X,X,0);
Out: undefined; 输出:
未定义;
The sequence of characters is used as the name of variables. 字符序列被用作变量的名称。变量名最多可以有128个字符长。 They must begin with a letter and use only letters and digits.他们必须以字母开头,并且只能使用字母和数字。 DrMath knows upper and lower case distinctions in variable names, so AB, ab, Ab and aB are the different variables. DrMath知道变量名大小写的区别,所以AB,AB,AB和ab都是不同的变量。 They are case sensitive. 它们是区分大小写。
Variables can be used to store the results of calculations. 变量可以用来存储计算的结果。 Once a variable is defined, it can be used in another formula. 一旦一个变量被定义,它可以在另一个公式被使用。 Having defined X as above, you could define Y := ASIN(X). 在定义X作为上面,你可以定义Y := ASIN(X)。 You can also redefine a variable by storing a new value in it. 您还可以通过在其存储一个新值重新定义一个变量。 If you do this, you will lose the original value entirely. 如果你这样做,你将完全失去了原有的价值。
Assign a result to a variable, just put 分配的结果给一个变量,只要把
<variable-name> := <variable-name> := expression 表达
eg. 例如: x := 2 + 3 X := 2 +3 # assign value to x #指定的值给x
Variables can be used like constants in expressions. 变量可以像在表达式中的常量。
For example: 例如:
a := 2 + 3 A := 2 + 3
b := a*4 B := A * 4
If an undefined variable is used in an expression, then the expression returns a symbolic result (which may be stored in another variable). 如果未定义的变量被用在一个表达式,那么该表达式返回一个象征性的结果(它可被存储在另一变量)。 Pick an undefined variable name, say x, and enter: 挑一个未定义的变量名,例如x,然后输入:
y := 3 + x Y := 3 + X # formula results since x undefined #公式结果因为x未定义
x := 4 X := 4 # Now x is defined #现在的x定义
y Ÿ # y returns 7, but its value is still the formula 3 + x #Y返回7,但其价值仍然是公式3 + X
x := 7 X := 7 # revalue x #升值压力x
y Ÿ # new value for y 对于Y#新价值
Note that in symbolic computation, the variable has not only a numeric value but also a symbolic value. 请注意,在符号计算,变量不仅具有数值也是一种象征意义。
Symbolic values for variables are useful mostly for viewing the definitions of functions and symbolic differentiation and integration. 变量符号值大多用于查看的函数和象征性的分化和整合的定义是有用的。
Watch out for infinite recursion here. 注意无限递归在这里。 Defining 定义
x := x+3 X := X +3
when x has no initial value, it will not cause an immediate problem, but any future reference to x 当x没有初始值,也不会造成一个现实的问题,但未来任何变量x will result in an infinite recursion ! 将导致无穷递归!
A value can be assigned to the variable, by one of three methods: 的值可以被分配给变量,通过以下三种方法之一:
(1) the assignment :=, (1)赋值 :=,
(2) the user-defined function f(), (2)用户定义函数 f(),
(3) Replace(y, x , x0). (3)Replace(Y,X,X0)。
eg. 例如:
y:=x^2; Y := X ^ 2;
x:=2; X := 2;
# assignment; #任务;
y Ÿ
f(2) F(2)
# if f(x) has been defined, eg. #如果f(x)已定义,例如: f(x_):=x^2. F(X_)= X ^ 2。
Replace(x^2, x , 2); Replace(X ^ 2,X,2);
# evaluate x^2 when x = 2. #计算X ^ 2当x = 2。
The variable named last is the built-in as the variable last is always automatically assigned the value of the last output result. 最后命名的变量是内置的可变最后总是自动分配的最后输出结果的价值。
The usual used independent variable is x. 平时使用的自变量为x。
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. x是仙(x)的复杂,但y是真正的在Y> 1。
You can restrict the domain of a variable by assuming the variable is even, odd, integer, real number, positive or negative (see Chapter Simplification and Assumption). 您可以通过假设变量是偶数,奇数极限变量的域,整数,实数,正数或负数(见第二章的简化和假设)。
Patterns stand for classes of expressions. 模式代表类的表达式。
x_ X_ any expression, given the name x. 任何表达式,给出的名称X。
Patterns should appear on both sides of the assignment. 模式应该出现在赋值的两侧。 Patterns are only used in definition of functions, procedures and rules. 模式只用于函数,程序和规则的定义。
Patterns are used to define functions and rules for pattern match. 模式是用来定义模式匹配函数和规则。
These are two types of functions: internal and external. 这两种类型的函数:内部和外部。The internal function is compiled into the DrMath system.内部函数被编译到DrMath系统。 The external function is the library written in DrMath language, which is automatically loaded when it is needed (see Chapter Library). 外部函数是写在DrMath语言,当它需要(见第四章库),它会自动加载该库。 You can change the property or name of the external function by modifying its library file, or you add a new external function by creating its library file, but you cannot change the internal function. 您可以通过修改它的库文件改变外部函数的性质或名称,或您通过创建它的库文件中添加一个新的外部函数,但你不能改变内部函数。
All below standard functions, (except for random(x), n!, fac(n) and atan2(x,y)), can be differentiated and integrated symbolically.下面所有标准函数,(除了随机(x),n!,FAC(n)和 ATAN2(X,Y)),可以分化和整合。
Table 17.1.5.1 表17.1.5.1 Standard
Mathematical Functions 标准数学函数
----------------------------------------------------------------------- -------------------------------------------------- ---------------------
Functions 函数 Meanings 含义
n! n! factorial of n.阶乘的n。
Sqrt(x) Sqrt(x) square root, the same as x^0.5.平方根,同样为x ^ 0.5。
Exp(x) Exp(x) 同为E ^ x。
Sign(x) Log(x) 1当重(x)的> 0,或两者重(X)= 0和IM(x)> 0; 0在x = 0;
-1 otherwise. 否则返回-1。
Abs(x) Abs(x) absolute value of x.x的绝对值。
Ln(x) Ln(x) x的自然对数函数,基于E。
Sin(x) Sin(x) x的正弦函数。
Cos(x) Cos(x)
Tan(x) Tan(x)
Csc(x) Csc(x)
Sec(x) Secx)
Cot(x) Cot(x)
Asin(x) Asin(x) arc sine function of x, the inverse of Sin(x). x的正弦函数,逆 Sin(x)。
Acos(x) Acos(x)
Atan(x) Atan(x)
Acot(x) Acot(x)
Asec(x) Asec(x)
Acsc(x) Acsc(x)
Atan2(x,y) Atan2(X,Y)
Sinh(x) Sinh(x) hyperbolic sine function of x. x的双曲正弦函数。
Cosh(x) Cosh(x)
Tanh(x) Tanh(x)
Asinh(x) Asinh() arc hyperbolic sine function of x, the inverse of sinh(x). x的双曲正弦函数,双曲正弦(X)的倒数。
Acosh(x) Acosh(x)
-------------------------------------------------------------------------- -------------------------------------------------- ------------------------
Calculus functions are for calculus calculation. 微积分函数是微积分的计算。 The first argument of the function is for evaluation, and the second argument is a variable that is with respect to. 该函数的第一个参数是评价,第二个参数是一个变量,它是相对于x。
Table 17.1.5.2 表17.1.5.2 Calculus Functions 微积分函数
Functions 函数 Meanings 含义
Replace(y, x , x0) Replace(Y,X,X0) evaluates y when x = x0. 评估Ÿ当x = X0。
D(y, x) D(Y,X) differentiate y with respect to x. 区分Ÿ关于x。
D(y, x, order) D(Y,X,n) gives the nth order derivative of y with respect to an undefined variable x. 给出y的n阶导数,以一个未定义的变量x。
D(y) D(Y) implicit differentiation. 隐函数的微分。
Int(y, x) Int( Y,X) find the indefinite integral of y with respect to an undefined variable x. 求y相对于未定义的变量x的不定积分。
Int(y,x,a,b) Int( Y,X,A,B) find the definite integral of y with respect to an undefined variable x taken 求y相对于采取一个未定义的变量x的定积分 , from x=a to x=b. 从X = a到x = b的。
Int(y,x,a,b,c) Int( Y,X,A,B,C) find the definite integral of y with respect to an undefined variable x taken 求y相对于采取一个未定义的变量x的定积分 ,,,,从X = a到x = b,则与x = c,其中b为奇点。
Int(y, x , a , b) Int( Y,X,A,B) the same as Int(y,x,a,b). 一样Int( Y,X,A,B)。
Int(y) Int( Y) implicit integration, used to integrate the differential equations. 隐式积分,用于隐式的微分方程。
Sum(y, x , xmin , xmax) Sum( Y,X,XMIN,XMAX) sum of y step=1. 步 = 1。
Sum(y, x , xmin , xmax , dx) Sum( Y,X,XMIN,XMAX,DX) sum of y. Y的总和值。
Product(y, x , xmin , xmax) Product( Y,X,XMIN,XMAX) product of y step=1. 步= 1的相乘。
Product(y, x , xmin , xmax , dx) Product( Y,X,XMIN,XMAX,DX) product of y. Ÿ相乘。
If a second argument x is omitted in the functions D(y) and Int(y), they are implicit derivatives and integrals. 如果第二个参数x被省略了函数D(Y)和Int(Y),它们是隐式的导数和积分。 If f(x) is undefined, D(f(x), x) is differentiation of f(x). 如果f(x)是不确定的,D(F(X)中,x)是f的分化(x)的。 These are useful in the differential and integral equations. 这些都是在微分和积分方程有用。 (see later chapters). (见后面的章节)。
For examples: 举例来说:
Int(Int(F,x), y) is double integral of F with respect to both variables x and y. Int( Int( F,X),Y)是F的双积分对于两个变量x和y。
D(D(y,x),t) is the mixed derivative of y with respect to x and t. D(D(Y,X),t)是y的关于x和t的混合偏导。
The keywords "from" "to" "step" "," are the same as separators in multi-argument functions. “从”“到”“步”“的关键字,是一样的多参数的函数的分隔符。 eg. 例如: Int(f(x), x, 0, 1) are the same as Int(f(x), x from 0 to 1). Int( F(X)中,x,0,1)是相同的Int(F(x),x, 0,1)。
Examples: 示例:
-------------------------------------------------------------------------------- -------------------------------------------------- ------------------------------
differentiation 区别 D() D() D(x^2,x) D( X ^ 2,X)
integration 积分 Int() Int( ) Int(x^2,x) Int( X ^ 2,X)
--------------------------------------------------------------------------------- -------------------------------------------------- -------------------------------
Table 17.1.5.3.1 表17.1.5.3.1 The is*(x) Functions 类型函数
--------------------------------------------------------------------- -------------------------------------------------- -------------------
Function 函数 Meaning 意思
IsOdd(x) IsOdd(x) test if x is an odd number. 测试,如果x是一个奇数。
IsEven(x) IsEven(x) test if x is an even number. 测试,如果x是一个偶数。
IsInteger(x) IsInteger(x) test if x is an integer number. 测试,如果x是一个整数。
IsRational(x) IsRational(x) test if x is a rational number. 测试,如果x是有理数。
IsReal(x) IsReal(x) test if x is a real number. 测试,如果x是一个实数。
IsComplex(x) IsComplex(x) test if x is a complex number. 测试,如果x是一个复数。
IsNumber(x) IsMunber(x) test if x is a number. 测试,如果x是一个数字。
IsFree(y,x) IsFree(Y,X) test if y is free of x.测试,如果y是自由的x。
---------------------------------------------------------------------- -------------------------------------------------- --------------------
All of the is* functions give either True or False otherwise. 所有的函数给出True或False,否则。
The Type(x) gives the type of x. Type(x)的给出x的类型。 Its value is a string. 它的值是一个字符串。
Table 17.1.5.3.2 表17.1.5.3.2 The Type(x) functions 类型(x)的函数
-------------------------------------------------- --------------------------------------------------
x x Type(x) 式(x)
1 1 Integer 整数
1.1 1.1 Real 实数
2/3 2/3 Rational理数
1+I 1 + I Complex 复数
Sin(x) Sign(x) Sin()Sign
a 一 Symbol 号
a+b A + B + +
a*b A * B * *
a^b 一^ B ^ ^
a=b A = B = =
a==b a== b == ==
a>b A> B > >
a>=b A> = B >= > =
a<b A <B < <
a<=b a<= b <= <=
a<>b a<>b <> <>
a,b A,B , ,
--------------------------------- ---------------------------------
Table 17.1.5.4.1 表17.1.5.4.1 Algebra Functions 代数函数
--------------------------------------------------------------------------------------------------- -------------------------------------------------- -------------------------------------------------
Expand(F) 展开(F) expand (a+b)^2 to a^2 + 2*a*b + b^2. 扩大(A + B)^ 2到^ 2 + 2 * A * B + B ^ 2。
Factor(F) 系数(f) factorise a^2 + 2*a*b + b^2 to (a+b)^2. 地分解一个^ 2 + 2 * A * B + B ^ 2(A + B)^ 2。
Solve(f(x)=0, x) 解决(F(X)= 0,x)的 solve polynomial and systems of linear equations 求解多项式和线性方程组
--------------------------------------------------------------------------------------------------- -------------------------------------------------- -------------------------------------------------
For example: 例如:
----------------------------------------------------------------------- -------------------------------------------------- ---------------------
solving 解 Solve() 解决() Solve(x^2+1 = 0, x) 解决(X ^ 2 +1 = 0,x)的
expanding 扩大 ExpanD() 展开() Expand((a+b)^2) 展开((A + B)^ 2)
factoring 保理业务 Factor() 系数() Factor(a*c+b*c) 因子(A * C + B * C)
---------------------------------------------------------------------- -------------------------------------------------- --------------------
Conversion functions convert a type of data to another type of data. 转换函数转换为数据类型到另一种数据类型。
Table 17.1.5.4.2 表17.1.5.4.2 Conversion Functions 转换函数
--------------------------------------------------------------------- -------------------------------------------------- -------------------
Re(x) 回复(x) real part of complex numbers. 复数的实部。
Im(x) IM(x)的 imaginative part of complex numbers. 复数的富有想象力的一部分。
N(x) N(x)的 convert x to the floating-point number. x转换为浮点数。
Floor(x) 地板(x)的 convert x to the rounded integer. 将x转换为圆角整数。
Ceil(x) CEIL(x)的 convert x to the truncated integer. 将x转换为截断的整数。
---------------------------------------------------------------------- -------------------------------------------------- --------------------
Above functions can be operated and chained, like the standard functions. 上述函数可以操作和链接,像标准函数。
You can define the new functions, which include the standard functions, calculus functions, and algebraic operators. 您可以定义新的函数,其中包括标准函数,微积分函数和代数运算。
Define a new function f(x) by 通过定义一个新的函数f(x)
f(x_) := x_^2 F(X_)= X_ ^ 2
and then call f(x) as the standard functions. 然后调用F(X)作为标准函数。 The function name can be any name. 该函数名称可以是任何名称。
Clears a variable or function from assignment by 通过清除从赋值的变量或函数
Clear(x) Clear(x) # clear x from assignment. #清除x在赋值。
Clear(f(x)) Clear(F(X)) # clear f(x) from assignment. #明确的F(X)的分配。
Clear(a>0) Clear(x> 0) # clear a>0 from assignment. #从分配清除> 0。
Variables can be used in function definitions. 变量可以在函数定义中使用。 It leads to an important difference between functions and variables. 它会导致函数和变量之间的重要区别。 When a variable is defined, all terms of the definition are evaluated. 当一个变量被定义,该定义的所有方面进行评估。 When a function is defined, its terms are not evaluated; they are evaluated when the function is evaluated. 当一个函数被定义,其条款不评估,当该函数被评估它们进行评估。 That means that if a component of the function definition is changed, that change will be reflected the next time the function is evaluated. 这意味着,如果该函数定义的一个组成部分被改变,这种改变将在下一次函数求值反映出来。
A procedure is similar to a function, but the right side of assignment in its definition is multi statements grouped by Block(). 过程是类似的函数,但右侧的分配在其定义的是)由块(分组多语句。 The Block(a,b,c) groups a,b,c and only returns the last argument as its value. Block(A,B,C)组A,B,C,只有最后一个参数返回它的值。 It is used as grouper in definition of a procedure. 它被用作斑中的一个程序的定义。 All variables in block are local. 在块中的所有变量都是局部的。
eg. 例如: f(x_):=Block(p:=x^6,p); F(X_):= Block( f= X_ ^ 6,f);
Remember that you can split a line of statement into multi-lines statement by ending ; 记住,你可以通过结束分割线语句为多行语句;
A rule is similar to a function. 规则是类似于函数。 In definition of function, all arguments of function are simple variables, but in definition of rules, the first argument may be a complicated expression. 在函数定义,函数的所有参数都是简单的变量,但是在规则的定义,第一个参数可以是一个复杂的表达式。
eg. 例如:
f(x_,y_) := x_^2+y_^2 F(X_,Y_) := X^ 2 + Y ^ 2 # defining function #定义函数
f(x_,y_) := Block(a:=2, a+x_^2+y_) F(X_,Y_):= Block(A := 2,A + X ^ 2 + Y) # defining procedure #定义程序
log(x_ * y_) := log(x_)+ log(y_) f(X_ * Y_):= f(X)+ f(Y) # defining rule #定义规则
An equation is an equality of two sides linked by an equation sign =, eg. 一个方程有两个由公式符号=,如挂边相等。 x^2+p = 0, where the symbol = stands for an equation. χ^ 2 + p = 0时,其中符号=表示的方程。 Note that the symbols "=", "==" and ":=" are different: ":=" is the assignment, "==" is the equal sign, but "=" is the equation sign. 注意,符号“=”,“==”和“:=”是不同的:“:=”是赋值,“==”是等号,但“=”是方程符号。
Example: 例如:
In: 输入:
2 = 2; 2 = 2;
Out: 2 = 2; 输出:
2 = 2;
# unevaluated; #不计算;
In: 输入: 2
== 2;
2 == 2;
Out: True; 输出:
TRUE;
eg. 例如:
a < b A <B less than 小于
a <= b a<= b less than or equal to 小于或等于
a > b A> B greater than 大于
a >= b A> = B greater than or equal to 大于或等于
a == b a== b equal to 等于
a <> b a<>b not equals 不等于
The expressions (ie expr) are made up of operators and operands. 表达式(即表达式)是由运营商和操作数。 Most operators are binary, that is, they take two operand; the rest are unitary and take only one operand. 大多数运营商都是二进制的,也就是说,它们需要两个操作数,其余的都是单一的,只需要一个操作数。 Binary operators use the usual algebraic form, eg. 二元运算符使用通常的代数形式,如:。 a+b. A + B。
There are two kinds of expressions: numeric and Boolean. 有两种类型的表达式:数字和布尔值。 The numeric expression is combination of data and algebraic operators while the Boolean expression is combination of data and relational operators and logic operators. 数值表达式数据和代数运算的组合,而布尔表达式为数据和关系运算符和逻辑运算符的组合。 These two kinds of expressions can be mixed, but the numeric expression has higher priority than Boolean operators. 这两种类型的表达式可以混合使用,但数值表达式的优先级高于布尔运算符。 x*(x>0) is different from x*x>0. X *(X> 0)是从X * X> 0的不同。 x*x>0 is the same as (x*x)>0. X * X> 0时是相同的(X * X)> 0。
eg. 例如:
a+b+3 A + B +3 numeric expression, 数值表达式,
a>0 一> 0 Boolean expression
a>0 and b>0 Boolean expression
Table 17.2.1 Operators
--------------------------------------------------------------------------------------------------
Operation 作业 Operators Examples 示例 Order 顺序
comma 逗号 , a:=2, b:=3 1 1
assignment 分配 := := p:=2+3 2 2
and 和 和 a>2 and a<8 2 2
or 或 or 或 a>2 or b>2 2 2
equation 方程 = = x^2+x+1 = 0 3 3
equal 等于 == a==2 3 3
larger than > > a>2 3 3
larger and equal >= > = a>=2 3 3
less than < < a<2 3 3
less and equal <= a<=2 3 3
unequal <> <> a<>2 3 3
plus 加 + + a+b 4 4
minus 减 - - ab AB 4 4
mutilation * * a*b 5 5
division / / a/b 5 5
power ^ ^ a^b 6 6
factorial ! ! n! Ñ! 6 6
positive 正 + + +a 7 7
negative 负 - - -a -一个 7 7
function 函数 f() Sin(x) 7 7
parentheses 括号 () (a+b)*c 7 7
------------------------------------------------------------------------------------------------ -------------------------------------------------- ----------------------------------------------
All functions have the same 7th order.
Operations with higher order precede, otherwise operations with equal precedence are performed from left to right. These are the usual algebraic conventions.
a^b^c is the same as (a^b)^c.
You can get operators by Type(x).
-------------------------------------------------------------------------------------------
plus 加 + + a+b 4 4
minus 减 - - ab AB 4 4
mutilation * * a*b 5 5
division / / a/b 5 5
power ^ ^ a^b 6 6
---------------------------------------------------------------------------------------------
Before you can write loops, you must be able to write statements that evaluate to True or False, and before you can do that, you must be able to write useful statements with logical values. In mathematics, these are relational statements.
DrMath allows you to compare numbers six ways:
a < b less than 小于
a <= b a<= b less than or equal to
a > b A> B greater than 大于
a >= b greater than or equal to
a == b a== b equal to
a <> b a<>b not equals
DrMath uses the double equals sign == (like C language) for "is equal to" to distinguish this operator from the equation =.
The result of a comparison of two real numbers is either True or False. If the comparison is not both real numbers, it left unevaluated.
DrMath uses the logical operators: And, and Or. You can combine comparison operators with them to any level of complexity. In contrast to Pascal, logical operators in DrMath have a lower order or precedence than the comparisons, so a < b and c > d works as expected. The result of combining logical values with
logical operators is another logical value.
DrMath uses the "short-circuit" definition of And and Or when the arguments are Boolean. Short-circuit evaluation is used because often one condition must be tested before another is meaningful.
A function call activates the function specified by the function name. The function call must have a list of actual parameters if the corresponding function declaration contains a list of formal parameters. Each parameter takes the place of the corresponding formal parameter. If the function is external, the function call will automatically load the library specified by its function name plus extension .vm when needed.
Some examples of the function calls follow:
Sin(x) # load the library Sin.vm when needed
Int(x^2, x) # load the library Int.vm when needed
# are the comment statement signs.
You can add comments into a line, or even produce a single line which is entirely a comment, by preceding the comment sign with #.
For example: 例如:
# This is my program;
3 + 4 3 + 4
# My first calculation;
Comments make your calculations more understandable, whether you are making a printed record of what you are doing or if you just want to jot some notes to yourself while you are working.
The evaluation statement has the format:
Expression;
DrMath evaluates any expression which in a line and gives the value of the expression. eg. 例如:
In: 输入:
3 + 4;
Out:
7;
In: 输入:
D(x^6, x);
Out:
6 x^5;
The assignment in DrMath language is similar to assignment in such language as PASCAL.
An assignment operator is := :=
The assignment statement specifies that a new value of expr2 be assigned to expr1, and saved into memory. The form of the assignment statements is
expr1 := expr2;
You can use assignment for storing result.
You can assign the result of calculation or any formula to a variable with a command like: X := SIN(4.2).
The assignments are useful for long calculations. You can save yourself a lot of recalculations by always storing the results of your calculations in your own variables instead of leaving them in the default variable last.
You can destroy the assignment to X with the command Clear(X). If X stored a large list, you could regain a considerable amount of memory by clearing X. Also, since a variable and a function can have the same name, you can clear a variable p, not a function p(x).
The assignment operator is also used in the definition of a function or procedure.
Variables can be used in function definitions, and that leads to an important difference between functions and variables. When a variable is defined, all terms of the definition are evaluated. When a function is defined, its terms are not evaluated; they are evaluated when the function is evaluated. That means that if a component of the function definition is changed, that change will be reflected the next time the function is evaluated.
eg. 例如:
In: 输入:
p:=2+3;
# 2+3 is evaluated at the time of assignment, p is assigned with 5;
Out:
p := 5;
In: 输入:
p(x):=2+3;
# 2+3 is evaluated when the value of p(x) is requested;
# p(x) is assigned with 2+3;
Out:
p(x) := 2+3
If the left hand side of the assignment is a variable, it is the immediate assignment (ie expr2 is evaluated at the time of assignment); if the left hand side is a function, it is the delayed assignment (ie. expr2 is evaluated when the value of expr1 is requested).
Clear a variable, function or expression from assignment by
Clear(x) # clear x from assignment.
Clear(f(x)) # clear f(x) from assignment.
Clear(a>0) # clear a>0 from Assume(a>0).
There are two conditional functions:
If(test , x)
If(test , x , y)
If(condition , x) gives x if condition evaluates to True, or no output otherwise.
If(condition , x , y) gives x if condition evaluates to True, y if it evaluates to False, or no output if it evaluates to neither True or False.
It is useful in definition of the use-defined function to left the function unevaluated if the argument of the function is not number. eg. 例如: define f(x_) := If(IsNumber(x_), 1), then call f(x), f(10) gives 1, and f(a) gives f(a).
You can use two kinds of loops in DrMath , fixed length loops controlled by For() and variable-length loops controlled by While(). The For() loop is similar to the FOR loop in BASIC language.
The control variable in the For() loop is not limited to integer values. You can say:
For(x , xmin , xmax , dx, body);
It is similar to
FOR x := xmin TO xmax STEP dx
body 体
NEXT x
where xmin, xmax, and dx are real values. If STEP dx is omitted, it defaults to 1.
eg. 例如:
In: 输入:
x:=0;
Out:
x := 0;
In: 输入:
For( j , 1 , 5 , 1, x:=x+1);
Out:
x := 5;
The conditional loops are probably more useful than the For() loops if a number of iteration is unknown. It is 这是
While(test, body);
The While() repeats to evaluate body while the test is True.
Example: 例如:
In: 输入:
x:=1;
Out:
x := 1;
In: 输入:
While(x<5, x:=x+1 );
Out:
x := 6;
The all above statements are simple statements. The sequence statement specifies that its component statements are to be executed in the same sequence as they are written. They are separated by the separators (comma ","). eg. 例如:
a+b, 2+3;
A library is a file of an external function, which filename is its function name plus extension .vm. eg. 例如: the library named Sin.vm is a file of the Sin(x) function definition.
The library (the *.vm file) is similar to the MS-DOS *.BAT file. You do not need to load or read the library by any command. DrMath automatically load the library when it is needed. For example, when you use the Sin(x) function first time, the library Sin.vm will be auto-loaded. The library must be in the default directory, otherwise the library is not loaded and the function is not working. Only the assignments in the library can be loaded, and others in the library will be omitted, but all of these assignments will be not evaluated when they are loaded. You can clear the library Sin.txt from memory by Clear(Sin(x)).
You can have libraries (external functions) as many as your disk space available. You should use the "one function per file" convenience.
There are many libraries. The following are some of them.
Table 17.4.1 Libraries 库
------------------------------------------------------------------------ -------------------------------------------------- ----------------------
File Name 文件名 Function 函数
Plot.txt plotting functions.
D.txt derivatives.
Int.txt integrals. 积分。
Sum.txt sum function.
NInt.txt numeric integration.
NSolve.txt numeric solver of equation.
DSolve.txt differential equation solver.
Gamma.txt gamma function.
Ei.txt exponential integral function.
------------------------------------------------------------------------ -------------------------------------------------- ----------------------
You can run DrMath from another software as a engine. Another software sends a text file to DrMath, then run DrMath in background, get result back from DrMath.
DrMath is a text editor in which you can copy-and-paste anywhere in a file and between files, even from other documents outsides DrMath .
The screen is divided into four areas: a menu line, an Input window, an Output window, and the Graph window.
The menu line is the main menu and locates in the top of the screen.
The Input window is a multi-windowed text editor for input.
The Output window is a multi-windowed text editor for output.
The Open menu opens a file for edit in the Input window. This menu first opens a Directory window to choose a file for edit. You select a file from the Directory window to open for edit in the Input window.
It imports data from a file for data plot.
The "Save Input" menu saves the file in the Input window into disk under a different name or in a different directory.
The "Save Output" menu saves the file in the Output window into disk under a different name or in a different directory.
You can copy-and-paste from and to your document by right-button clicking on the text field to pop-up menu. For second way of copy-and-paste, first select the text, then key in Ctrl+C (ie press the Ctrl key and the C key at the same time), then point to where you want to paste, and finally key in Ctrl+V (ie press the Ctrl key and the V key at the same time).
The Run menu executes the user program in the Input window, outputs the results in the Output window.
It changes graph of size and colour. Click on the "Zoom In" or "Zoom Out" menu under the Graph menu to zoom.点击“放大”或“缩小”菜单下的图形菜单放大。
The 该
As an expert system, DrMath consists of three major components: a knowledge base, an inference engine, and a global database. The knowledge base is a set of rules. The inference engine is a rule interpreter for utilising the knowledge base in the solution of the problem, and the global data base is a working memory for keeping track of the problem status, the data from the data file for the particular problem, and the solution of sub-problems. In addition, it contains a natural language interface for input and output natural languages (eg. mathematical formulas, chemical reactions).
User 用户 Library 文库 disk 圆盘
/|\ | | /|\
| | | | ||
\|/ \|/ \|/
--------------------------------------- ---------------------------------------
| Natural Language Interface |
-------------------------------------- --------------------------------------
/|\
| |
\|/
------------------------------ ------------------------------
------->| Inference Engine |<----------
| | ------------------------------ ------------------------------ | |
\|/ \|/
------------------------- ------------------------- --------------------------
| Knowledge Base | | Global Data Base |
------------------------- ------------------------- --------------------------
/|\
| |
-------------------- --------------------
| | Data File 数据文件 | |
-------------------- --------------------
Figure 20.1 Structure of DrMath
Table 20.1 Characteristics of DrMath
-------------------------------------------------------------------- -------------------------------------------------- ------------------
Function: 函数: Symbolic computation.
Domain: 域: Mathematics. 数学。
Search direction: Forward chaining.
Control mechanism: Guessing and test, pattern match.
Search space transformations: Break into sub-problems.
Knowledge base representation: Rules.
Developer interface: Learning, programming, library.
User interface: Pull-down menu, pop-up menu, editor, windows.
System interface: numeric computation software, graphic software, etc.
Input format: Math formulas, numbers, BASIC or FORTRAN codes,
Output
format: Math notation,
Input from: Keyboard, disk.
Output to: Screen, disk, printer.
Tool language: Java. 爪哇。
Computer: Any machine that supports Java
Memory: 内存: 16 MBytes.
Operating system: 操作系统: Any OS that support Java.
---------------------------------------------------------------------
You can add feature into DrMath by developing library that is auto-loaded. You also can extend Java class that is auto-loaded.
Upper- and lower-case letters are different. A first letter of each word in DrMath keywords is upper-case.
There are two types of the keywords: internal and external. The internal keywords have been compiled into the DrMath system, so you cannot change them. The external ones are in files, so you can change their name or property. Usages of both types are the same.
The following only includes the internal and some external keywords. You can define your own keyword and add your defined function. If some keywords do not work, you should check whether or not the libraries are in the default library directory.
---------------------------------------------------------------------
Arithmetic operators:
+, -, *, / plus, minus, times, division
^ ^
()
Relational operators:
== equals 等于
> > greater than 大于
>= > = 大于等于
< < less than小于
<= 小于等于
<> <>
Assignments:
:= :=
Equation: 公式:
= =
Solve(x^2=1,x) solve x^2=1 for x
PSolve(f(x),x) solve f(x)=0 for x
NSolve(Cos(x)=x,x) numerically solve f(x)=0 for x with initial x0=1
NSolve(f(x)=0,x,x0) numerically solve f(x)=0 for x with initial x0
Comment: 评论:
# #
Built-in constants:
I, E, Pi, Infinity, True, False
Logic operators:
And, Or, Not(x)
Algebraic functions:
-x minus x
Sqrt(x) square root of x
n! n! factorial of n
Expand(x) Expand(x) expand x
Factor(x) Factor(x) factor x
Complex to real:
Re(x) real part of the complex number x
Im(x) imaginative part of the complex number x
Abs(x) Abs(x) absolute value of x
Arg(x) argument of complex number x
Sign(x) sign of complex number of x
Exponential functions:
Exp(x) natural exponential of x, Exp(x)=E^x
Ln(x) natural logarithm of x
Trig functions:
Sin(x) sine of x
Cos(x) cosine of x
Tan(x) tangent of x
Csc(x) cosecant of x
Sec(x) secant of x
Cot(x) cotangent of x
Inverse trig functions:
Asin(x) angle whose sine is x
Acos(x) angle whose cosine is x
Atan(x) angle whose tangent is x
Atan2(x,y) angle whose tangent is x/y
Hyperbolic functions:
Sinh(x) hyperbolic sine of x
Cosh(x) hyperbolic cosine of x
Tanh(x) hyperbolic tangent of x
Special math integral functions:
Ei(x) exponential integral function
Ei(n,x) incomplete exponential integral function Int(t^(n-1)*Exp(t), t,-Infinity,x)
Gamma(n) gamma function Int(t^(n-1)*Exp(-t), t,0,Infinity)=(n-1)!
Gamma(n,x) incomplete gamma function Int(t^(n-1)*Exp(-t), t,0,x)
Erf(x) error function 2/Sqrt(Pi)*Int(Exp(-t^2),t,0,x)
Si(x) sine integral function Int(Sin(x)/x)
Ci(x) cosine integral function Int(Cos(x)/x)
Li(x) log integral function Int(1/Ln(t), t,0,x)
Li(n,x) incomplete log integral function Int(Ln(t)^n, t,0,x)
Defining functions:
f(x_) := x_^2 F(X_):= X_ ^ 2
f(x_) := If(x_>0 , x_^2)
Defining procedures:
f(x_) := Block(p:=x_^2,p)
Defining rules:
log(x_ * y_) := log(x_)+log(y_)
Clear:
Clear(x) clear variable x
Clear(f(x)) clear function f(x)
Clear(a>0) clear unequal a>0
Calculus functions:
Differentiating:
D(y,x) differentiate y with respect to x
D(y,x,n) differentiate y with respect to x in the n-th order
Integrating: 积分:
Int(y,x) integrate y with respect to x
Int(y,x,xmin,xmax) integrate y with respect to x from xmin to xmax
NInt(y,x,xmin,xmax) numerically integrate y wrt x from xmin to xmax
Substituting: 代:
Replace(y,x,x0) replace x by x0 in y
Laplace(y,x) Laplace transform
Sum(y, x,xmin,xmax,dx) sum of y wrt x from xmin to xmax step dx
PartSum(y,x) partial sum of y
InfSum(y,x) infinite sum of y
Product(y, x,xmin,xmax,dx) product of y wrt x from xmin to xmax step dx
Taylor(y,x) series of y at x=0 to order of 5
Taylor(y,x,order) series of y at x=0 to order
Conversion functions:
Floor(x) convert x to the rounded integer closet to x
Ceil(x) convert x to the truncated integer closet to x
Type(x) type of x
Numeric computation:
N(x) numeric value of x
NSolve(Cos(x)-x,x) numerically solve Cos(x)-x=0 wrt x with initial x0=0.1
NSolve(Cos(x)-x,x,x0) numerically solve Cos(x)-x=0 wrt x with initial x0
NInt(y,x,xmin,xmax) numerically integrate y wrt x from xmin to xmax
Test functions:
IsConstant(x) test if x is a constant
IsOdd(x) IsOdd(x) test if x is odd
IsEven(x) IsEven(x) test if x is even
IsInteger(x) test if x is integer
IsRational(x) test if x is rational number
IsReal(x) test if x is real
IsComplex(x) test if x is complex
IsNumber(x) test if x is a number
IsFree(y,x) IsFree(Y,X) test if y is free of x
Type(x)==Real test if x is real
Comma:
, ,
Assume: 假设:
Assume(a>0) assume a > 0
IsReal(x):=True assume x is real
Conditional:
If(x>0 , x) if x > 0 then x
If(x>0 , x , 0-x) if x > 0 then x else -x
Loop:
While(x<5, body ) while x<5, repeat body
For(x,xmin,xmax,dx, body) do body wrt x from xmin to xmax with step dx
Getting parts:
Type(x) type of x
Re(x) real part
Im(x) imaginative part
Graph:
Plot(y,x) plot y wrt x from x=-5 to 5, from y=-5 to 5
Plot(y,x,xmin,xmax) plot y wrt x from x=xmin to xmax, from y=-5 to 5
Plot(y,x,xmin,xmax,ymin,ymax)
plot y wrt x from x=xmin to xmax, from y=ymin to ymax
ParametricPlot(x(t),y(t),t) parametric plot x(t) and y(t) wrt t from t=0 to 2*Pi
ParametricPlot(x(t),y(t),t,tmin,tmax) parametric plot x(t) and y(t) wrt t from t=tmin to tmax
PolarPlot(r(t),t) polar plot r(t) wrt t from t=0 to 2*Pi
PolarPlot(r(t),t,tmin,tmax) polar plot x(t) and y(t) wrt t from t=tmin to tmax
---------------------------------------------------------------------------------------------------
+ + - - * * / / ^ ^
** ** () () // / / = = := :=
== > > >= > = < < <=
<> <> ! ! # # , , ; ;
--------------------------------------------------------------------------------------------------
You can use library as standard functions by library name without extension. Eg Abs, not Abs.vm. Please see file name in the vmath\library directory.
The keywords indicated internal are the internal functions or constants, otherwise they are the external.
* Abs()
Abs(x) is the absolute value function of x. x can be complex numbers. Abs(x) = Sqrt(Re(x)^2+Im(x)^2). The results are in the range 0 to Infinity.
See also: Abs, Arg, Sign, Re, Im.
eg. 例如:
In: 输入:
Abs(-1), Abs(-I)
Out:
1, 1
* Acos()
Acos(x) is the arc cosine function of x. The inverse function of Cos(x). The result is given in radians.
See also: Acos, Cos.
* Acosh()
Acosh(x) is the inverse hyperbolic cosine function of x. The inverse function of Cosh(x).
See also: Acosh, Cosh.
* Acot()
Acot(x) is the arc cotangent function of x. ACOT(x)是x的反余切函数。 The inverse function of Cot(x).婴儿床的逆函数(x)。 The result is given in radians. Acot(x)=Pi/2-Atan(x). ACOT(X)= Pi/2-Atan(x)的。
See also: Acot, Cot.
* Acoth()
Acoth(x) is the inverse hyperbolic cotangent function of x. The inverse function of Coth(x). Acoth(x)=Atanh(1/x).
See also: Acoth, Coth.
* Acsc()
Acsc(x) is the arc cosecant function of x. The inverse function of Csc(x). The result is in radians. Acsc(x)=Pi/2-Asin(x).
See also: acsc, csc.
* Acsch()
Acsch(x) is the inverse hyperbolic cosecant function of x. The inverse function of Csch(x). Acsch(x)=Asinh(1/x).
See also: Acsch, Csch.
* And
logic operator. It is bitwise and. The result is True, False or unevaluated.
See also: Or.
* Arg()
Arg(x) gives the argument (phase angle) of x in radians. It only gives the principle value (PV): -Pi < arg(x) <= Pi. arg(x) = atan2(re(x),im(x)). x can be complex number. For positive real x, Arg(x)=0.
See also: Abs, Arg, Sign, Atan2.
eg. 例如: N(Arg(I)) gives 1.5..
* Asec()
Asec(x) is the arc secant function of x. The inverse function of Sec(x). The result is given in radians.
See also: Asec, Sec.
* Asech()
Asech(x) is the inverse hyperbolic secant function of x. The inverse function of Sech(x). Asech(x)=Acosh(1/x).
See also: Asech, Sech.
* Asin()
Asin(x) is the arc sine function of x. ASIN(x)是x的反正弦函数。 The inverse function of Sin(x).仙逆函数(x)。 The result is given in radians.
See also: Asin, Sin.
* Asinh()
Asinh(x) is the inverse hyperbolic sine function of x. The inverse function of Sinh(x).
See also: Asinh, Sinh.
* Assume()
Assume(x > 1) assumes the variable x > 1 in real domain.
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. x是仙(x)的复杂,但y是真正的在Y> 1。
You can restrict the domain of a variable by assuming the variable is even, odd, integer, real number, positive or negative. 您可以通过假设变量是偶数,奇数,整数,实数,正或负的极限变量的域。 The Assume() can be cleared by Clear().
See also: Sign.
eg. 例如: Assume(x>0), Assume(x>0, y<0), IsEven(x):=True
* Atan()
Atan(x) is the arc tangent function of x. The inverse function of tan(x).棕褐色的反函数(x)。 The result is given in radians.
See also: atan, tan.
* Atan2() internal 内部
Atan2(x,y) returns the radian angle of (x,y).
Atan2(x,y) = Sign(y)*Pi/2 if x=0
= atan(y/x) if x>0
= atan(y/x)+Pi if x<0, y>=0
= atan(y/x)-Pi if x<0, y<0 .
Thus atan2(x,y) takes its value of -Pi < atan2(x,y) <= Pi.
See also: atan, arg.
* Atanh()
atanh(x) is the inverse hyperbolic tangent function of x. The inverse function of tanh(x).
See also: tanh.
* Block() internal 内部
Block(a,b,c) groups a,b,c and only returns the last argument as its value. It is used as grouper in definition of a procedure. All variables in block are local.
See also: local.
eg. 例如: f(x_):=Block(p:=x_^6,p)
* Ceil() internal 内部
Ceil(x) converts x to the rounded integer closest to x.
See also: Floor.
* Ci()
Ci(x) is cos integral, Ci(x) = Int(Cos(x)/x, x).
See also: Si, Ei, Gamma, Erf.
* Clear() internal 内部
Clear(y) clears values and definitions for the variable, function or expression y from memory.
See also: assume, :=.
eg. 例如: Clear(p), Clear(f(x)), Clear(a>0)
* Cos()
Cos(x) is the cosine function of x. The angle x is measured in radians (multiply by degree to convert from degrees). x can be complex numbers.
See also: Acos, Sec.
* Cosh()
Cosh(x) is the hyperbolic cosine function of x. Cosh(x)=(Exp(x)+Exp(-x))/2. x can be complex numbers.
See also: Acosh.
* Cot()
Cot(x) is the cotangent function of x. The angle x is measured in radians. (multiply by degree to convert from degrees). cot(x)=1/tan(x).
See also: Acot, Tan.
* Coth()
Coth(x) is the hyperbolic cotangent function of x. coth(x)=1/tanh(x).
See also: acoth, tanh.
* Csc()
Csc (x) is the cosecant function of x. The angle x is measured in radians (multiply by degree to convert from degrees). Csc(x)=1/Sin(x) x can be complex numbers.
See also: Acsc, Sin.
* Csch()
csch(x) is the hyperbolic cosecant function of x. csch(x)=1/sinh(x). x can be complex numbers.
See also: acsch, sinh.
* D()
D() gives the partial derivative.
D(y,x) internal 内部
It differentiate y with respect to x.
eg. 例如: D(x^2,x) gives 2*x.
eg. 例如: D(Sin(x),x) gives Cos(x).
D(y, x, n) D( Y,X,N)
It gives the n-th order derivative of y with respect to an undefined variable x.
eg. 例如: D(Sin(x),x,2) gives -Sin(x).
See also: Int, NInt.
* Degree
degree gives the number of radians in one degree. degree=Pi/180. You can multiply by degree to convert from degree to radians.
See also: Pi.
eg. 例如: 45*degree, Sin(45*degree).
* Discont internal 内部
The discontinuity. If f(x0) gives discont, the function has a discontinuity and only has the one-sided value at x=x0. You should evaluate its left-sided or right-sided value by f(x0-zero) or f(x0+zero).
See also: zero, Infinity.
* For() internal 内部
For(x,xmin,xmax,dx, expr) evaluates expr with the x looping from xmin to xmax on step dx.
See also: repeat, list.
eg. 例如:
In: 输入: x:=0, For(j,1,5,1, x:=x+1);
Out: x := 5;
* Done internal 内部
It indicates that the command has been done. See also: assumed, cleared.
* E
(1) e is the exponential constant (base of natural logarithms), E=2.718..., the built-in constant, E is converted to 2.718... by N(E). e^x is the same as Exp(x).
(2) e is the exponential part of a floating point number, the same as E.
eg. 例如: 1.1e2 is the same as 1.1E2.
See also: Exp.
* Ei()
Ei(x) is the exponential integral function Ei(x), Ei(x) = Int(e^t/t, t,-Infinity,x), ei'(x) = e^x/x.
Ei(n,x) is the incomplete exponential integral function, Ei(n,x) = Int(t^n*e^t, t,-Infinity,x), D(Ei(n,x),x) = x^n*e^x, Ei(-1, x) = Ei(x), Ei(0,x) = e^x.
See also: Gamma, Erf, Ci, Si, Li.
* Erf()
Erf(x) is the error function of x. It is the probability integral function or the integral of the Gaussian distribution. Erf(x) = 2/Sqrt(Pi)*Int(Exp(-t^2),t,0,x), D(Erf(x),x) = 2/Sqrt(Pi)*Exp(-x^2).
See also: Ei, Gamma, Ci, Si.
* Exp() internal 内部
Exp(x) is the exponential function of x (base of e). The same as E^x, E=2.718... It is the inverse to Ln(x). x can be complex numbers.
See also: E.
* Expand()
(1) ExpanD(y) expands out products and positive powers in y. ExpanD() works only on positive integer powers.
See also: factor.
eg. 例如: ExpanD((a+b)^2) gives a^2 + 2*a*b + b^2.
(2) the switch of expansion.
expand:=on eg. 例如: c*(a+b) to c*a+c*b.
expand:=off disable expansion, this is default.
See also: expandexp.
* ExpandExp()
The exponential expansion.
eg. 例如: c^(a+b) to c^a*c^b.
See also: expand.
* Gamma()
Gamma(n) is the Gamma function _(n), Gamma(n) = Int(t^(n-1)*Exp(-t), t,0,Infinity), Gamma(n) = (n-1)!.
Gamma(n,x) is the incomplete Gamma function, Gamma(n,x) = Int(t^(n-1)*Exp(-t), t,0,x), D(Gamma(n,x),x) = x^n*Exp(-x) Gamma(n,0) = 0, Gamma(n,Infinity) = Gamma(n) = (n-1)!.
Gamma(n,x) is similar to Gamma(n).
See also: Ei, Erf, Ci, Si, Li.
* I internal 内部
I represents the imaginative unit of the complex numbers, I=Sqrt(-1), as the built-in constant.
See also: Re, Im, Sign, Arg.
eg. 例如: 1+2*I.
* If() internal 内部
If(condition,x) gives x if condition evaluates to True, or left unevaluated otherwise.
If(condition,x,y)
gives x if condition evaluates to True, y if it evaluates to False, or left unevaluated if the condition is neither True nor False.
It is useful in definition of the use-defined function to left the function unevaluated if the argument of the function is not number.
See also: .
eg. 例如:
In: 输入: f(x_) := If(IsNumber(x_), 1);
In: 输入: f(x), f(10);
Out: f(x), 1;
* Im() internal 内部
Im(x) gives the imaginative part of the complex number x.
See also: Re, Abs, Sign, Arg.
eg. 例如: Im(1+2*I) gives 2.
* Infinity internal 内部
Infinity is a positive infinity, as the built-in constant.
See also: 另请参阅:
eg. 例如: Infinity+2*Infinity gives Infinity, 1/Infinity gives 0.
* InfSum()
InfSum(y,x) is infinite sum.
See also: PartSum, Sum.
* Int()
Int() is the integral function.
Int(y,x) internal 内部
It finds the indefinite integral of y with respect to an undefined variable x.
Int(y,x,xmin,xmax)
It finds the definite integral of y with respect to the variable x taken from x=xmni to x=xmax.
Int(y,x,xmin,x1,xmax)
It finds the definite integral of y from x=xmin to x=x1, then from x=x1 to x=xmax. x1 is singularity.
See also: NInt.
* IsComplex() internal 内部
IsComplex(x) tests if x is complex. It gives True if x is complex, or False otherwise.
See also: IsComplex, IsEven, IsFree, IsInteger, IsOdd, IsReal, IsRational, IsNumber, IsConstant.
eg. 例如: IsComplex(I) gives True.
* IsConstant()
It tests if x is a constant.
* IsEven()
IsEven(x) gives True if x is an even integer, or False otherwise. You can assume x is even by IsEven(x) := True.
See also: IsComplex, IsEven, IsFree, IsInteger, IsOdd, IsReal, IsRational, IsNumber, IsConstant.
eg. 例如: IsEven(2) gives True, IsEven(3) gives False.
* IsFree() internal 内部
IsFree(y,x) gives True if y is free of x, or False otherwise. You can assume y is free of x by IsEven(y,x) := True.
See also: IsComplex, IsEven, IsFree, IsInteger, IsOdd, IsReal, IsRational, IsNumber, IsConstant.
eg. 例如: IsFree(a*b,x) gives True, IsFree(x*y,x) gives False.
* IsInteger() internal 内部
IsInteger(x) gives True if x is an integer, or False otherwise. You can assume x is integer by IsInteger(x) := True.
See also: IsComplex, IsEven, IsFree, IsInteger, IsOdd, IsReal, IsRational, IsNumber, IsConstant.
eg. 例如: IsInteger(2) gives True, IsInteger(3.2) gives False.
* IsOdd() internal 内部
IsOdd(x) gives True if x is an odd integer, or False otherwise. You can assume x is odd by IsOdD(x) := True.
See also: IsComplex, IsEven, IsFree, IsInteger, IsOdd, IsReal, IsRational, IsNumber, IsConstant.
eg. 例如: IsOdd(3) gives True, IsOdd(2) gives False.
* IsRational() internal 内部
IsRational(x) gives True if x is ratio, or False otherwise. You can assume x is ratio by IsOdD(x) := True.
See also: IsComplex, IsEven, IsFree, IsInteger, IsOdd, IsReal, IsRational, IsNumber, IsConstant.
eg. 例如: IsRational(2/3) gives True, IsRational(2) gives False.
* IsReal() internal 内部
IsReal(x) gives True if x is real, or False otherwise. You can assume x is real by IsReal(x) := 1.
See also: IsComplex, IsEven, IsFree, IsInteger, IsOdd, IsReal, IsRational, IsNumber, IsConstant.
eg. 例如: IsReal(2.2) gives True, IsReal(a) gives False.
* IsNumber() internal 内部
IsNumber(x) gives True if x is a number, or False otherwise. You can assume x is a number by IsNumber(x) := True.
See also: IsComplex, IsEven, IsFree, IsInteger, IsOdd, IsReal, IsRational, IsNumber, IsConstant.
eg. 例如: IsNumber(2.2) gives True, IsNumber(a) gives False.
* Laplace()
Laplace(y,x) gives Laplace transform of y.
eg. 例如: Laplace(Sin(t),t) gives 1/(1+t^2).
* Li()
Li(x) is the Ln integral function, Li(x) = Int(1/Ln(t), t,0,x) = Ei(Ln(x)), D(Li(x),x)=1/Ln(x).
Li(n,x) is the incomplete ln integral function, Li(n,x) = Int(Ln(t)^n, t,0,x) = Ei(n,Ln(x)), D(Li(n,x),x) = Ln(x)^n. Li(n,0) = 0.
See also: Ei, Gamma, Erf, Ci, Si, Li.
* Ln()
Ln(x) is the natural logarithmic function of x. Its base is e. It is the inverse to Exp(x). Note that if it has multi-values, the Ln(x) only gives a principle value (PV) and other values are PV+2*k*Pi*I (where k=0, 1, 2,..., -1, -2, ...). If x is complex number (x=A+B*I) then Ln(x)=Ln(Abs(x))+I*Atan2(A,B).
See also: exp.
* NInt()
NInt(y, x , xmin , xmax) numerically integrates y.
See also: Int.
eg. 例如: NInt(x^2, x , 0 , 1)
* Not
Not(x) is logic not. It gives True if x=False, or False if x=True.
See also: And, Or.
* NSolve()
NSolve(Cos(x)=x,x,x0) numerically solves the equation with initial x0 and iteration n, using Newston's method. By default n=5, you can increase the n value if you want more close to exact solution. It only gives one root near x0 if equation has multi roots.
NSolve(Cos(x)=x, x) numerically solves equation with default initial x0=1 and n=5.
NSolve(Cos(x)=x, x,x0) numerically solves the equation with initial x0 and n=5.
See also: solve, dsolve.
eg. 例如: NSolve(Sin(x)=0, x,3) gives 3.14.
* Null internal 内部
Null is a symbol used to indicate the absence of an expression or a result. When it appears as an output expression, no output is printed.
* N() internal 内部
N(x) gives the numeric value of x. It converts all numbers to the real number.
See also: numeric.
eg. 例如: N(Pi) gives 3.1416.
* Or internal 内部
The logic operator. The result is True or False.
See also: And.
* ParametricPlot()
plot the parametric functions of x=x(t) and y=y(t) by
ParametricPlot(x(t),y(t),t)
ParametricPlot(x(t),y(t),t,tmin,tmax)
ParametricPlot(x(t),y(t),t,tmin,tmax,ymin,ymax)
See also: Plot,PolarPlot.
eg. 例如: ParametricPlot(Sin(t),Sin(2*t),t)
* Pi
Pi=3.1416..., as the built-in constant, Pi is converted to 3.1416... when the switch numeric:=on.
See also: E.
* Plot()
Plot(y,x) plots a function y=f(x) in xy plane with the default values x from -5 to 5, and y from -5 to 5.
Plot(y,x,xmin,xmax)
Plot(y,x,xmin,xmax,ymin,ymax)
See also: PolarPlot.
eg. 例如: Plot(x^3,x)
* PolarPlot()
PolarPlot(r,t) plots a function r=f(t) in polar coordinates with the default values t from 0 to 2 Pi, and r from 0 to 5.
PolarPlot(r,t,tmin,tmax)
PolarPlot(r,t,tmin,tmax,rmin,rmax)
See also: Plot.
eg. 例如: graph, PolarPlot(1,t)
* Product()
Product(f,x,xmin,xmax) with the default step dx = 1.
Product(f,x,xmin,xmax,dx) evaluates the product of f when x runs from
xmin to xmax with step dx.
See also: Sum.
* PSolve()
PSolve(f(x), x) solves polynomial f(x)=0 for x. The order of polynomial < 3.
See also: Solve, NSolve.
eg. 例如: PSolve(x^2+5*x+6, x) gives [-2,-3].
* Re() internal 内部
Re(x) gives the real part of the complex number x.
See also: Im, Abs, Sign.
eg. 例如: Re(1+2*I) gives 1.
* Sec()
Sec(x) is the secant function of x. The angle x is measured in radians (multiply by degree to convert from degrees). Sec(x)=1/Cos(x).
* Sech()
Sech(x) is the hyperbolic secant function of x. sech(x)=1/cosh(x).
* Taylor()
Taylor(y, x) gives series expansion of y at x=0 to order of 5.
Taylor(y, x, order) gives series expansion of y at x=0 to order.
See also: Sum.
eg. 例如:Taylor(Sin(x),x) gives x - 1/6*x^3 + 1/120*x^5.
* Si()
Si(x) is the sin integral, Si(x) = Int(Sin(x)/x, x).
See also: Ci, Ei, Gamma, Erf.
* Sign() internal 内部
Sign(x) is the sign function of x. Its value is 1, 0 or -1.
/ / 1 1 if re(x) > 0; or both Re(x) = 0 and Im(x) > 0.
Sign(x) = 0 0 if x=0.
\ -1 otherwise. 否则。
the same as the definition by Arg(x):
/ 1 / 1 if -Pi/2 < Arg(x) <= Pi/2.
Sign(x) = 0 0 if x=0.
\ -1 otherwise. 否则。
You can assume x is positive or negative by Sign(x) := True.
eg. 例如: Sign(2) gives 1, Sign(1+I) gives 1.
See also: Abs, Arg, Re, Im.
* Sin()
Sin(x) is the sine function of x. The angle x is measured in radians. (multiply by degree to convert from degrees).
* Sinh()
Sinh(x) is the hyperbolic sine function of x. Sinh(x) = (Exp(x)-Exp(-x))/2.
* Solve() internal 内部
Solve(x^2=0, x) solves a polynomial ordered up to 4.
See also: NSolve.
eg. 例如: Solve(x^2+5*x+6=0, x).
* Sqrt() internal 内部
Sqrt(x) is the square root function of x. It is the same as x^0.5. It only gives the principal value (PV) (Sign(Sqrt(x)) >= 0). root(x,2) gives all branch of square root.
See also: root, ^.
eg. 例如: Sqrt(4) gives 2, N(Sqrt(2*I)) gives 1+I.
* Replace() internal 内部
Replace(y, x,x0) replace x in y with x0.
eg. 例如: Replace(x^6, x,x0) gives x0^6.
* Sum()
Sum(f,x,xmin,xmax)
It evaluates the sum of f when x runs from xmin to xmax with the default step dx=1.
Sum(f,x,xmin,xmax,dx)
It evaluates the sum of f when x runs from xmin to xmax with step dx.
See also: Product.
eg. 例如: Sum(2^n,n,1,5,1.1), Sum(x^n,n,1,5).
* Tan()
Tan(x) is the tangent function of x. The angle x is measured in radians (multiply by degree to convert from degrees).
* Tanh()
Tanh(x) is the hyperbolic tangent function of x.
* True
Logical value.逻辑值。
* Type() internal 内部
Type(x) gives the type of x. Its value is a string. Note that the output of strings in DrMath is without two quotation marks.
eg. 例如:
------------------------------ ------------------------------
x x Type(x)
1 1 Integer 整数
1.1 1.1 Real 实数
2/3 2/3 Rational理数
1+I Complex 复数
f(x) F(X) f()
a 一 symbol 号
a+b + +
a*b * *
a^b ^ ^
a=b = =
a==b ==
a>b > >
a>=b >= > =
a<b < <
a<=b <= <=
a<>b <> <>
a,b A,B , ,
---------------------------------
You also can test x, eg. if x is type of real number, by Type(x)==Real.
* Undefined internal 内部
The built-in constant. It indicates that the value of the expression is undefined, and may be the indeterminate form: 0/0, Infinity/Infinity, 0*Infinity, 0^0. You should try again by lim(y, x=x0).
* While() internal 内部
While(True, body) repeats body while test is true.
See also: For.
eg. 例如:
In: 输入:
x:=1, While(x<5, x:=x+1);
Out:
x := 6
+ add or positive sign. eg. 例如: a+b.
- - subtract or negative sign. eg. 例如: ab, -1.
* * multiply. eg. 例如: a*b.
/ / divide. eg. 例如: a/b.
^ ^ power in BASIC, the same as ** in FORTRAN, eg. 2^3 gives 8.
! ! factorial, eg. 100!
< < less than.
<= less than or equal to.
> greater than.
>= greater than or equal to.
<> <> unequal 不等
== == equal 等于
a==b gives True if a is equal to b, False if a is not equal to b, or left unevaluated otherwise. It can test two complex numbers or expressions. It gives True if a and b are the same expression or left unevaluated otherwise.
eg. 例如: 2==2 gives True, a==a gives True.
= = equation sign
eg. 例如: x^6+1 = 0
:= assignment. 分配。
, , comma 逗号
; ; the end of statement
# comment statement
()()
------------------------------------------------------------------------- -------------------------------------------------- -----------------------
1. 1。 SymbMath document symbmath.doc or symbmath.doc.html. SymbMath文件symbmath.doc或symbmath.doc.html。