Download a4.mws - [Server 1]

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

History of the function concept wikipedia , lookup

Addition wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Arithmetic wikipedia , lookup

System of polynomial equations wikipedia , lookup

Partial differential equation wikipedia , lookup

Elementary mathematics wikipedia , lookup

Transcript
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
1. Computer Algebra System. What is computer algebra system (symbolic computing)?
Computer Algebra System is a computation with symbols representing mathematical
objects, including integers, real & complex, polynomials, derivatives & integrals, system
of equations & series expansion of functions. The objective is to obtain closed form,exact
solution. It has thousands of built in functions and has many options for simplifying
expressions.
2. What are the differences between symbolic computing and numerical computing?
Numerical computing has a Floating-point representations which leads to representation
or truncation error, try to represent irrational numbers, propagation errors which
accumulated errors arising from a sequence of calculation. While symbolic computing
use Internal representation for rational numbers which different from floating point
representation. For rational numbers, number of significant digits & maximum size
number far exceeds typical floating-point representation in numerical computation.
3. What are the advantages of symbolic computing compared to the numerical
computing?
In Numerical computation, Word length problem-the allowable value for exponent
depend on computer, computing language or calculator.
In Symbolic computing. we can obtain closed form and exact solution, it has thousands of
built in functions and has many options for simplifying expressions.
4. Hierarchy of arithmetic operations: Use your own examples (at least three examples
and execute them in maple) to prove which arithmetic operations are carried out first in
Maple and if they are of equal priority, in which directions they are carried?
> f1:=3+4-56+73-12+88;
f1 := 100
If all numbers undergo operation which is allequal priority (addition and substracion) it
will start from left to right.
> f2:=5+6*2-1+4-6;
f2 := 14
If the numbers undergo operation which is different priority (addition and substraction) or
(multiply and divide) it will start with multiply or division, followed by addition or
substraction. The operation will start from left to right.
> f3:=35+56-(6*2)+72+3-(-4-5);
f3 := 163
If the mathematics operation have the operation in brackets( ), it will solve the equations
in brackets first and followed with other operation from left to right.
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
5. Using your own examples (one example each and execute them in maple) clearly bring
out all the differences between the following maple symbols and commands:
a) ; and :
b) = and :=
c) ? and ???
d) expression and function
e) sum and add
a) If we use the semi colon ( ; ) the result will be display:
> f1:=2+5-8+72;
f1 := 71
If we use colon ( : ) the result will not be display:
> f1:=2+5-8+72:
b) If we use (=) the result will not be computed
> c=5*a+4;
>
> a=3;
c5a4
a3
c) If we use (:=) the result will be computed
> c:=5*a+4;
c := 5a4
> a:=3;
a :=3
> c;
19
c) If we use (?) the symbol for the topic to open with the example section expanded.
If we use (???) the symbol for the topic to open with the example section (if any)
expanded and all other section contracted.
d) Expression and Function
Expression
- The symbol for expression is ( := )
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
- The value of the expression can be evaluatednby assigning the value of 'x' in the first
place.
- Expression are assigned to a function so that the expression can be used again in
subsequent calculation.
> restart;#a#
> g:=x^2+4*6;
g := x224
> x:=3;
x :=3
> g;
33
Function
- The symbol of function is := ->
- The value of function can be evaluated by applying a value to that particular function.
> g:=x->x+4*6;
g :=xx24
> g:=x->(2);
g :=2
> g;
2
d) Sum and add
Sum
-Function can be executed when it is given a specified value and when assigning a
variable.
Add
-a value must be specified in order to calculate the function
> add (5*x-20,x=2);
-10
> restart;
> add(3*x-5,x=0..n);
Error, unable to execute add
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
> sum(3*x-5,x=0..n);
6/27/2017
3:00:21
Section2(BBT)
3 ( n1)2 13n 13
 
