Download 4zulfaqar.mws

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

Addition wikipedia , lookup

Recurrence relation wikipedia , lookup

Algebra wikipedia , lookup

History of algebra wikipedia , lookup

Partial differential equation wikipedia , lookup

System of polynomial equations wikipedia , lookup

Elementary mathematics wikipedia , lookup

Transcript
1.
Computer Algebra System: What is computer algebra system
(symbolic computing)?
Algebra system(symbolic computing) is a symbolic computation with symbols
representing mathematical objects, including integers, real and complex number,
polynomials, derivatives, integrals, systems of equations, and series expansions of
functions. This system is used to obtain closed form and exact solutions in solving
mathematical problems.
2.
What are the differences between symbolic computing and numerical
computing?
For symbolic computing,number of significance digits & maximum size number far
exceeds typical floating-point representation.Its different from floating point
representations.Its also a computation with symbol representing mathematical objects.
Example of symbolic result is 1\5 or 32\51.
For numerical computing,results most often not exact since floating point
approximations used.Its create truncation error,try to represrnt irrational numbers and
propagation errors.Its also operations on numbers,plus computation of numeric
values.Example of numerical result is .20000 or .54685
3. What are the advantages of symbolic computing compared to the
numerical computing?
It has many advantages, for example this system has thousands of build in functions and
many options for simplifying expressions. Its not leading to any error. For symbolic
computing(rational numbers) number of significance digits & maximum size number far
exceeds typical floating-point representation.Its different from floating point
representations. One of it greatest advantage is that it gives exact answer, not the
approximate answer. Thus, when we use symbolic computing to solve long mathematical
problem, it will yield precise answer at the end.
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?
> restart;
> evalf(34+8+11-6+63);
110.
The calculation undergo the same operations which are subtraction and addition thus the
calculation starts from left to right.
> evalf(34/3*9/6*10);
594.
The calculation undergo the same operations which are division and multilication thus the
calculation starts from left to right.
> evalf((28/4*7^2+9+5)/(4*6)+30);
44.87500000
The calculation should follow the sequence; bracket, exponential, multiplication or
division, subtitution or 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 :
If we use" ;" the result will be executed and it will be displayed.
For example:
> u:=8*x-1;
u := 8 x1
However, if we use ":" the result will be executed but it will not be displayed.
For example:
> u:=8*x-1:
b) = and :=
The " =" sign is a temporary assigning symbol. It means that it only work in that
specific line. After we move to another line, the command will not be valid and
computed.
For example:
> g=5*x-6*x^2;
g5 x6 x 2
> subs(x=3,g);
g
The substitution x=3 in equation g cannot be done.
The " : = " sign is a permanent assigning symbol. It means that it work in whole
worksheet, until the value is changed or " restart; " command is excecuted after the
permanent assigning simbol.
For example;
> g:=5*x-6*x^2;
g := 5 x6 x 2
> subs(x=3,g);
-39
The substitution can be done
c) ? and ???
Maple will open the required topic with all of the sections (Description, Examples and
See Also) expand, if we use ? sign.
For example:
> ?graph;
Maple will open the required topic with the expanded examples section ( if any) while all
other sections contracted, if we use ??? sign (triple question mark syntax). For example:
> ???graph;
d)
expression and function
In expression , there is no arrow sign ( ->)
For example:
> h:=4*x^2-8*x+6;
h := 4 x 28 x6
In function, arrow sign ( ->) is used.
For example:
> h:=x->4*x^2-8*x+6; # x after = sign is use to show that x
is variable.
h := x4 x 28 x6
e) sum and add
sum command is for "symbolic" summation. It is used to compute a formula for an
indefinite or definite sum, rather than an explicit sum. If Maple cannot compute a closed
form, Maple returns the sum "unevaluated".
For example:
> restart;
> sum('m^3', 'm'= 0..n);
( n1 ) 4 ( n1 ) 3 ( n1 ) 2


