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)?
Computer algebra system is computation
with symbols representing mathematical objects including:
-integers, real and complex
-polynomials
-derivatives,integrals
-system of equations, series expansions of funtions.
2. What are the differences between symbolic computing and numerical computing?
Maple clearly distiguishes between symbolic and numeric computing. Normally, maple tries to calculate symbolically: this is why expessions such as tan(1) simply remain in this form.Symbolic calculation are 'infinitely' exact; no rounding errors can occur.
However, maple computing numericaly when it is explicitly asked for a floating point evaluation with evolf, fsolve etc, of if a floating point number occurs in an expressions.
3. What are the advantages of symbolic computing compared to the numerical computing?
-Internal representation for rational numbers is different from floating point representations.
-For rational numbers, numbers of significant digits and maxmimum size numbers far exceeds typical floating point representation in numerical computation.
-Symbolic computational are 'infinitely' bexact; no rounding errors can occur.
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?
Substraction and addition
Subtraction have equal priority, therefore we must start to calculate the equation from left to right.
> | restart; |
> | f1:=2+3+y-z; |
> |
Multiplication and division
Multiplication and division have equal priority, therefore when we want to calculate the equation, we must start from left to right.
> | restart; |
> | f1:=2/6*x+8/2*3; |
Multiplication or division and substraction or addition
M ultip lication or division and substraction or addition have different equality. Whwn we want to calculatethe equation which involve multiplication or division and substraction or addition we need to calculate the operation which involve multiplication or division first then we calculate the calculation which involve substraction or addition.
> | restart; |
> | f1:=2/6*x+3-4*y+6*2*z; |
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 :
> | restart; |
> | f1:=3+2; |
> | f1 := 5; |
> | restart; |
> | a:=3;b:=5; |
A normal calculation whose result be displayed (;). Subsequently, two variables assignments are carried out and the display of their new values on screen is suppressed (:).
b) = and :=
> | restart; |
> | solve(x^2+x=1,x); |
The (=) symbol used in the expression.
> | restart; |
> | f1:=x^2+3-y; |
The (:=) symbol used to stated the expression.
c) ? and ???
> | restart; |
> | ?table; |
table - create a table
table( F, L )
Parameters
F - (optional) the indexing function
L - (optional) list or set of initial table entries
Using the once question mark syntax (?) will display the main topic.
> | ???table; |
table - create a table
table( F, L )
Parameters
F - (optional) the indexing function
L - (optional) list or set of initial table entries
> | table(); |
> | table([22,42]); |
> | S := table([(2)=45,(4)=61]); |
> | S[1], S[2]; |
> | T := table(symmetric,[(c,b)=x]); |
Using the triple question mark syntax (???) causes the topic to open with the 'Example section' if any expanded,and all other sections contracted.
d) expression and function
Expression
> | f:=x->x^2-5*x; |
Once x is assigned a numerical value, Maple automatically substitutes the numerical value for the symbolic value in all expressions using x.
Funtion
> | f:=x^2-5*x; |
The result of function evaluation or operation on function is an expression, except for differentition when the result is automatically a function.
e) sum and add
Sum
> | restart; |
> | sum(1/x^3,x=1..1000); |
The usage of the command is extremely simple: the first parameter specifies the function to be summarized, the second the summation variable and limits. Maple tries to evaluate and simplify the sum symbolically. This may cause funtions may appears in the result.
Add
> | restart; |
> | add(1/x^3,x=1..1000); |
The add command is avalaible in addition to sum, add allows an efficient numerical calculaion of a finite number of summands. Unlike sum, neither a symbolic evaluation nor a limit transition is attemped.
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 examples.
Sort
Sort used to sorts the specified list, taking the internal position of the elements in memory as sorting criterion. The additional specification of lexorder allows alphabetical sorting character strings or sorting of numbers in ascending order, but there must be no generic mathematical terms in the list, sort changes the of the elements in the list, even when no assignment is carried out.
Example:
> | restart; |
> | sort([2,5,1,7]); |
Map
Map applies all one-parameter funtions specified in the first parameter to the element enumated in the second parameter in the form of a list or a set.
Depending on the type of the second parameter, map returns a list or a set.
Example:
> | restart; |
> | map([sin,cos],[1,2]); |
Max and Min
Determine the greatest or smallest of the specified numbers, respectively. Complex numbers are not allowed.
Example:
> | restart; |
> | max(4,6,1,9); |
> | min(3,9,10,6); |
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- To calculate total distancewith vary units.
> | restart; |
> | with(Units[Natural]); |
> | d:=2*km+1*ft; |
> | convert(d,system,FPS); |
> | evalf(%); |
PROBLEM 2- To calculate value of seconds in a specified month.
> | restart; |
> | with(Units[Natural]); |
> | second:=5*month; |
> | convert(second,units,s); |
PROBLEM 3- To find circular orbital velocity
around a spherically symmetric body is
where G is the gravitational constant, M is the mass of the body and R is the radius of the orbit.
> | restart; |
> | GetConstant(); |
> | vCircl:=sqrt(G*M/R); |
> | convert(2*Pi*R,units,m/d,m/s); |
8. Find out the dimensions of three different physical properties using Maple.
> | restart; |
> | with(Units); |
> | GetSystems(); |
> | GetDimension(force); |
> | GetDimension(torque); |
> | GetDimension(magnetic_polarizability); |
9. Calculate the volume occupied by 1 kg of mercury at 25 C.
> | with(ScientificConstants); |
> | GetElement(Hg); |
> | volume:=mass/density; |
> | mass:=1000*g; |
> | density:=13.5336*g/cm^3; |
> | volume:=mass/density; |
10. Use Maple to calculate the number of water molecules in 1 g of liquid water.
> | with(ScientificConstants); |
> | waterMole:=2*Element(H,atomicweight)+Element(O,atomicweight); |
> | evalf(waterMole); |
> | convert(%,units,kg,amu); |
> | 1.0/%; |
> | %*evalf(Constant(N['A'])); |
11. Determine whether is linear nor not? (Hint: solve for y, and comment)
> | (y+8)/(x-2)=x+6; |
> | solve((y+8)/(x-2)=x+6,y); |
> | y=%; |
From mthe solution of the equation, we can see that x has power of 2. Therefore, the equation is not a linear.
12. Show that z=1, y=2, x=3 are the solutions for x+2y-3z = 4. (Hint: use subs)
> | x+2*y-3*z-4=0; |
> | subs(z=1,y=2,x=3,x+2*y-3*z-4=0); |
It prove that the solution for z,y and x is 1,2 and 3.
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; |
> | f1:=solve(x-y=-3,y); |
> | f2:=solve(x+2*y=3,y); |
> | plot({f1,f2},x=-4..4,y=-1..5); |
From the above graph, we can see that both equation intersect at point (-1,2). The point of intersection is the point which is/are the point where the graph cross each other.
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?
> | restart;
|
> | f1:=solve(y=-x-3,x); |
> | f2:=solve(y=-x+2,x); |
> | plot({f1,f2},y=-10..10); |
From the graph we can see that the equations are parallel, therefore do not have point of intersection.
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; |
> | f1:=solve(x+y=1,y); |
> | f2:=solve(2*x+2*y=2,y); |
> | plot({f1,f2},x=-10..10); |
From the graph we can see that the line is overlape, therefore the line in the same line and no point of intersection.
14. Solve the equations: 2x + y - 2z = 8, 3x + 2y - 4z = 15 and 5x + 4y - z = 1.
> | restart; |
> | f1:=2*x+y-2*z=8; |
> | f2:=3*x+2*y-4*z=15; |
> | f3:=5*x+4*y-z=1; |
> | solve({f1,f2,f3},{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.
> | y:=(x-a)^2/(x+b)^3; |
> | expand(y); |
> | simplify(y); |
16. Write any equation with three variables (x, y and z) and solve it using Maple.
> | restart; |
> | f1:=2*x+y-3*z=3; |
> | f2:=3*x-2*y+z=13; |
> | f3:=x-2*y+3*z=14; |
> | solve({f1,f2,f3},{x,y,z}); |
The solution are
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.