Contents Previous Next Index
|
4 Basic Computations
|
|
This chapter discusses key concepts related to performing basic computations with Maple. It discusses important features that are relevant to all Maple users. After learning about these concepts, you will learn how to use Maple to solve problems in specific mathematical disciplines in the following chapter.
|
4.1 In This Chapter
|
|
Section
|
Topics
|
Symbolic and Numeric Computation- An overview of exact and floating-point computation
|
•
|
Floating-Point Computations
|
•
|
Converting Exact Quantities to Floating-Point Values
|
|
Integer Operations - How to perform integer computations
|
•
|
Important Integer Commands
|
•
|
Finite Rings and Fields
|
|
Solving Equations - How to solve standard mathematical equations
|
•
|
Equations and Inequations
|
•
|
Ordinary Differential Equations
|
•
|
Partial Differential Equations
|
•
|
Integer Equations in a Finite Field
|
|
Units, Scientific Constants, and Uncertainty - How to construct and compute with expressions that have units, scientific constants, or uncertainty
|
Units
•
|
Applying Units to an Expression
|
•
|
Performing Computations with Units
|
•
|
Changing the Current System of Units
|
Scientific Constants
•
|
Element and Isotope Properties
|
•
|
Value, Units, and Uncertainty
|
•
|
Performing Computations
|
•
|
Modification and Extensibility
|
Uncertainty Propagation
•
|
Quantities with Uncertainty
|
•
|
Performing Computations with Quantities with Uncertainty
|
|
Restricting the Domain - How to restrict the domain for computations
|
•
|
Assumptions on Variables
|
|
|
|
|
|
4.2 Symbolic and Numeric Computation
|
|
Symbolic computation is the mathematical manipulation of expressions involving symbolic or abstract quantities, such as variables, functions, and operators; and exact numbers, such as integers, rationals, , and The goal of such manipulations may be to transform an expression to a simpler form or to relate the expression to other, better understood formulas.
Numeric computation is the manipulation of expressions in the context of finite-precision arithmetic. Expressions involving exact numbers, for example, are replaced by close approximations using floating-point numbers, for example 1.41421. These computations generally involve some error. Understanding and controlling this error is often of as much importance as the computed result.
In Maple, numeric computation is normally performed if you use floating-point numbers (numbers containing a decimal point) or the evalf command. The plot command (see Plots and Animations) uses numeric computation, while commands such as int, limit, and gcd (see Integer Operations and Mathematical Problem Solving) generally use only symbolic computation to achieve their results.
|
Exact Computations
|
|
In Maple, integers, rational numbers, mathematical constants such as and ∞, and mathematical structures such as matrices with these as entries are treated as exact quantities. Names, such as and mathematical functions, such as and are symbolic objects. Names can be assigned exact quantities as their values, and functions can be evaluated at symbolic or exact arguments.
Important: Unless requested to do otherwise (see the following section), Maple evaluates expressions containing exact quantities to exact results, as you would do if you were performing the calculation by hand, and not to numeric approximations, as you normally obtain from a standard hand-held calculator.
|
|
Floating-Point Computations
|
|
In some situations, a numeric approximation of an exact quantity is required. For example, the plot command requires the expression it is plotting to evaluate to numeric values that can be rendered on the screen: cannot be so rendered, but can be. Maple distinguishes approximate from exact quantities by the presence or absence of a decimal point: is approximate, while is exact.
Note: An alternative representation of floating-point numbers, called e-notation, may not include an explicit decimal point: 1e5 , 3e-2 .
In the presence of a floating-point (approximate) quantity in an expression, Maple generally computes using numeric approximations. Arithmetic involving mixed exact and floating-point quantities results in a floating-point result.
If a mathematical function is passed a floating-point argument, it normally attempts to produce a floating-point approximation of the result.
|
|
Converting Exact Quantities to Floating-Point Values
|
|
To convert an exact quantity to a numeric approximation of that quantity, use the evalf command or the Approximate context panel operation (see Approximating the Value of an Expression).
By default, Maple computes such approximations using 10 digit arithmetic. You can modify this in one of two ways:
•
|
Locally, you can pass the precision as an index to the evalf call.
|
•
|
Globally, you can set the value of the Digits environment variable.
|
•
|
Set the value back to the default Digits level:
|
Note: When appropriate, Maple performs floating-point computations directly using your computer's underlying hardware.
|
|
Sources of Error
|
|
By its nature, floating-point computation normally involves some error. Controlling the effect of this error is the subject of active research in Numerical Analysis. Some sources of error are:
•
|
An exact quantity may not be exactly representable in decimal form: and are examples.
|
•
|
Small errors can accumulate after many arithmetic operations.
|
•
|
Subtraction of nearly equal quantities can result in essentially no useful information. For example, consider the computation for
|
No correct digits remain. If, however, you use Maple to analyze this expression, and replace this form with a representation that is more accurate for small values of a fully accurate 10-digit result can be obtained.
For information on evaluating an expression at a point, see Substituting a Value for a Subexpression. For information on creating a series approximation, see Series. For more information on floating-point numbers, refer to the float and type/float help pages.
|
|
|
4.3 Integer Operations
|
|
In addition to the basic arithmetic operators, Maple has many specialized commands for performing more complicated integer computations, such as factoring an integer, testing whether an integer is a prime number, and determining the greatest common divisor (GCD) of a pair of integers.
Note: Many integer operations are available as task templates (Tools→Tasks→Browse, under Integers).
You can quickly perform many integer operations using the context panel. Clicking on an integer displays the context panel with integer commands. For example, the context-sensitive operation Integer Factors applies the ifactor command to compute the prime factorization of the given integer. See Figure 4.1.
|
Figure 4.1: Context Panel for an Integer
|
|
|
The result of applying Integer Factors is shown:
Maple inserts the command ifactor, using an equation label reference to the integer 946929. For more information on equation labels, see Equation Labels.
For more information on using context-sensitive operations in Worksheet mode, see The Context Panel. For information on using context-sensitive operations in Document mode, see Computing with the Context Panel.
Maple has many other integer commands, including those listed in Table 4.1.
Table 4.1: Select Integer Commands |
|
For information on finding integer solutions to equations, see Integer Equations.
|
Non-Base 10 Numbers and Other Number Systems
|
|
Maple supports:
•
|
Finite ring and field arithmetic
|
|
Non-Base 10 Numbers
|
|
To represent an expression in another base, use the convert command.
For information on enclosing keywords in right single quotes ('), see Delaying Evaluation.
You can also use the convert/base command.
Note: The convert/base command returns a list of digit values in order of increasing significance.
|
|
Finite Rings and Fields
|
|
Maple supports computations over the integers modulo m.
The mod operator evaluates an expression over the integers modulo m.
By default, the mod operator uses positive representation (modp command). Symmetric representation is available using the mods command.
For information on setting symmetric representation as the default, refer to the mod help page.
The modular arithmetic operators are listed in Table 4.2.
Table 4.2: Modular Arithmetic Operators |
Operation
|
Operator
|
Example
|
Addition
|
+
|
|
Subtraction
|
-
|
|
Multiplication (displays in 2-D Math as )
|
|
|
Multiplicative inverse (displays in 2-D Math as a superscript)
|
^(-1)
|
|
Division (displays in 2-D Math as )
|
/
|
|
Exponentiation1
|
&^
|
|
1To enter a caret (^) in 2-D Math, enter a backslash character followed by a caret, that is, \^.
|
|
For information on solving an equation modulo an integer, see Integer Equations in a Finite Field.
The mod operator also supports polynomial and matrix arithmetic over finite rings and fields. For more information, refer to the mod help page.
|
|
Gaussian Integers
|
|
Gaussian integers are complex numbers in which the real and imaginary parts are integers.
The GaussInt package contains commands that perform Gaussian integer operations.
The GIfactor command returns the Gaussian integer factorization.
In Maple, complex numbers are represented as a+b I, where the uppercase I represents the imaginary unit .
You can also enter the imaginary unit using the following two methods.
•
|
In the Common Symbols palette, click the , or item. See Palettes.
|
•
|
Enter i or j, and then press the symbol completion key. See Symbol Names.
|
Note that the output will still be displayed with I, no matter what symbol was used for input. You can customize Maple's settings to use a different symbol for . For more information on entering complex numbers, including how to customize this setting, refer to the HowDoI/EnterAComplexNumber help page.
The GIsqrt command approximates the square root in the Gaussian integers.
For more information on Gaussian integers including a list of GaussInt package commands, refer to the GaussInt help page.
|
|
|
|
4.4 Solving Equations
|
|
You can solve a variety of equation types, including those described in Table 4.3.
Table 4.3: Overview of Solution Methods for Important Equation Types |
Equation Type
|
Solution Method
|
Equations and inequations
|
solve and fsolve commands
|
Ordinary differential equations
|
ODE Analyzer Assistant (and dsolve command)
|
Partial differential equations
|
pdsolve command
|
Integer equations
|
isolve command
|
Integer equations in a finite field
|
msolve command
|
Linear integral equations
|
intsolve command
|
Linear systems
|
LinearAlgebra[LinearSolve] command
|
Recurrence relations
|
rsolve command
|
|
Note: Many solve operations are available in the context panel and as task templates (Tools→Tasks→Browse). Most of this section focuses on other methods.
|
Solving Equations and Inequations
|
|
Using Maple, you can symbolically solve equations and inequations. You can also solve equations numerically.
To solve an equation or set of equations using the context panel:
2.
|
From the context panel, select Solve (or Solve Numerically). See Figure 4.2.
|
|
Figure 4.2: Context Panel for an Equation
|
|
|
In Worksheet mode, Maple inserts a calling sequence that solves the equation followed by the solutions.
If you select Solve, Maple computes exact solutions.
If you select Solve Numerically, Maple computes floating-point solutions.
For information on solving equations and inequations symbolically using the solve command, see the following section. For information on solving equations numerically using the fsolve command, see Numerically Solving Equations.
|
Symbolically Solving Equations and Inequations
|
|
The solve command is a general solver that determines exact symbolic solutions to equations or inequations. The solutions to a single equation or inequation are returned as an expression sequence. For details, see Creating and Using Data Structures. If Maple does not find any solutions, the solve command returns the empty expression sequence.
In general, solve computes solutions in the field of complex numbers. To restrict the problem to only real solutions, see Restricting the Domain.
It is recommended that you verify the solutions returned by the solve command. For details, see Working with Solutions.
To return the solutions as a list, enclose the calling sequence in brackets ([ ]).
Expressions: You can specify expressions instead of equations. The solve command automatically equates them to zero.
(In this case, the solution involves the LambertW function.)
Multiple Equations: To solve multiple equations or inequations, specify them as a list or set. For an introduction to both lists and sets, see Creating and Using Data Structures.
Solving for Specific Unknowns: By default, the solve command returns solutions for all unknowns. You can specify the unknowns for which to solve.
To solve for multiple unknowns, specify them as a list.
Transcendental Equations: In general, the solve command returns one solution to transcendental equations.
To produce all solutions, use the allsolutions option.
Maple uses variables of the form _ZN~, where N is a positive integer, to represent arbitrary integers. The tilde (~) indicates that it is a quantity with an assumption. For information about names with assumptions, see Assumptions on Variables.
RootOf Structure: The solve command may return solutions, for example, to higher order polynomial equations, in an implicit form using RootOf structures.
These RootOf structures are placeholders for the roots of the equation The index parameter numbers and orders the four solutions.
Like any symbolic expression, you can convert RootOf structures to a floating-point value using the evalf command.
Some equations are difficult to solve symbolically. For example, polynomial equations of order five and greater do not in general have a solution in terms of radicals. If the solve command does not find any solutions, it is recommended that you use the Maple numerical solver, fsolve. For information, see the following section, Numerically Solving Equations.
For more information on the solve command, including how to solve equations defined as procedures and how to find parametric solutions, refer to the solve/details help page.
For information on verifying and using solutions returned by the solve command, see Working with Solutions.
|
|
Numerically Solving Equations
|
|
The fsolve command solves equations numerically. The behavior of the fsolve command is similar to that of the solve command.
Note: You can also numerically solve equations using the context panel. See Solving Equations and Inequations.
It is recommended that you verify the solutions returned by the fsolve command. For details, see Working with Solutions.
Multiple Equations: To solve multiple equations, specify them as a set. For more information, see Creating and Using Data Structures. The fsolve command solves for all unknowns.
Univariate Polynomial Equations: In general, the fsolve command finds one real solution. However, for a univariate polynomial equation, the fsolve command returns all real roots.
Controlling the Number of Solutions: To limit the number of roots returned, specify the maxsols option.
To find additional solutions to a general equation, use the avoid option to ignore known solutions.
Complex Solutions: To search for a complex solution or find all complex and real roots for a univariate polynomial, specify the complex option for the fsolve command.
If the fsolve command does not find any solutions, it is recommended that you specify a range in which to search for solutions, or specify an initial value.
Range: To search for a solution in a range, specify the range in the calling sequence. The range can be real or complex.
The syntax for specifying a region in the complex plane is lower-left point..upper-right point.
Initial Values: You can specify a value for each unknown. The fsolve command uses these as initial values for the unknowns in the numerical method.
For more information and examples, refer to the fsolve/details help page.
For information on verifying and using solutions returned by the fsolve command, see the following section, Working with Solutions.
|
|
Working with Solutions
|
|
Verifying: It is recommended that you always verify solutions (that the solve and fsolve commands return) using the eval command.
For more information, see Substituting a Value for a Subexpression.
Assigning the Value of a Solution to a Variable: To assign the value of a solution to the corresponding variable as an expression, you can use the assign command, which can turn an equation such as the numeric solution in (4.9), , into an assignment.
A word of caution, if you do this, now has a value so you cannot afterwards treat it as an unknown unless you unassign it. The way to do that is
For more information on unassigning names, see Unassigning Names.
Creating a Function from a Solution: The assign command assigns a value as an expression to a name. It does not define a function. To convert a solution to a function, use the unapply command.
Consider one of the solutions for q to the equation .
Here, solutions[1] selects the first element of the list of solutions. For more information on selecting elements, see Accessing Elements.
You can evaluate this function at symbolic or numeric values.
For more information on defining and using functions, see Functional Operators.
|
|
|
Other Specialized Solvers
|
|
In addition to equations and inequations, Maple can solve other equations including:
•
|
Ordinary differential equations (ODEs)
|
•
|
Partial differential equations (PDEs)
|
•
|
Integer equations in a finite field
|
|
Ordinary Differential Equations (ODEs)
|
|
Maple can solve ODEs and ODE systems, including initial value and boundary value problems, symbolically and numerically.
ODE Analyzer Assistant The ODE Analyzer Assistant is a point-and-click interface to the Maple ODE solving routines.
To open the ODE Analyzer:
•
|
From the Tools menu, select Tutors, Differential Equations, and then ODE Analyzer.
|
Maple inserts the dsolve[interactive]() calling sequence in the document. The ODE Analyzer Assistant (Figure 4.3) is displayed.
|
Figure 4.3: ODE Analyzer Assistant
|
|
|
In the main ODE Analyzer Assistant window, you can define ODEs, initial or boundary value conditions, and parameters. To define derivatives, use the diff command. For example, diff(x(t), t) corresponds to and diff(x(t), t, t) corresponds to For more information on the diff command, see The diff Command.
After defining an ODE, you can solve it numerically or symbolically.
To solve a system numerically using the ODE Analyzer Assistant:
1.
|
Ensure that the conditions guarantee uniqueness of the solution.
|
2.
|
Ensure that all parameters have fixed values.
|
3.
|
Click the Solve Numerically button.
|
4.
|
In the Solve Numerically window (Figure 4.4), you can specify the numeric method and relevant parameters and error tolerances to use for solving the problem.
|
5.
|
To compute solution values at a point, click the Solve button.
|
|
Figure 4.4: ODE Analyzer Assistant: Solve Numerically Dialog
|
|
|
To solve a system symbolically using the ODE Analyzer Assistant:
1.
|
Click the Solve Symbolically button.
|
2.
|
In the Solve Symbolically window (Figure 4.5), you can specify the method and relevant method-specific options to use for solving the problem.
|
3.
|
To compute the solution, click the Solve button.
|
|
Figure 4.5: ODE Analyzer Assistant: Solve Symbolically Dialog
|
|
|
When solving numerically or symbolically, you can view a plot of the solution by clicking the Plot button.
•
|
To plot the solution to a symbolic problem, all conditions and parameters must be set.
|
•
|
To customize the plot, click the Plot Options button to open the Plot Options window.
|
To view the corresponding Maple commands as you solve the problem or plot the solution, select the Show Maple commands check box.
You can control the return value of the ODE Analyzer using the On Quit, Return drop-down list. You can select to return nothing, the displayed plot, the computed numeric procedure (for numeric solutions), the solution (for symbolic solutions), or the Maple commands needed to produce the solution values and the displayed plot.
For more information, refer to the ODEAnalyzer help page.
The dsolve Command
The ODE Analyzer provides a point-and-click interface to the Maple dsolve command.
For ODEs or systems of ODEs, the dsolve command can find:
In addition, the dsolve command can find:
•
|
Formal power series solutions to linear ODEs with polynomial coefficients
|
•
|
Formal solutions to linear ODEs with polynomial coefficients
|
To access all available functionality, use the dsolve command directly. For more information, refer to the dsolve help page.
|
|
Partial Differential Equations (PDEs)
|
|
To solve a PDE or PDE system symbolically or numerically, use the pdsolve command. PDE systems can contain ODEs, algebraic equations, and inequations.
For example, solve the following PDE symbolically. For help entering a partial derivative, see Example 1 - Enter a Partial Derivative.
The solution is an arbitrary univariate function applied to .
Maple generally prints only the return value, errors, and warnings during a computation. To print information about the techniques Maple uses, increase the infolevel setting for the command.
To return all information, set infolevel to 5.
Checking arguments ...
First set of solution methods (general or quasi general solution)
-> trying characteristic strip method for first order PDEs
<- characteristic strip method for first order PDEs successful
<- First set of solution methods successful
<- Returning a *general* solution
For more information on solving PDEs, including numeric solutions and solving PDE systems, refer to the pdsolve help page.
|
|
Integer Equations
|
|
To find only integer solutions to an equation, use the isolve command. The isolve command finds solutions for all variables.
|
|
Integer Equations in a Finite Field
|
|
To solve an equation modulo an integer, use the msolve command. The msolve command finds solutions for all variables.
|
|
Solving Linear Systems
|
|
To solve a linear system, use the LinearAlgebra[LinearSolve] command. The LinearSolve command returns the vector x that satisfies A . x = B.
For example, construct an augmented matrix using the Matrix palette (see Creating Matrices and Vectors) in which the first four columns contain the entries of A and the final column contains the entries of B.
For more information on using Maple to solve linear algebra problems, see Linear Algebra.
|
|
Solving Recurrence Relations
|
|
To solve a recurrence relation, use the rsolve command. The rsolve command finds the general term of the function.
|
|
|
|
4.5 Units, Scientific Constants, and Uncertainty
|
|
In addition to manipulating exact symbolic and numeric quantities, Maple can perform computations with units and uncertainties.
Maple supports hundreds of units, for example, miles, coulombs, and bars, and provides facilities for adding custom units.
Maple has a library of hundreds of scientific constants with units, including element and isotope properties.
To support computations with uncertainties, Maple propagates errors through computations.
|
Units
|
|
The Units package in Maple provides a library of units, and facilities for using units in computations. It is fully extensible so that you can add units and unit systems as required.
Note: Some unit operations are available as task templates (see Tools→Tasks→Browse) and through the context panel.
|
Overview of Units
|
|
A dimension is a measurable quantity, for example, length or force. The set of dimensions that are fundamental and independent are known as base dimensions.
In Maple, the base dimensions include length, mass, time, electric current, thermodynamic temperature, amount of substance, luminous intensity, information, and currency. For a complete list, enter and execute Units[GetDimensions]().
Complex dimensions (or composite dimensions) measure other quantities in terms of a combination of base dimensions. For example, the complex dimension force is a measurement of
Each dimension, base or complex, has associated units. (Base units measure a base dimension. Complex units measure a complex dimension.) Maple supports over 40 units of length, including feet, miles, meters, angstroms, microns, and astronomical units. A length must be measured in terms of a unit, for example, a length of 2 parsecs.
Table 4.4 lists some dimensions, their corresponding base dimensions, and example units.
Table 4.4: Sample Dimensions |
Dimension
|
Base Dimensions
|
Example Units
|
Time
|
time
|
second, minute, hour, day, week, month, year, millennium, blink, lune
|
Energy
|
|
joule, electron volt, erg, watt hour, calorie, Calorie, British thermal unit
|
Electric potential
|
|
volt, abvolt, statvolt
|
|
For the complete list of units (and their contexts and symbols) available for a dimension, refer to the corresponding help page, for example, the Units/length help page for the units of length.
Each unit has a context. The context differentiates between different definitions of the unit. For example, the standard and US survey miles are different units of length, and the second is a unit of time and of angle. You can specify the context for a unit by appending the context as an index to the unit, for example, mile[US_survey]. If you do not specify a context, Maple uses the default context.
Units are collected into systems, for example, the foot-pound-second (FPS) system and international system, or système international, (SI). Each system has a default set of units used for measurements. In the FPS system, the foot, pound, and second are used to measure the dimensions of length, mass, and time. The unit of speed is the foot/second. In SI, the meter, kilogram, and second are used to measure the dimensions of length, mass, and time. The units of speed, magnetic flux, and power are the meter/second, weber, and watt, respectively.
|
|
Unit Conversions
|
|
To convert a value measured in a unit to the corresponding value in a different unit, use the Units Converter.
•
|
From the Tools→Assistants menu, select Units Converter.
|
The Units Converter application (Figure 4.6) opens.
|
Figure 4.6: Units Converter Assistant
|
|
|
To perform a conversion:
1.
|
In the Convert text field, enter the numeric value to convert.
|
2.
|
In the Dimension drop-down list, select the dimensions of the unit.
|
3.
|
In the From and To drop-down lists, select the original unit and the unit to which to convert.
|
4.
|
Click Perform Unit Conversion.
|
The same conversion can be done with the convert/units command.
Using the Units Converter, you can convert temperatures and temperature changes.
•
|
To perform a temperature conversion, in the Dimension drop-down list, select temperature(absolute).
|
•
|
To perform a temperature change conversion, in the Dimension drop-down list, select temperature(relative).
|
To convert temperature changes, the Units Converter uses the convert/units command. For example, an increase of 32 degrees Fahrenheit corresponds to an increase of almost 18 degrees Celsius.
To convert absolute temperatures, the Unit Converter uses the convert/temperature command. For example, 32 degrees Fahrenheit corresponds to 0 degrees Celsius.
|
|
Applying Units to an Expression
|
|
To insert a unit, use the Units palette . See Figure 4.7.
|
Figure 4.7: Units Palette
|
|
|
|
|
|
To insert a unit:
•
|
In the Units palette, select a unit dimension, then click the desired unit symbol.
|
To insert a unit that is unavailable in the palettes:
1.
|
In the Units palette, click the unit symbol
. Maple inserts a Unit object with the placeholder selected.
|
2.
|
In the placeholder, enter the unit name (or symbol). Note that you see double brackets around the unit when you are editing it.
|
For example, to enter standard (the default context) miles, you can specify the unit name, mile, or symbol, mi. As you edit, the unit is enclosed in double brackets:
The context of a unit is displayed only if it is not the default context.
Alternative ways to enter units:
•
|
Enter Unit, and then press the symbol completion key (see Symbol Names) and then enter the unit.
|
•
|
Use the shortcut key Ctrl + Shift + U (Command + Shift + U, on Mac) and then enter the unit.
|
•
|
Use the Unit command. Note that to write a quantity with a unit using this command, write multiplication between them; this is especially evident in 1-D math:
|
Important: In 1-D Math input, the quantity and unit (entered using the top-level Unit command) are a product, not a single entity. The following calling sequences define different expressions.
Some units support prefixes. For example, SI units support prefixes to names and symbols. You can specify 1000 meters using kilometer or km.
|
|
Performing Computations with Units
|
|
In the default Maple environment, you cannot perform computations with quantities that have units. You can perform only unit conversions. For more information about the default environment, refer to the Units/Default help page.
To compute with expressions that have units, you must load a Units environment: Simple, Standard, or Natural. It is recommended that you use the Simple environment, and that environment is loaded by default when you load the Units package:
Automatically loading the Units[Simple] subpackage
| |
In the Simple Units environment, commands that support expressions with units return results with the correct units.
For information on differentiation and integration, see Calculus.
|
|
Changing the Current System of Units
|
|
If a computation includes multiple units, all units are expressed using units from the current system of units.
By default, Maple uses the SI system of units, in which length is measured in meters and time is measured in seconds.
To view the name of the default system of units, use the Units[UsingSystem] command or view the current selection for Choose System, under the Convert Output Units section of the context panel.
Automatically loading the Units[Simple] subpackage
| |
To change the system of units, use the Units[UseSystem] command or click the output and then select the desired system of units in the Choose System list, under the Convert Output Units section of the context panel.
|
|
|
Scientific Constants and Element Properties
|
|
Computations often require not only units (see Units), but also the values of scientific constants, including properties of elements and their isotopes. Maple supports computations with scientific constants. You can use the built-in constants and add custom constants.
|
Overview of Scientific Constants and Element Properties
|
|
The ScientificConstants package provides the values of constant physical quantities, for example, the velocity of light and the atomic weight of sodium. The ScientificConstants package also provides the units for the constant values, allowing for greater understanding of the equation as well as unit-matching for error checking of the solution.
The quantities available in the ScientificConstants package are divided into two distinct categories.
•
|
Chemical element (and isotope) properties
|
|
|
Scientific Constants
|
|
|
List of Scientific Constants
|
|
You have access to scientific constants important in engineering, physics, chemistry, and other fields. Table 4.5 lists some of the supported constants. For a complete list of scientific constants, refer to the ScientificConstants/PhysicalConstants help page.
Table 4.5: Scientific Constants |
Name
|
Symbol
|
Newtonian_constant_of_gravitation
|
G
|
Planck_constant
|
h
|
elementary_charge
|
e
|
Bohr_radius
|
a[0]
|
deuteron_magnetic_moment
|
mu[d]
|
Avogadro_constant
|
N[A]
|
Faraday_constant
|
F
|
|
You can specify a constant using either its name or symbol.
|
|
Accessing Constant Definition
|
|
The GetConstant command in the ScientificConstants package returns the complete definition of a constant.
To view the definition of the Newtonian gravitational constant, specify the symbol G (or its name) in a call to the GetConstant command.
For information on accessing a constant's value, units, or uncertainty, see Value, Units, and Uncertainty.
|
|
|
Element Properties
|
|
Maple also contains element properties and isotope properties.
|
Elements
|
|
Maple supports all 117 elements of the periodic table. Each element has a unique name, atomic number, and chemical symbol. You can specify an element using any of these labels. For a complete list of supported elements, refer to the ScientificConstants/elements help page.
Maple supports key element properties, including atomic weight (atomicweight), electron affinity (electronaffinity), and density. For a complete list of element properties, refer to the ScientificConstants/properties help page.
|
|
Isotopes
|
|
Isotopes, variant forms of an element that contain the same number of protons but a different number of neutrons, exist for many elements.
To see the list of supported isotopes for an element, use the GetIsotopes command.
Maple supports isotopes and has a distinct set of properties for isotopes, including abundance, binding energy (bindingenergy), and mass excess (massexcess). For a complete list of isotope properties, refer to the ScientificConstants/properties help page.
|
|
Accessing an Element or Isotope Property Definition
|
|
The GetElement command in the ScientificConstants package returns the complete definition of an element or isotope.
|
|
|
Value, Units, and Uncertainty
|
|
To use constants or element properties, you must first construct a ScientificConstants object.
To construct a scientific constant, use the Constant command.
To construct an element (or isotope) property, use the Element command.
|
Value
|
|
To obtain the value of a ScientificConstants object, use the evalf command.
Note: The value returned depends on the current system of units.
|
|
Units
|
|
To obtain the units for a ScientificConstants object, use the GetUnit command.
For information on changing the default system of units, for example, from SI to foot-pound-second, see Changing the Current System of Units.
|
|
Value and Units
|
|
If you are performing computations with units, you can access the value and units for a ScientificConstants object by specifying the units option when constructing the object, and then evaluating the object.
|
|
Uncertainty
|
|
The value of a constant is often determined by direct measurement or derived from measured values. Hence, it has an associated uncertainty. To obtain the uncertainty in the value of a ScientificConstants object, use the GetError command.
|
|
|
Performing Computations
|
|
You can use constant values in any computation. To use constant values with units, use a Units environment as described in Performing Computations with Units. For information on computing with quantities that have an uncertainty, see the following section.
|
|
|
Uncertainty Propagation
|
|
Some computations involve uncertainties (or errors). Using the ScientificErrorAnalysis package, you can propagate the uncertainty in these values through the computation to indicate the possible error in the final result.
The ScientificErrorAnalysis package does not perform interval arithmetic. That is, the error of an object does not represent an interval in which possible values must be contained. (To perform interval arithmetic, use the Tolerances package..) The quantities represent unknown values with a central tendency. For more information on central tendency, refer to any text on error analysis for the physical sciences or engineering.
|
Quantities with Uncertainty
|
|
Creating: To construct quantities with uncertainty, use the Quantity command. You must specify the value and uncertainty. The uncertainty can be defined absolutely, relatively, or in units of the last digit. For more information on uncertainty specification, refer to the ScientificErrorAnalysis[Quantity] help page.
The output displays the value and uncertainty of the quantity.
To specify the error in units of the last digit, the value must be of floating-point type.
To access the value and uncertainty of a quantity with uncertainty, use the evalf and ScientificErrorAnalysis[GetError] commands.
Rounding: To round the error of a quantity with uncertainty, use the ApplyRule command. For a description of the predefined rounding rules, refer to the ScientificErrorAnalysis/rules help page.
Units: Quantities with errors can have units. For example, the scientific constants and element (and isotope) properties in the ScientificConstants packages are quantities with errors and units.
To construct a new quantity with units and an uncertainty, include units in the Quantity calling sequence.
For an absolute error, you must specify the units in both the value and error.
For a relative error, you can specify the units in only the value.
For information on the correlation between, variance of, and covariance between quantities with uncertainty, refer to the ScientificErrorAnalysis help page.
|
|
Performing Computations with Quantities with Uncertainty
|
|
Many Maple commands support quantities with uncertainty.
Compute the value of the derivative of at
To convert the solution to a single quantity with uncertainty, use the combine/errors command.
The value of the result is:
The uncertainty of the result is:
|
|
Additional Information
|
|
For information on topics including:
•
|
Creating new rounding rules,
|
•
|
Setting the default rounding rule, and
|
•
|
Creating a new interface to quantities with uncertainty,
|
refer to the ScientificErrorAnalysis help page.
|
|
|
|
4.6 Restricting the Domain
|
|
By default, Maple computes in the complex number system. Most computations are performed without any restrictions or assumptions on the variables. Maple often returns results that are extraneous or unsimplified when computing in the field of complex numbers. Using restrictions, you can more easily and efficiently perform computations in a smaller domain.
Maple has facilities for performing computations in the real number system and for applying assumptions to variables.
|
Real Number Domain
|
|
To force Maple to perform computations in the field of real numbers, use the RealDomain package.
The RealDomain package contains a small subset of Maple commands related to basic precalculus and calculus mathematics, for example, arccos, limit, and log, and the symbolic manipulation of expressions and formulae, for example, expand, eval, and solve. For a complete list of commands, refer to the RealDomain help page.
After you load the RealDomain package, Maple assumes that all variables are real. Commands return simplified results appropriate to the field of real numbers.
Table 4.6: Restricting to Real Numbers |
Without Loading RealDomain
|
After Loading RealDomain
|
In Maple's default environment, without loading RealDomain, the answers are correct for the entire complex field.
|
After loading RealDomain, the answers are simplified.
|
|
Complex return values are excluded or replaced by undefined.
|
|
After loading the RealDomain package, you can also use the context-sensitive items for simplify and solve to perform computations in the field of real numbers. For example, using the context panel item Simplify > Simplify,
|
|
Assumptions on Variables
|
|
To simplify problem solving, it is recommended that you always apply any known assumptions to variables. You can impose assumptions using the assume command. To apply assumptions for a single computation, use the assuming command.
Note: The assume and assuming commands are not supported by the RealDomain package.
|
The assume Command
|
|
You can use the assume command to set variable properties, for example, x::real, and relationships between variables, for example, x < 0 or x < y. For information on valid properties, refer to the assume help page. For information on the double colon (::) operator, refer to the type help page.
The assume command allows improved simplification of symbolic expressions, especially multiple-valued functions, for example, computing the square root.
To assume that x is a positive real number, use the following calling sequence. Then compute the square root of .
The trailing tilde (~) on the name x indicates that it carries assumptions.
When you use the assume command to place another assumption on x, all previous assumptions are removed.
Displaying Assumptions: To view the assumptions on an expression, use the about command.
Originally x, renamed x~:
is assumed to be: RealRange(-infinity,Open(0))
Imposing Multiple Assumptions: To simultaneously impose multiple conditions on an expression, specify multiple arguments in the assume calling sequence.
To specify additional assumptions without replacing previous assumptions, use the additionally command. The syntax of the additionally calling sequence is the same as that of the assume command.
Originally x, renamed x~:
is assumed to be: 1
The only integer in the open interval (0, 2) is 1.
Testing Properties: To test whether an expression always satisfies a condition, use the is command.
The following test returns false because there are values of x and y (x = 0, y = 10) that satisfy the assumptions, but do not satisfy the relation in the is calling sequence.
To test whether an expression can satisfy a condition, use the coulditbe command.
Removing Assumptions: To remove all assumptions on a variable, unassign its name.
For more information, see Unassigning Names.
For more information on the assume command, refer to the assume help page.
|
|
The assuming Command
|
|
To perform a single evaluation under assumptions on the names in an expression, use the assuming command.
The syntax of the assuming command is <expression> assuming <property or relation>. Properties and relations are introduced in The assume Command.
The frac command returns the fractional part of an expression.
Using the assuming command is equivalent to imposing assumptions with the assume command, evaluating the expression, and then removing the assumptions.
x:
nothing known about this object
If you do not specify the names to which to apply a property, it is applied to all names.
Assumptions placed on names using the assume command are ignored by the assuming command, unless you include the additionally option.
The assuming command does not affect variables inside procedures. (For information on procedures, see Procedures.) You must use the assume command.
>
|
f := proc(x) sqrt(a^2) + x end proc;
|
For more information on the assuming command, refer to the assuming help page.
|
|
|
|
Contents Previous Next Index
|