2
2
2
6. Use of Help facilities in Maple: Use the help commands in Maple and explain the use
of three Maple commands (not discussed in the class) with your own example.
a) Ordinary Differential Equations
The dsolve command is the principle tool in Maple for solving ordinary differential
equations. The D operator and the different comand are also used. Maple also
understands many specialized mathematical functions, such as the Dirac delta function
illustrated in the second example. Maple can also solve system of ODEs, as shown in the
third example.
Solving a Second-order Differential Equation
The diff command computes the partial derivative of an expression with respect to given
variable. By contrast, the D operator computes derivatives of functions.
Consider a second-order ODE,
> restart;
> with (DEtools):
> diff_eql:=D(D(y))(x)+5*D(y)(x)+6*y(x)=0;
(2)
diff_eql:= (D )(y)(x)5 D(y)(x)6 y(x)0
The D operator in the previous expression finds the derivative of the function.
Define the initial condition to be y(0)=0 and
> init_con:=y(0)=0,D(y)(0)=1;
init_con:=y(0)0, D(y)(0)1
Use the dsolve command to solve the equation.
> dsolve( {diff_eql, init_con} , {y(x)});
(3x )
(2x )
y(x)e e
b)Determinant and inverses matrics.
> restart;
> with (LinearAlgebra);
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
Define a new three-by-three Matrix, and call it
>
> A:= Matrix( 3, 3, [[1/2, -1/3, 2], [-5, 14/3, 9], [0,11, 5/6]]);
-1
 1
2 

 2

3




14



A :=  -5
9 
3





-5 
 0
11

6 

Using the Determinant command, you can easily compute the determinant
> Determinant(A);
-2881
18
Since the determinant is non-zero, you can enter the MatrixInverse
> MatrixInverse(A);
 1852

 2881

 75


 2881


 990

 2881

-391 222 

2881 2881
15
261 

5762 2881

99
-12 
2881 2881
Define a second Matrix,
> B:= Matrix(3, 3, [[phi, 0, 0], [0, 3, 2], [-1, 2/3,
theta]]);
0 0
 


 0
3 2 

B := 



 -1 2  


3


You can multiply Matrices and define the result as a third Matrix, C.
> c:=A.B;
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
1
2
 2
 2 

 2

3
3




28



c := 5 9 20
9  
3




 5
292
5  

22 
 6
9
6

Again, compute the determinant
> Determinant(B);
4
  3  
3

