Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I originally was trying to verify that the determinant of an nxn matrix of binomial coefficients is zero if n is a multiple of 6. A description of the coefficients is shown in my program below under Row 1, Row 2 etc, using the old fashioned notation for binomial coefficients nCr=n!/r!/(n-r)!    I came across this in the interesting book 'Single Digits: in praise of small numbers' by Marc Chamberland. page 167.

   My pathetic attempt is below.  I tried to create a 5 x 5 matrix of binomial coeffs.  There is a procedure shft which attempts to create the rows of the matrix: the rows are just shifted along.  I've been successful in obtaining two rows, then after that gave up:-(  Thinking I'd try something easier, I thought I'd find the determinant of the matrix using the determinant command in the linear algebra package - without success.

  Any help would be most appreciated. 

 

 restart:

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Matrix program - intro to learn matrices

# The proc shft shifts the elements of an array one to the right and the

# first becomes the last

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

with(plots):

with(plottools):

#with(linalg);

with(LinearAlgebra);

#a:=array([1, 2, 3, 4, 5]);

#Row 1   1 nC1  nC2  nC3…    …nC(n-1)

#Row 2   nC(n-1)  1  nC1…      …nC(n-2)

#Row 3  nC(n-2)  nC(n-1)  1…  …nC(n-3)

#...

#Row n  nC1  nC2 nC3…        …1

n:=5:

a:=array([seq(binomial(n,i), i=0..n-1)]);

acopy:=array([seq(binomial(n,i), i=0..n-1)]);

 

#shift := (f::procedure) -> ( x->f(x+1) ):

#shift(a[1]);

shft := proc(a::array)

local i, b::array:

global n:

#printf("n=%d\n",n);

for i from 1 to n do

#printf("n=%d\n",n);

b[i]:=a[i]:

end do:

#nn:=n-1:

for i from 1 to n-1 do

if i<>n-1 then

a[i+1]:=b[i]:

      else

a[1]:=a[5]:

a[n]:=b[n-1]:

end if:

printf("In loop a[%d}=%5.3f\n", i, a[i]);

end do:

end proc:

 

shft(a);

for i from 1 to n do

#printf("n=%d\n",n);

   bnew[i]:=a[i];

printf("bnew[%d]=%d\n",i,bnew[i]);

end do:

bmatrix:=array(1,n,[seq(bnew[i], i=1..n)]);

 

#for m from 2 to n do

   #shft([seq(bmatrix[1,kk], kk=1..m)],[seq(bmatrix[1, k], k=1..n-m)]);

    shft(bmatrix);

printf("In for loop:  bnew[%d}=%5.3f\n", m, bnew[m]);

#end do:

#s:={seq((1,j)=eval(A[1,j]), j=1..n), (2,2)=1,(3,3)=1,(4,4)=1, (5,5)=1}:

s:={(1,1)=1,(1,2)=5,(1,3)=10,(1,4)=10,(1,5)=5, (2,2)=1,(3,3)=1,(4,4)=1, (5,5)=1}:

 

SSs:=Matrix(5,5,s);

determinant(SSs);

simplify(evalf @(determinant(SSs)));

Determinant(SSs,method=float);

 

#A := Matrix(2,2,[[9,9],[1,2]]);

print(`Printing matrix`);

#A[3,3]:=1;

A := Matrix(m,5,[[seq(acopy[i], i=1..5)],[seq(bnew[j], j=1..5)]]);

#end do;

for i from 1 to n do

  printf("a[%d}=%5.3f\n", i, a[i]);

end do:

 

Need help understanding the following code fragment (skipping the implementation details of procedure A). I am a  student and program primarily in Java and I do not have Maple s/w. I browsed through Maple programming guide but have not yet deciphered the code. Any help will be greatly appreciated.

Thank you.

_____________________________________________________________________________

f:=proc(J)

L:=map((x)->[x[1], (x[2] + x[3] * I) / x[1] + 50 * (1+I) / abs(J[1][2])], J);

R:=Vector([L]);

T,r:=abs(L[1][3]),L[1][4];

A(L[1][5],L[2][6],L[3][7],L[1][8],L[2][9],L[3][10],R,T,r);

A(L[1][11],L[2][12],L[4][13],L[1][14],L[2][15],L[4][16],R,T,r);

A(L[1][17],L[3][18],L[4][19],L[1][20],L[3][21],L[4][22],R,T,r);

A(L[2][23],L[3][24],L[4][25],L[2][26],L[3][27],L[4][28],R,T,r);

plots[display](seq(plottools[circle]([Re(R[i][29]),Im(R[i][30])],abs(1/R[i][31])),i= 1..numelems(R))):

end proc:

_____________________________________________________________________________

Procedure is called as:

f([[-1, 0, 0], [2, 1, 0], [2, -1, 0], [3, 0, 2]]);