4
2
4
add command is used to add up an explicit sequence of values.
For example:
> add(p, p=2..100);
5049
sum command can be use for numeric and also non numeric (including indefinite)
range. However, add command only works for numeric range.
For example:
> add(k^2, k=2..n);
Error, unable to execute add
> sum('k'^2, 'k'=2..n); # k is enclosed in right single
quote (') to prevent premature evaluation.
( n1 ) 3 ( n1 ) 2 n 5

 
3
2
6 6
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.
Example 1
ifactor command:
ifactor returns the complete integer factorization of n .
The answer is in the form: u * ``(f1)^e1 * ... * ``(fn)^en such that n = u * f1^e1 * ... *
fn^en where u equals sign(n) ,
f1,..., fn are the distinct prime factors of n , and e1, ..., en are their multiplicities
(negative in the case of the denominator of a rational). The expand function may be
applied to cause the factors to be multiplied together again.
If the 'easy' option is chosen, the result of the ifactor call will be a product of the
factors that were easy to compute, and a name _c.m._.n indicating an m -digit
composite number that was not factored where the n is an integer which preserves (but
does not imply) the uniqueness of this composite.
E.g:
> restart;
> ifactor( 324 );
( 2 )2 ( 3 )4
> expand(%);
324
> ifactor( 387, easy );
( 3 ) 2 ( 43 )
Example 2
icontent command:
icontent computes a rational number such that dividing the expanded polynomial by it
makes the polynomial primitive over the integers. Thus, for integer coefficients, icontent
returns the greatest common divisor of the coefficients.
For rational coefficients, icontent computes the least common multiple of the
denominators of all fractions in addition to the greatest common divisor of the
numerators of the coefficients.
E.g:
> restart;
> icontent( 4*x + 13*y );
1
> icontent( 3/5*x + 4/9*y );
1
45
Example 3
growingperpetuity command:
The function growingperpetuity() computes the present value of a perpetuity paying the
amount " cash '' one period from now, with increasing payments at the end of each
periods. The payments increase according to the `` growth '' rate.
The command with(finance,growingperpetuity) allows the use of the abbreviated form of
this command.
E.g:
I hold some shares of the XYZ company. I will receive dividends each year. The next
dividend is expected to be 1.8 U per
share, one year from now. The yearly dividends
are expected to increase by 2.5% per year, for the foreseeable future. What is the
present value, per share, of the dividend payments, given that the discount rate is 15%?
>
with(finance):
growingperpetuity( 1.8, 0.15,
0.025);
14.40000000
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)
Example 1:
Calculate the number of molecule of glucose, C6H12O6, in 5.380 g of this substance.
> restart; with(ScientificConstants): 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
> glucoseMole:=6*Element(C, atomicweight) + 12*Element(H,
atomicweight) + 6*Element(O, atomicweight);
glucoseMole := 6 Element ( C, atomicweight )12 Element ( H, atomicweight )
6 Element ( O, atomicweight )
> evalf(%);
0.2991560811 10 -24
> convert(%, units, kg, amu);
180.1558801
> 5.380/%;
0.02986302749
Comment: Maple answer to the question is slightly diffferent from the original answer
in the text. In text, the answer is
0.02989 mol. Nevertheless, the answer obtained from Maple is correct, and the answer in
the text might be less correct because it has floating-point which lead to propagation
error.
Example 2:
How many minutes in 4 weeks?
> 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
> t:=4 * week;
t := 4 [ wk ]
> convert(t, units, minutes);
40320 [ min ]
Comment: Maple gives the correct answer with appropriate unit.
Example 3:
Calculate the distance that if you travel for 50 minutes in 65 miles per hour. Gives
answer in meters .
> d:= 65*mph * 50*minutes;
d :=
435864
[m]
5
> convert( d, units, mi );
325
[ mi ]
6
> evalf (d);
87172.80000 [ m ]
Comment: Maple gives correct answers to this question.
8.
Find out the dimensions of three different physical properties using
Maple.
> 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
> GetDimension(volume);
length 3
> GetDimension(dynamic_viscosity);
mass
length time
> GetDimension(power);
length 2 mass
time 3
9.
Calculate the volume occupied by 1 kg of mercury at 25 C.
> restart;
> with(ScientificConstants);
[ AddConstant, AddElement , AddProperty , Constant, Element , GetConstant,
GetConstants, GetElement , GetElements, GetError , GetIsotopes, GetProperties ,
GetProperty , GetUnit, GetValue, HasConstant, HasElement , HasProperty ,
ModifyConstant , ModifyElement ]
> GetElement(mercury,density);
g
80, density  value13.5336, uncertainty undefined , units 3 