c)Floating-point Arithmetic
A principle strength of Maple is its ability to do exact arithmetic. Fractions and radicals
during computation are not converted to their decimal equivalent, thereby avoiding
around-off errors. When you do need to use decimal equivalents, Maple has a command
that approximates the value of the expression in the floating-point form.
> restart;
> (2^30/3^20)*sqrt(3.0);
0.5333783739
Use the evalf command to generate an approximation in the form of a floating-point
value.
> evalf(%);
0.5333783739
Alternatively, you can begin a computation with floating-point values, in which case
Maple will automatically use floating-point arithmatic to compute the result. For
example, we enter the previous expression using the floating-point value 3.0 in the square
root:
> (2^30/3^20)*sqrt(3.0);
0.5333783739
7. Use of units and Scientific Constant: Select any three problems involving different
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
types of units from your textbook and carry out the complete calculations includig the
unit using Maple. State the problem fully and comment whether Maple gives the correct
final answer along with appropriate units. (Refer the exaples discussed in the class)
a) What is the energy of an electon?
> restart;
> with(Units):with(Units[Natural]);
Warning, the name Unit has been rebound
Warning, the assigned name polar now has a global binding
Warning, these protected names have been redefined and unprotected: *,
+, -, /, <, <=, <>, =, Im, Re, ^, abs, add, arccos, arccosh, arccot,
arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan,
arctanh, argument, ceil, collect, combine, conjugate, convert, cos,
cosh, cot, coth, csc, csch, csgn, diff, eval, evalc, evalr, exp,
expand, factor, floor, frac, int, ln, log, log10, max, min, mul,
normal, root, round, sec, sech, seq, shake, signum, simplify, sin,
sinh, sqrt, surd, tan, tanh, trunc, type, verify
[ *, +, -, /, <, <=, <>, =, , , Unit, ^, abs, add, arccosarccosharccotarccotharccscarccscharcsec
,
,
,
,
,
,
,
arcsecharcsin
,
, arcsinh, arctanarctanhargumentceil
,
,
, , collectcombineconjugateconvertcos
,
,
,
, ,
cosh, cot, coth, csc, csch, csgn, diff, evalevalcevalrexp
,
,
, , expandfactorfloorfrac
,
,
,
, int, ln, log,
log10, max, min, mul, normalpolar
,
, root, round, sec, sech, seq, shakesignum
,
, simplifysin
, , sinh,
sqrt, surd, tan, tanh, trunc, type, verify]
>
> mass:=9.11e-31*kg;
mass:= 0.91110-30[kg]
> c:=3.0e8*m/s;
m
c := 0.30109  
s
> E:=mass*c^2;
E := 0.819900
10-13[J]
b)How many grams of KCIO3 were decomposed?
> restart;
> with (ScientificConstants):
> GetElement(K,atomicweight); GetElement(C,atomicweight);
GetElement(I,atomicweight); GetElement(O,atomicweight);
19, atomicweight
[value39.0983
, uncertainty
0.0001
, unitsu]
6, atomicweight
[value12.0107
, uncertainty
0.0008
, unitsu]
53, atomicweight
[value126.90447
, uncertainty
0.00003
, unitsu]
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
8, atomicweight
[value15.9994
, uncertainty
0.0003
, unitsu]
> (39.0983+12.0107+126.90447+(3*15.9994))*g;
226.01167
g
c) Convert 0.386 atm to torr
> restart;
> (0.386*atm)*760*torr/1*atm;
293.360atm2 torr
8. Find out the dimensions of three different physical properties using Maple.
> restart;with(Units);
[ AddBaseUnit
, AddDimension
, AddSystem
, AddUnitConverter
,
, GetDimension
, GetDimensions
,
GetSystem
, GetSystems
, GetUnitGetUnitsHasDimension
,
,
, HasSystemHasUnitNatural
,
,
,
RemoveDimension
, RemoveSystem
, StandardUnit
,
, UseContexts
, UseSystem
, UsingContexts
,
UsingSystem
]
> GetDimensions():
> GetDimension(area);
length2
> GetDimension(magnetic_polarizability);
2
length2 time2 electric_current
mass
> GetDimension(magnetic_flux);
masslength2
time2 electric_current
9. Calculate the volume occupied by 1kg of mercury at 25 C.
> restart;
> with(ScientificConstants);
[ AddConstant
, AddElement
, AddProperty
, ConstantElementGetConstant
,
,
, GetConstants
, GetElement
,
GetElements
, GetErrorGetIsotopes
,
, GetProperties
, GetProperty
, GetUnitGetValue
,
, HasConstant
,
HasElement
, HasProperty
, ModifyConstant
, ModifyElement
]
> GetElement(Hg, density);
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
g
80, density value13.5336
, uncertainty
undefined
, units 3 

cm 

> mass:=1000*g;T=25*degC;
mass:=1000g
T25degC
> density:=13.5336*g/cm^3;
density:=
13.5336g
cm3
> volume:=mass/density;
volume:= 73.89016965
cm3
10. Use Maple to calculate the number of water molecules in 1g of liquid water.
> mass:=1*g;
mass:=g
> GetElement(H,atomicweight);
1, atomicweight
[value1.00794
, uncertainty
0.00007
, unitsu]
> GetElement(O,atomicweight);
8, atomicweight
[value15.9994
, uncertainty
0.0003
, unitsu]
> mH2O:=(2*1.00794+15.9994)*g;
mH2O:=18.01528
g
> mol:=mass/18.01528;
mol:=0.05550843506
g
>
> GetConstant(Avogadro_constant);
1
Avogadro_constant
, symbol
NA, value0.602214199
1024, uncertainty
0.471017, units
mol
> N[A]:=0.602214199e24;
NA := 0.602214199
1024
> %?[A] := .602214199e24;
> molecule:=mol*N[A];
molecule:= 0.3342796776
1023g
11. Determine whether ((y+8/x-2)=x+6,y) is linear or not? (hint:solve for y, and
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
comment)
> restart;
> solve((y+8/x-2)=x+6,y);
88 xx2
x
Thus this equation is not linear equation as it highest power is 2 (Quadratic equations).
12. Show that z=1, y=2, x=3 are the solutions for x+2y-3z=4. (Hint: use subs)
> restart;
> subs(z=1,y=2,x=3,x+2*y-3*z=4);
44
Thus, the value for x,y, and z given are the solution of the equation as both sides have the
same value.
13. Solve the equations: x - y = -3 and x + 2y =3. Plot this question in the same graph. Do
these graph cross each other? What is the meaning of the point of intersection?
> restart;
> eql:=x-y=-3;
> solve(%,y);
> y1:=%;
eql:= xy-3
x3
y1 :=x3
> eq2:=x+2*y=3;
eq2:= x2y3
> solve(%,y);
x 3
 