_____________________________________________________________________________

Hi

Please download and check the attached file.
It seems when you run the code more than one time, various results are obtained each time.

What is the reason? How it can be fixed?

Thanks


 

restart; Digits := 20; tm := time(); with(LinearAlgebra); m := 6; a := .1; b := 10*a; E := 1; h := 1; nu := .3; ur := -w*z+u0; u0 := 0; ut := add(add(T[n, i]*r^n*t^(i-n), n = 0 .. i), i = 0 .. m); w := (r-b)^2*(r-a)^2*add(add(W[n, i]*r^n*t^(i-n), n = 0 .. i), i = 0 .. m); er := diff(ur, r); et := ur/r+(diff(ut, t))/r; ert := 1/2*(diff(ut, r)-ut/r+(diff(ur, t))/r); u := -(1/2)*E*(2*er*et*nu+er^2+et^2)/(nu^2-1)+2*E*ert^2/(2+2*nu); N := sum(i+1, i = 0 .. m); PI := int(int(int(u*r, z = -(1/2)*h .. (1/2)*h), t = 0 .. 2*Pi), r = a .. b)-.5*P*(int(int(r*(diff(w, r))^2, r = a .. b), t = 0 .. 2*Pi)); s1 := seq(indets(add(add(T[n, i], n = 0 .. i), i = 0 .. m))[k] = c[k], k = 1 .. N); s2 := seq(indets(add(add(W[n, i], n = 0 .. i), i = 0 .. m))[k] = c[k+N], k = 1 .. N); PI := subs(s1, s2, PI); for k to 2*N do diff(PI, c[k]); if % = 0 then ex := `union`({}, {k}) else eq[k] := % end if end do; NE := seq(ex[j], j = 1 .. numelems(ex)); M := GenerateMatrix([`$`(eq[j], j = 1 .. 2*N)], [`$`(c[j], j = 1 .. 2*N)])[1]; M := DeleteColumn(DeleteRow(M, NE), NE); Determinant(M); 12*fsolve(%, P = 0 .. 1)*(-nu^2+1)*a^2/(E*h^3); Time = time()-tm

Time = 85.363

(1)

``


 

Download Stability.mw

Units seem to be interfering with elementwise square roots.  I have with(Units[Standard]): in my .mapleprofile since I frequently use units.  I am working on a document which uses units but also requires computing the elementwise square root of a 2x1 vector.

If I boil this down to the very simple document attached, you can see that the units package is somehow interfering with the square root of a vector of numbers without units, but doing an elementwise square root doesn't work either.  I have tried removing the with(Units[Standard]): line in the startup file for this document and recomputing, but nothing changes.

I don't see how to do elementwise square roots in this situation.  Is there a workaround, or am I missing something?

Thanks,

Gerrit

Elementwise_Square_Root.mw

Does anyone know how the sum command works? If I set

f:=proc(x) if x<=1 then 1 else 2

then compute

sum(f(i),i=1..10)

I get an error, as it tries to check "i<=0", for the symbol 'i'. Curiously if the comparison in 'f' is "x=1" it goes through fine. Another place this comes up is using "op" on lists. If I set

z:=[[1,2],[3,4],[5,6]]

then compute

sum(foldl((x,y)->x*vars[y],1,op(z[i])),i =1..3)

it doesn't give the desired answer. When i=1 for example, I think it computes op(z[i]) as op(z[i])->i->1, rather than op(z[i])->op(z[1])->op([1,2])->1,2.

Hello Guys,

Can maple derive Einstein field equations from Einstein-Hilbert action ?

 

Thx

hello guys, I can't take the real part of this formula that you can see in the picture that I upload for you.
please help me!!!!!!!!
sorry for uploading photo...so surry

I want to see that if parameter 'alpha' tends to the infinity amount of parameter 'p' how changes?

how I can see and do  this process?

thanks

_nahaii.mw
 

alfa*ba*che*taghiiri*roi*p*taghiir*mikonad

restart

E := 67*10^9:

``

h := 8*10^(-9):

l := 2.5*10^(-9):

f := 5:

L := 120*10^(-9):

``

b1 := -E*h*b:

b2 := -(1/4)*mu*h*b:

c1 := -(1/12)*(E*1)*b*h^3-2*mu*l^2*h*b-(2/25)*mu*l^2*h*b-(4/15)*mu*l^2*h*b-(32/15)*mu*l^2*h*b:

c2 := (18/5)*mu*l^2*i+(4/5)*mu*l^2*i:

c4 := (152/225)*mu*l^2*h*b:

NULL

a1 := -E*h*b:

a2 := 2*mu*l^2*h*b+(4/5)*mu*l^2*h*b+(8/5)*mu*l^2*h*b:

