kristavaldes

15 Reputation

5 Badges

4 years, 268 days

MaplePrimes Activity


These are questions asked by kristavaldes

The expression X^n, for an interger power n and any X, can be computed using the following formulae, which represent a negative power in terms of a positive power (-n), and a positive power in terms of a smaller non-negative power (either n/2 or n-1), and use only multiplication and division: 
                                    
                          X^n = 1/X^(-n)                      if n < 0 
                          X ^n = I*d                             if n = 0
                          X ^n  = X^(n/2) * X^(n/2)      if n is even
                          X^n  = X*X^(n-1)                  if n is odd.
These formulae lead to an efficient recursive algorithm for computing integer powers using the minimal number of multiplications. 

(a) Write a procedure MatPow(X,n::integer) to implement this algorithm for computing powers of matrices. Test MatPow(<<1|2>,<3|4>>,12) and MatPow(<<1|2>,<3|4>>,-12).

(b) Write a procedure PolyPow(X,n::integer) to implement this algorithm for computing powers of numbers and polynomials. Your procedure needs to exapnd each product of polynomials in order to be effective. Test PolyPow(123,12), PolyPow(123,-12), PolyPow(x^2+1,12) and PolyPow(x^2+1,-12). 

Write a procedure using the variable args that will take an unspecified finite number of numbers, delete the smallest and the largest, and return the average of the rest as a floating point number. If there are fewer than 3 arguments have an error message say: "There are not enough arguments. There should be at least three." 

You should have no input parameters in the definition of the procedure. You may write it directly or you may use the Maple command sort as a part of your program. Do ?sort to see how sort works. Test your procedure with each of the following argument sequences:  

   50,40,40, 40, 40, 10

   1,2

   seq(100 - i, i = 1..100)

   seq(modp(n,111), n=1..1000).


If n people (numbered 1 to n) stand in a circle and someone starts going around the circle and eliminating every other person till only one person is left, the number J(n) of the person left at the end is given by 

    J(n) = 1                           if n = 1
    J(n) = 2*J(n/2) - 1          if n > 1 and n is even
    J(n) = 2*J((n-1)/2) + 1   if  n > 1 and n is odd

(i) Write a recursive procedure to compute J. [As a check the first 16 values (starting with 1) of J(n) are 1,1,3,1,3,5,7,1,3,5,7,9,11,13,15,1]. 
(ii)Compute the value of J(10000). 
(iii) Can you explain why this is so much faster than our recursive procedure to compute the n-th Fibonacci number?

The deltoid plane curve with parameter a  is the set of all points (x, y) in the plane satisfying the equation 
     (1)   (x^2+y^2)^2 - 8ax(x^2 - 3y^2) + 18a^2(x^2+y^2)=27a^4

and the same curve may be described by the parametric equations:

     (2)    
                  x = a (2 cos(t) + cos(2 t))
,      
                  y = a (2 sin(t) - sin(2 t))


(a) Using equation (1) and the command implicitplot graph the deltoid curves with parameters a = 1, 2, and 3 on the same axes.

(b) Using equations (2) and the plot command graph the deltoid curves with parameters a = 1, 2, and 3 on the same axes.

Remark: You will need to do some experimenting with the ranges of the plots and the option numpoints in question (a) to get a decent picture. Note that you can copy and paste equations (1) and (2) and with some judicious editing can save yourself the trouble of typing them. 


      

 

I need help with writing the code, I have this for part a but I dont think it is correct

   with(Student[Calculus1]);
   Tangent(2/(1+exp(-x)), x = 0, output = plot);
 


(a) Find an equation of the tangent line to the curve
                                 2    
                        y = -----------
                            1 + exp(-x)
 at (0,1). 
(b) Graph the curve and the tangent line on the same axes.
(c) Use animate to show how the tangent line to the curve changes as we move along the curve between x=-5 and x=5.
 

1 2 3 Page 2 of 3