cm 

>
mass:=1.*kg;
mass := 1. kg
> volume:=1000*g/ (13.5336*g/(cm^3));
volume := 73.89016965 cm 3
10. Use Maple to calculate the number of water molecules in 1 g of liquid
water.
> restart; with(Units[Natural]): with(ScientificConstants):
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
>
watermolecule:=2*Element(H,atomicweight)+Element(O,atomicwe
ight);
watermolecule := 2 Element ( H, atomicweight )Element ( O, atomicweight )
> evalf(%);
0.2991509666 10 -25
> convert(%,units,kg,amu);
18.01528000
> 1/%;
0.05550843506
> numbermolecule:=%*evalf(Constant(N[A]));
numbermolecule := 0.2013079683 10 47
11. Determine whether(y+8)/(x-2)=x+6) is linear nor not? (Hint: solve for y,
and comment)
> restart;
> solve((y+8)/(x-2)=x+6,y);
20x 24 x
> y=(%);
y20x 24 x
Comment: The equation above is not linear because it has x to the power of 2. This is a
quadratic equation.
12.
Show that z=1, y=2, x=3 are the solutions for x+2y-3z = 4. (Hint: use subs)
> restart:
> p:=x+2*y-3*z=4;
p := x2 y3 z4
> subs(z=1,y=2,x=3,x+2*y-3*z=4);
44
Comment: Since 4 = 4, it proved that all the values given for x, y, and z are the solutions
for x + 2y - 3z = 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});
{ yx3 }
> solve({x + 2*y = 3}, {y});
x 3
{ y  }
2 2
> plot({x+3,(-x/2)+(3/2)}, x=-10..10);
Comment: Yes the graphs cross each other. The point of intersection indicate that the
value of y in the first equation is same with the value of y in the second
equation. In other word, the point where the graph are crossing with each others are the
solution for y.
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;
> plot({-x-3,-x+2}, x=-15..15);
Comment: From the graph, it can be conclude that there are no solutions for this set of
equation. (because no intersection in the 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?
> restart;
> solve({x+y=1},{y});
> solve({2*x+2*y=2},{y});
{ yx1 }
{ yx1 }
> plot({-x+1,-x+1}, x=-5..5);
Comment: Since both equations are the same, we only got one linear line. Therefore it
can be concluded that all the points on the lines in the graph are the solution
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});
{ x1, z-4, y-2 }
15. Write any equation of your own and expand it using Maple. Factorize
and simply the result and show that it gives back the startingequation.
> restart;
> y:=(a*b+4*b+2*a^2)/2*a*b;
( a b4 b2 a 2 ) a b
y :=
2
> expand(%);
1 2 2
a b 2 a b 2a 3 b
2
> factor(%);
( a b4 b2 a 2 ) a b
2
16. Write any equation with three variables (x, y and z) and solve it using
Maple.
> restart;
> e1:=x+y-z=-1;
> e2:=4*x-3*y+2*z=16;
> e3:=2*x-2*y-3*z=5;
e1 := xyz-1
e2 := 4 x3 y2 z16
e3 := 2 x2 y3 z5
> solve({e1,e2,e3},{x,y,z});
{ y-2, z1, x2 }