2 2
> y2:=%;
x 3
y2 :=  
2 2
> solve({eql,eq2},{x,y});
{y2, x-1}
> plot({y1,y2}, x=-infinity..infinity);
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
The graphs crossed each other and the meaning of the point of insection is the point
where the graph crossed each other. In this graph, the point of intersection is (-1,2)
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
b) Plat the equations: y= -x-3 and y= -x+2. From the graphs what can you say about the
existence of solutions for this set of equation?
> restart;
> y1:=-x-3;y2:=-x+2;
y1 := x3
y2 := x2
> plot({y1,y2},x=-infinity..infinity);
From the graph, both equation show same shape which is -1 have only 1 solution. They
are similiar and parallel to each other.
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
c) Plot the equations: x+y= 1 and 2x+2y= 2. From the graphs what can you say about the
existence of solutions for this set of equation?
> restart;
> solve(x+y=1,y);
> y1:=%;
> solve(2*x+2*y=2,y);
> y2:=%;
x1
y1 := x1
x1
y2 := x1
> plot({y1,y2},x=-infinity..infinity);
The graph plotted above in the same as they have the same slope which is -1.
[email protected]
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
14. Solve the equation: 2x+y-2z= 8, 3x+2y-4z= 15, and 5x+4y-z=1.
> restart;
> eqns:=(2*x+y-2*z=8,3*x+2*y-4*z=15,5*x+4*y-z=1);
eqns:=2xy2z8, 3x2y4z15, 5x4yz1
> sol:=solve({eqns},{x,y,z});
sol :={x1, z-4, y-2}
15. Write any equation of your own and expand it using Maple. Factorize and simplify
the result and show that it gives back the starting equation.
> restart;
> z1:=(x+4)/x*3+54/(221+x^5)/x*2;
3 ( x4)
108
z1 :=

x
( 221x5 ) x
> expand(%);
12
108
3 
x ( 221x5 ) x
Factorize
> factor(%);
3(221xx69204x5)
(221x5) x
Simplify
> simplify(%);
3(221xx69204x5)
(221x5) x
16. Write any equation with three variable (x,y and z) and solve it using Maple.
> eqn1:=x*3+y*2-z=4;
> eqn2:=x*2-y+z=3;
> eqn3:=x+y-(z*2)=-3;
[email protected]
eqn1:= 3x2yz4
eqn2:= 2xyz3
Nur Fathiyah bt Mahfuz
AM
Assignment4-Questions in Introduction to Maple
6/27/2017
3:00:21
Section2(BBT)
eqn3:=xy2z-3
> solve({eqn1,eqn2,eqn3},{x,y,z});
{x1, y2, z3}
> eval({eqn1,eqn2},%);
{33, 44}
> eval({eqn2,eqn3},%);
{2xyz3, xy2z-3}
> eval({eqn1,eqn3},%);
{-3-3, 3x2yz4}
17. Download any VRML picture from the internet and build a web page using this
picture along with a paragraph describing this object and acknowledge the website from
where you download this picture. Upload this webpage in your website. Include the
printout of this webpage with your assignment.
[email protected]