KOS 1110 Computers in Science
Assignment
4 - Questions in Introduction to Maple
Due date
Thursday, 29-9-2005, 1:00pm
Instructions: All the answers (except the
last question) should be done in Maple work sheet. Use the text mode to type the questions and
any comments. After you have answered
all the questions, export your file as 4yourname.rtf. Open this file in MS Word and save this file
as 4yourname.doc file. Print out this
file. Send me the printed form (.doc
file) and the electronic form (softcopy) through the email. Remove the output from your Maple work sheet
file (.mws), save the file as .htm file and publish in your web page. For the last question include a print out
from your website after your have uploaded the web page. Include the web page address in your answer.
1. Computer Algebra System: What is
computer algebra system (symbolic computing)?
Symbolic
computation is computation with symbols representing mathematical objects,
including integers, real and complex, polynomials, derivatives, integrals,
systems of equations and series expansions of functions. The objective is to
obtain closed form and exact solutions. Thousand of built in functions can be
done through this system. It also has many options for simplifying expressions.
2. What
are the differences between symbolic computing and numerical computing?
Symbolic
computing is computation with symbols representing mathematical objects,
including integers, real and complex, polynomials, derivatives, integrals,
systems of equations and series expansions of functions. The objective is to
obtain closed form and exact solution. Thousand of built in functions can be
done through this system. It also has many options for simplifying expressions.
Internal representation for rational numbers is different from floating point
representations. For rational numbers, numbers of significant digits and
maximum size number far exceed typical floating-point representation in
numerical computation.
Numerical
computing handle operations such as (+,-,*,/) on numbers, plus computation of
numeric value for roots of equations, mathematical functions, integrals and
derivatives. the computing is carried out on numbers alone. The results most
often not exact since floating point approximations is used.
3. What are the advantages of symbolic computing
compared to the numerical computing?
Symbolic
computing can obtain closed form and exact solutions as it use internal
representation for rational numbers that is different from floating point
representations.
Numerical computing results most often not
exact since floating point approximations is used. Floating point
representations often lead to representation or truncation error. It will try
to represent irrational numbers and also lead to propagation errors because it
accumulated errors arising from a sequence of calculations. This system having
word length problem as the allowable values for exponent depend on computer,
computing language or calculator.
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?
Example 1:
addition
(+) and subtraction (-)
> x:=12+5-8;
If there
are (+) and (-) in one expression (the same priority operator), the calculation
will start from left to right.
Example 2:
multiplication
(*) and division(/)
> x:=6*7/2;
If there
are multiplication(*) and division(/) in one expression,(the same priority
operator), the calculation will start from left to right.
Example 3:
multiplication(*)
and addition (+)
> x:=12*3+4;
if there
are multiplication(*) and addition (+) in one expression,(the different
priority operator), the multiplication is calculated first and followed by
addition.
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); and ;
> GetConstant :=Faraday_constant;
> GetConstant:=Faraday_costant:
From the
example above, when we use (;),it will display the execution result.
However if
we use(:), it will not display the execution result.
b) = and
:=
> restart;
> x=4+3*60+5^2;
> x:=6+2*60+5^2;
from the
exampe above,when we use equation(=)sign, it means that the variable which is
in example x is having a value of the expression.
if we use
assign operator (:=),the result will assign to the x. so that the x will have
the same value of the expression.
c) ? and ???
?= using
single question mark syntax (?) causes the topic to open with the example
section expanded.
??? =
using triple question mark syntax (???) causes the topic to open with the
example section expanded, and all other sections contracted.
d) expression and function
Expression
> restart;
> f:=7*x^3+12*x^2-9*x-15;
> f(2);
> x:=2;
> f;
Function
> f:=x->7*x^3+12*x^2-9*x-15;
> f(2);
the first
example is expression which there is no variable on the left side.
the second
example is a function which these variable on the left side and assigning a
value to variable does not alter the definition.
e) sum and add
> restart;
> add(7*x+5,x=3);
> sum(7*x+5,x=3);
> add(7*x+5,x=1..s);
Error, unable to execute add
> sum(7*x+5,x=1..s);
sum is the
symbolic summation. it is used to compute formula for definite or indefinite
sum. if Maple cannot compute a closed form, Maple returns the sum
'unevaluated'.
a typical example is sum (k,k=0...n=1), which
returns the formula n^2/2-n/2. to add a finite sequence of values, rather than
compute a formula, use the add command.
the add
fuction is used to add up an explicit sequence of values. for example, add
(k,k...0.9) returns 45. although the sum command can be used to compute
explicit sum, it is recommended that the add command be used in programmes if
an explicit sum is needed.
6. Use of Help facilties 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.
Command 1=
algebra
> combine(Int(x,x=a..b)-Int(x^2,x=a..b));
>
Command 2=
energy conversion
Convert
the speed of light into units of action (1 planck = 1 joule second).
> convert(m/s, dimensions,
energy=true);
> convert(299792458., units, m/s,
planck, energy=true);
Command 3=
conjugate equation
> with(VariationalCalculus);
> ConjugateEquation(A*sin(t)+B*cos(t),
[A,B],[1,0],t,0);
The
conjugate points to 0 are the zeros of this.
>
7. Use of units and Scientific Constants: Select any three
problems involving different types of units from your textbooks and carry out
the complete calculations including the units using Maple. State the problem fully and comment whether
Maple gives the correct final answer along with appropriate units. (Refer, but don't reuse the examples
discussed in the class or in the help menu)
Problem 1 : find the momentum of a
person in your car on the highway
> Units[UseSystem](FPS);
> with(Units[Natural]);
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
> momentum:= 150*lbs * 60*mph;
> evalf(convert(momentum,system,SI),4);
Problem 2: How much a room
(10x10x2 m3) completely full of pure gold actually weighs?
> restart:
> with(Units[Natural]):
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
> with(ScientificConstants):
> rho[Au]:=
evalf(Element(gold,density,units));
> Volume:=(10*m)*(10*m)*(2*m);
> g_SI :=
evalf(Constant(g,units));
> Weight := evalf
(rho[Au]*Volume*g_SI,3);
>
Problem 3
Magnitude of the rate constant
> restart;
> with(ScientificConstants);
> K:=rate/[A]^2;
> rate:=3.0*11^5*(m*(-1)/(s*(-1)));
> A:=0.1;
> evalf(K);
>
8. Find out the dimensions of three different physical
properties using Maple.
> restart;
> with(Units);
Warning, the name GetUnit has been rebound
> GetDimensions();
> GetDimension (absorbed_dose);
> GetDimension
(moment_of_inertia);
> GetDimension (illuminance);
>
9. Calculate the volume occupied by 1 kg of mercury at 25 C.
> restart;
> with(ScientificConstants);
> GetElement(Hg,density);
> mass:=1*kg;T:=25*degC;
> Volume:=mass/density;
> mass:=1000*g;
> density:=13.6*g/cm^3;
> Volume;
> restart;with(ScientificConstants);
> GetElement(mercury,symbol,meltingpoint,atomicweight);
> PV:=n*R*T;
> V:=n*R*T/P;
> R:=8.314*J/(mol*(K));
T:=(273+25)*K; P:=(1*atm);
> n:=(1000/80)*mol;
> evalf(V);
> V;
The result
show the value is by atm. the unit atm indicate value of 1.the result is
10. Use Maple to calculate the number of water molecules in 1 g of
liquid water.
> restart;
> with(Units);
> with(ScientificConstants);
Warning, the name GetUnit has been rebound
> GetElement(H,atomicweight);
GetElement(O,atomicweight);
> waterMole:=2*Element(H,atomicweight)+(Element(O,atomicweight));
> evalf(waterMole);
the
measurement is in kilogram. Convert to amu.
> convert(%,units,kg,amu);
> 1/%;
The value
is mass per mole. Divide by atomic weight
> %*evalf(Constant(N['A']));
>
11. Determine whether
y+8/x-2=x+6 is linear nor not? (Hint:
solve for y, and comment)
> restart;
> with(plots):
> f:=(y+8)/(x-2)=x+6;
> solve(f,{y});
> plot(-20+x^2+4*x,x=-infinity..infinity);
From the
graph,we know that the equation is not linear,but quadratic function.
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);
>
13. a) Solve the equations: x - y = -3 and x + 2y = 3. Plot these equations in the same graph. Do these graphs cross each other? What is the meaning of the point of
intersection?
> restart;
> solve(x - y = -3 ,{y});
> solve(x + 2*y = 3,{y});
> plot({x+3,(-x/2+3/2)},x=-infinity..infinity);
the graph
crossing each other,the point where the graph crossing each other is the
solution for x.
b) Plot
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?
> plot({-x-3,-x+2},
x=-infinity..infinity);
there are
2 intersections, meaning that there are 2 solutions for this graph.
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?
> solve (x + y = 1,{x}) ;
>
> solve (2*x + 2*y = 2,{x});
> plot({-y+1.-y+1},y=-infinity..infinity);
Both of
the equations are the same.so, every points on the line are the solutions for
y.
14. Solve the equations: 2x + y - 2z = 8, 3x + 2y - 4z = 15 and 5x
+ 4y - z = 1..
> restart;
> solve ({2*x+y - 2*z =8, 3*x+2*y
-4*z =15, 5*x+4*y-z = 1},{x,y,z});
15. Write any equation of your own and expand it using Maple. Factorize and simply the result and show that
it gives back the starting equation.
> restart;
> f:=(x+y+13)*(x*2+5*y+9);
> expand(%);
> factor(f);
> simplify(f);
>
16. Write any equation with
three variables (x, y and z) and solve it using Maple.
> restart;
> solve(2*x+4*y-8*z=9,x);
> solve(2*x+4*y-8*z=9,y);
> solve(2*x+4*y-8*z=9,z);
17. Download any VRML picture from the internet and build a web
page using this picture along with a paragraph describing this object and
acknowledging the website from where you downloaded this picture. Upload this web page in your web site. Include the printout of this webpage with
your assignment.