c5 := c1+c4-2*f^2*h*varepsilon0/(3*(alpha*varepsilon0+1))-2*f^2*h/(3*alpha*(alpha*varepsilon0+1)):

c6 := c4-2*f^2*h*varepsilon0/(3*(alpha*varepsilon0+1)):

c7 := (14/9)*f^2*h/alpha:

``

m := 2*3.14^2*c7^2+8*L^2*b2*c7-2*L^2*c5^2+2*L^2*c5*c6-L^2*c7:

n := 4*L^2*c6^2*c7^2*3.14^2+16*L^4*b2*c6^2*c7-4*L^4*b2*c5*c6*c7+L^4*c7^2:

q := (3.14^2*c7^2+4*L^2*b2*c7-L^2*c5^2)/b2:

p := -(1/2)*(m-sqrt(n))/q:

plot(p, alpha, alpha = 0.1e7 .. 0.1e8)

 

NULL


 

Download _nahaii.mw

 

Hi every body:

I want to solve these equations with maple, can everyone help me how to solve them?

eq1 := diff(u1(x), x, x)+diff(u2(x), x)+int(2*x*s*(u1(s)-3*u2(s)), s = 0 .. 1) = 6*x^2+3*x*(1/10)+8
eq2 := diff(u1(x), x)+diff(u2(x), x, x)+int((3*(s^2+2*x))*(u1(s)-2*u2(s)), s = 0 .. 1) = 21*x+4/5
bcs := u1(0)+(D(u1))(0) = 1, u2(0)+(D(u2))(0) = 1, u1(1)+(D(u1))(1) = 10, u2(1)+(D(u2))(1) = 7

with regards...

I want to plot these in one frame:

between [0, 0.2]

between [0.2, 0.4]

betwen [0.4,0.6]

between [0.6, 0.8]

I want to plot all these functions y[0], y[1], y[2], y[3] in one plot between the mentioned interval.

 

Below is an attempt to evaluate an integral from t to ZERO.  I believe the issue is that sin(x) in the denominator is causing a problem.  However, in actuality sin(nx) is in the numerator so at the lower integral bound approaching ZERO the factor of n remains.  So how can I get MAPLE to evaluate this correctly?
 

int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x = 0 .. t)"(=)"int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x = 0 .. t)"="int((2*cos(Pi*x*n/T)^2-1)*sin(Pi*x*n/T)*cos(Pi*x*n/T)/(sin(Pi*x/T)*cos(Pi*x/T)), x = 0 .. t)

``


 

Download evaluating_integral.mw

Hello,

I'm trying to evaluate an integral (code snippet and screen-shot included below) assuming that certain parameters and integers. Using assume statements the integral evaluates to 0. However, if I evaluate the integral for a specific set of integers, the integral evaluates as non-zero.

Can anyone clarify why the two int statements return different values?

Thanks!

assume(K::integer);
assume(L::integer);
assume(M::integer);
int(sin(K*x)*sin(L*x)*cos(M*x), x = 0 .. Pi);
     returns: 0
int(sin(14*x)*sin(2*x)*cos(12*x), x = 0 .. Pi);
     returns: Pi/4

I have the following maple code. 

R11 := x -> (x+2*a_1)*(product(x+b[j], j = 1 .. k-n))/(x+a_1);

T_4 :=  (z_1, z_2, z_3, z_4) -> R11(z_1)*z_2*z_3*z_4;

%*(z_1+a_1);

I would like maple to simplify (z_1+a_1) in the denominator of R11(z_1) with the (z_1+a_1) from the last line, but it does not do that. Simplify command also does not help.

On the example of a manipulator with three degrees of freedom.
A mathematical model is created that takes into account degrees of freedom of the manipulator and the trajectory of the movement from the initial point to the final one (in the figure, the ends of the red curve). In the text of the program, these are the equations fi, i = 1..5.
Obviously, the straight line could be the simplest trajectory, but we will consider a slightly different variant. The solution of the system of equations is the coordinates of the points of the manipulator (x1, x2, x3) and (x4, x5, x6) in all trajectory. After that, knowing the lengths of the links and the coordinates of the points at each moment of time, any angles of the manipulator are calculated. The same selected trajectory is reproduced from these angles. The possible angles are displayed by black color.
All the work on creating a mathematical model and calculating the angles can be done without the manipulator itself, is sufficient to have only the instruction with technical characteristics.
To display some angles, the procedure created by vv is used.
MAN_2.mw

I am trying to learn how to use the Physics tensor routines by using a simple 2D example.  In the following, I set up the Cartesian Euclidean metric tensor and then tried to transform to cylindrical coordinates.  The metric tensor is correctly transformed in line (5), but then when it is called in line (7), it still has Cartesian values.  What am I doing wrong?

First 872 873 874 875 876 877 878 Last Page 874 of 2231