MaplePrimes Questions

Hello,

I want to animate a ball rolling on the surface cos(abs(x)+abs(y)).  The ball mass m is 1kg, radius r is 0.1meters starts at (0.5,0.5,cos(abs(5)+abs(5))) meters using g=9.8. 

If we say the initial velocity of the ball is pushed in some random direction. 

How do I show the path of the ball and animate?

Thanks,

Arthur


there’s few redundant values. I just want the positive values. How it can be done?

restart

NULL

n := [80, 79, 83, 84, 83, 83, 81, 85, 86, 86, 83, 82, 83, 84, 81, 80, 83, 79, 82, 81, 85]

[80, 79, 83, 84, 83, 83, 81, 85, 86, 86, 83, 82, 83, 84, 81, 80, 83, 79, 82, 81, 85]

(1)

``

nops(n)

21

(2)

for i from 3 to 17 do f[i] := n[i-2]-3*n[i-1]+3*n[i]; i = i+1; f[i+1] := n[i-2]+4*n[i-1]-6*n[i]+n[i+1] end do

92

 

3 = 4

 

-18

 

82

 

4 = 5

 

-10

 

80

 

5 = 6

 

4

 

84

 

6 = 7

 

-1

 

77

 

7 = 8

 

14

 

95

 

8 = 9

 

-17

 

84

 

9 = 10

 

-9

 

85

 

10 = 11

 

-4

 

77

 

11 = 12

 

14

 

83

 

12 = 13

 

9

 

86

 

13 = 14

 

-3

 

85

 

14 = 15

 

-9

 

74

 

15 = 16

 

13

 

81

 

16 = 17

 

11

 

90

 

17 = 18

 

-18

(3)

``

NULL


 

Download fyp_2.mw

Hi,

I am exploring the Grading package in Maple, and I want to create a random question about limits. (Question 9). Any ideas for the correct code? Thank you

QUIZZTestMaple.mw

I learned about Dodgson calculation of the determinant only recently (https://en.m.wikipedia.org/wiki/Dodgson_condensation).
I am only interested in symbolic expressions of the determinant.
Furthermore, I compared several methods. Not surprisingly, the build in method is the fastest. But why is the seq method slower than the proc method for the Dodgson method? Is there anything I could do to program it more efficiently?
 

restart; with(LinearAlgebra)

with(combinat); with(GroupTheory)

DetDef := proc (A) local i, n, sigma; description "Jeremy Johnson. Downloaded from https://www.cs.drexel.edu/~jjohnson/2016-17/winter/cs300/lectures/determinant.mw"; n := RowDimension(A); add(PermParity(Perm(sigma))*mul(A[i, sigma[i]], i = 1 .. n), `in`(sigma, permute([`$`(1 .. n)]))) end proc

InnerMatrix := proc (M::Matrix) SubMatrix(M, 2 .. RowDimension(M)-1, 2 .. ColumnDimension(M)-1) end proc

MatrixDet := proc (M::Matrix) local C, n, i, j; n := RowDimension(M)-1; C := Matrix(n, n); seq(seq(assign('C[i, j]', Determinant(M([i, i+1], [j, j+1]))), j = 1 .. n), i = 1 .. n); return C end proc

Dodgson := proc(M::Matrix)
 MatrixDet(M);
InnerMatrix(M) ^~ (-1) *~ MatrixDet(MatrixDet(M));
do if 1 < RowDimension(%) then InnerMatrix(`%%`) ^~ (-1) *~ MatrixDet(%);
end if;
until RowDimension(%) = 1;
Trace(%):
end proc:

Dodgsonseq := proc (E::Matrix) local w, dim, Z; dim := RowDimension(E); Z[dim] := E; Z[dim-1] := MatrixDet(E); Z[dim-2] := `~`[`*`](`~`[`^`](InnerMatrix(E), -1), MatrixDet(MatrixDet(E))); seq(assign('Z[w-1]', `~`[`*`](`~`[`^`](InnerMatrix(Z[w+1]), -1), MatrixDet(Z[w]))), w = dim-1 .. 1, -1); Trace(Z[1]) end proc

LaPlace := proc (M::Matrix) local c; add((-1)^(c+1)*M[1, c]*Minor(M, 1, c), c = 1 .. ColumnDimension(M)) end proc

dim := 7; A := Matrix(dim, dim, shape = symmetric, symbol = a)

7

(1)

start_time := time(); st := time[real](); Det1 := abs(A); CPUtime_used_Build_in_Determinant := time()-start_time; REALtime_used_Build_in_Determinant := time[real]()-st; start_time := time(); st := time[real](); Det2 := DetDef(A); CPUtime_used_Jeremy_Johnson_Determinant := time()-start_time; REALtime_used_Jeremy_Johnson_Determinant := time[real]()-st; start_time := time(); st := time[real](); Det3 := Dodgsonseq(A); CPUtime_usedDodgsonseq := time()-start_time; REALCPUtime_usedDodgsonseq := time[real]()-st; start_time := time(); st := time[real](); Det4 := Dodgson(A); CPUtime_usedDodgson := time()-start_time; REALtime_usedDodgson := time[real]()-st; start_time := time(); st := time[real](); Det5 := LaPlace(A); CPUtime_usedLaPlace := time()-start_time; REALtime_usedLaPlace := time[real]()-st; simplify(Det1-Det2); simplify(Det1-Det3); simplify(Det1-Det4); simplify(Det1-Det5)
``

0.32e-1

 

0.34e-1

 

0.93e-1

 

.108