Maple 17 Questions and Posts

These are Posts and Questions associated with the product, Maple 17

RandomCompositions:= proc(n::posint, k::posint)
local
C,
Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))],
Rand:= rand(1..nops(Compositions))
;
()-> Compositions[Rand()]
end proc:

R:= RandomCompositions(9,6):
n:= 2^13:
S:= 'R()' $ n:

 

I want to compile statistics each number in a sequence cannot  occur  over twice.

The sequences that do not fit the rule above must be ommitted.

The statistic is  Fermi-Dirac statistics.

confused the Bose-Einstein condensation and Fermi-Dirac statistics.

But the theory is right.

I have a polynomial p in two variables x and y, and I want to extract all the coefficients of p. For example, let p:=x^3+2*x*y^2-2*y^2+x, and I want to obtain the coefficient vector [1,0,0,1,0,2,0,0,-2,0], where 1,0,0,1,0,2,0,0,-2,0 are respectively the coefficients of x^3, x^2, x^2*y,x,x*y,x*y^2,y^0,y,y^2,y^3. In general, let 

p(x,y)=sum(sum(c_*{i, j}*x^(n-i)*y^j, j = 0 .. i), i = 0 .. n)

=c_{0,0}x^n

+c_{1,0}x^{n-1}+c_{1,1}x^{n-1}y

+c_{2.0}x^{n-2}+c_{2,1}x^{n-2}y+c_{2,2}x^{n-2}y^2

+\dots

+c_{n,0}+c_{n,1}y+c_{n,2}y^2+\dots+c_{n,n}y^{n}.

It is possible that some coefficients c_{i,j} are equal to 0. How to obtain the coefficient vector [c_{i,j},i=0..n,j=0..i] of p(x,y)?

Thanks a lot.

RandomCompositions:= module()
local
Compositions, Rand,
ModuleApply:= proc(n::posint, k::posint)
local C;
Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))];
Rand:= rand(1..nops(Compositions));
()-> Compositions[Rand()]
end proc
;
end module:
R:= RandomCompositions(8,6):
n:= 3:
S:= 'R()' $ n;
map(lhs=rhs/n, Statistics:-Tally(op~([S])));

[0 = 7/3, 1 = 5/3, 2 = 4/3, 5 = 1/3, 6 = 1/3]

plot([S],x=0..8,style=point);

I have  plot problem .

I want to plot the statistics result,but it runs error.

 

 

RandomCompositions:= module()
local
Compositions, Rand,

RandomCompositions:= module()
local
Compositions, Rand,
ModuleApply:= proc(n::posint, k::posint)
local C;
Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))];
Rand:= rand(1..nops(Compositions));
()-> Compositions[Rand()]
end proc;

end module:
R:= RandomCompositions(8,6):
seq(R(),i=1..10);

[0, 0, 2, 6, 0, 0], [1, 0, 0, 3, 4, 0], [0, 3, 3, 2, 0, 0],[1, 2, 4, 0, 1, 0], [0, 4, 0, 1, 3, 0],

[2, 0, 1, 4, 1, 0],[2, 0, 1, 1, 3, 1], [1, 0, 4, 2, 1, 0], [1, 3, 0, 2, 0, 2],[2, 0, 3, 2, 1, 0]

with(Statistics):
Tally(R());
[0 = 1, 1 = 4, 4 = 1]

I want to count the 0 to 8 respectively summation,and divide by i.

 But the  seq command  R() isn't conform  with Tally command R() .

Thanks.

 

Hello.

I am trying to extract all the coefficients of a linear equation by calling coeffs function.

eq := 1.2*a[2]+1.3*a[3]+1.1*a[1]+1.0

1.2*a[2]+1.3*a[3]+1.1*a[1]+1.0

(1)

 

vars := [seq(a[i], i = 1 .. 3)]

[a[1], a[2], a[3]]

(2)

coeffs(eq, vars)

1.0, 1.2, 1.3, 1.1

(3)

``


I expected I receive the coefficients in the same order as in vars variable, but I was wrong. How to extract coefficients in the order I need?

Download test.mw

 


Dear users,

In my attached file I have two PDES, (PDE1 and PDE2). PDE1 is a function of v(t) and w(x,t) and PDE2 is also a function of v(t) and w(x,t). I can solve PDE2 if I say v(t) is 1 for example and you can see the plot. But what if I put v(t) back in PDE2 and want to find v(t) and w(x,t) from PDE1 and PDE2 together? 

Many Thanks,

Baharm31

 

Define PDE Euler-Bernoulli Beam

 

NULL

restart:

Parametrs of piezoelectric and cantilever beam

 

``

Ys := 70*10^9: # Young's Modulus structure

Yp := 11.1*10^10: # Young's Modulus pieazo

ha := -0.00125: # Position

hb := 0.001: # Position

hc := 0.0015: # Position

d31 := -180*10^(-12): # Piezoelectric constant

b := 0.01: #Width of the beam

tb := 0.002:

epsilon33 := 15.92*10^(-9):

hp :=0.00025: # Position

hpc := 0.00125: # Position

YI := b*(Ys*(hb^3- ha^3)+Yp*(hc^3-hb^3))/3: # Bending stiffness of the composit cross section

cs := 0.564: # The equivqlent coefficient of strain rate damping

ca := 0: # Viscous air damping coefficient

Ibeam := (b * tb^3 )/12: # The equivalent moment of inertia

m := 0.101: # Mass of the structure

upsilon := - Yp*d31*b*(hc^2-hb^2)/(2*hp): # Coupling term

lb := 0.57:# Length of the structure (Cantilever Beam)

lp := 0.05:# Length of the Piezoelectric

R:= 10000: # Shunted resistor

Electrical circuit equation

 

PDE1:=(epsilon33 * b*lp / hp) * diff(v(t), t) + (v(t)/R)+ int(d31*Yp*hpc*b* diff(w(x, t),$(x, 2))*diff(w(x, t), t),x = 0..lp)=0;

0.3184000000e-7*(diff(v(t), t))+(1/10000)*v(t)+int(-0.2497500000e-3*(diff(diff(w(x, t), x), x))*(diff(w(x, t), t)), x = 0 .. 0.5e-1) = 0

(1.1.1.1)

``

 

PDE Equation

 

fn := 3.8:# Direct Excitation frequency;

wb(x,t) := 0.01*sin(fn*2*Pi*t):#Direct Excitation;

plot(wb(x,t),t = 0 .. 0.25*Pi,labels = [t,wb], labeldirections = ["horizontal", "vertical"], labelfont = ["HELVETICA", 15], linestyle = [longdash], axesfont = ["HELVETICA", "ROMAN", 10], legendstyle = [font = ["HELVETICA", 10], location = right],color = black);

 

 

FunctionAdvisor(definition, Dirac(n,x));

[Dirac(n, x) = (1/2)*(Int((I*_k1)^n*exp(I*_k1*x), _k1 = -infinity .. infinity))/Pi, `with no restrictions on `(n, x)]

(1.2.1)

 

PDE2 := YI*diff(w(x, t),$(x, 4))+ cs*Ibeam*diff(w(x, t),$(x, 4))*diff(w(x, t), t)+ ca* diff(w(x, t), t) + m * diff(w(x, t),$(t, 2))+ upsilon*v(t)*(Dirac(1,x) -Dirac(1,x-lp) ) =-m*diff(wb(x, t),$(t, 2))-ca*diff(wb(x, t), t);#PDE

1.567812500*(diff(diff(diff(diff(w(x, t), x), x), x), x))+0.3760000000e-11*(diff(diff(diff(diff(w(x, t), x), x), x), x))*(diff(w(x, t), t))+.101*(diff(diff(w(x, t), t), t))+0.4995000000e-3*Dirac(1, x)-0.4995000000e-3*Dirac(1, x-0.5e-1) = 0.583376e-1*sin(7.6*Pi*t)*Pi^2

(1.2.2)

tmax := 0.3:

xmin := 0:

xmax := lb:

N := 20:#NUMBER OF NODE POINT

bc1 := dw(xmin, t) = 0:

bc2 := dw(xmax, t) = 0:

bc3 := w(xmin, t) = 0:

ic1 := wl(x, 0) = 0:

Maple's pdsolve command

 

 

 

bcs := { w(x,0)=0 , D[2](w)(x,0)=0 , w(0, t) = rhs(bc1), D[1](w)(0, t)= rhs(bc1), D[1,1](w)(lb,t) = rhs(bc2), D[1,1,1](w)(lb,t) = rhs(bc2)}; # Boundary conditions for PDE2.

{w(0, t) = 0, w(x, 0) = 0, (D[1](w))(0, t) = 0, (D[2](w))(x, 0) = 0, (D[1, 1](w))(.57, t) = 0, (D[1, 1, 1](w))(.57, t) = 0}

(2.1)

PDES := pdsolve(PDE2, bcs, numeric, time = t, range = 0 .. xmax, indepvars = [x, t], spacestep = (1/1000)*xmax, timestep = (1/1000)*tmax);

 

module () local INFO; export plot, plot3d, animate, value, settings; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; end module

(2.2)

PDES:-plot3d(t = 0 .. tmax, x = 0 .. xmax, axes = boxed, orientation = [-120, 40], shading = zhue, transparency = 0.3);

 

 

NULL


Download Euler-Bernoulli_Beam-last_version.mw

I am having problems with the curly brackets in math mode. I am using a Danish keyboard, and since changing to Maple 17, the inline evaluation (usually [CTRL]+=) has been placed as [CTRL]+[ALT]+0 which - by Maple - is interpreted the same way as [ALT-GR]+0. Unfortunately [ALT-GR]+0 is the way to get the end-bracket for curly brackets, i.e. }

Therefore, I am not able to write } in math mode. Maple interprets my keystrokes as a wish to do inline evaluation when trying to write }.

Has anyone experienced this issue - and if so: Is there a way to fix it?

Is there a way to change the shortcut keys in Maple (e.g. make an alternative shortcut for inline evaluations)?

 

restart:with(plots):with(PDEtools):

 pde:=1/r*diff(r*diff(U(r,z),r),r)+1/b^2*diff(U(r,z),z,z)=0;

ans := pdsolve(pde);

ics:=(D[1](U))(0, z) = 0,(D[2](U))(r, 0)-B*U(r,0) = 0;

bcs:=(D[2](U))(r, 1)+B*U(r,1) = B,(D[1](U))(1, z)+B*U(1,z) = 0;

B:=1:b:=1:

S:= pdsolve(pde, {bcs, ics}, numeric);

Error, (in pdsolve/numeric) unable to handle elliptic PDEs

anyway around this?

 

RIZPDE.mw

I'm writing some code that computes a positive integer N and I'd like Maple to define a function of N variables. I've tried writing 

f := (seq(t[i],i=1..N))-> MY EXPRESSION;

but I receive the error

Error, invalid parameter; functional operators require their parameters to be of type symbol or (symbol::type)

Is there anything I can do here?

a:=rand(0..8):
b:=rand(0..8):
c:=rand(0..8):
d:=rand(0..8):
e:=rand(0..8):
f:=rand(0..8):
a()+b()+c()+d()+e()+f()=8;

This is my  programming code.

I want ot set six random summation is  8. 

But the random summation can't reach 8.

Dear all,

I want to compute the charateristic polynomials of some matrices (the number of matrices is more than 10000), and write the coefficients of the resulting polynomials to a text file. The entries of the given matrices are stored in a text file. More specifically, suppose that M_1, M_2 and M_3 are three matrices, and the entries of them are stored in a text file named "data.txt" in the following form:

1 2 3

4 5 6

7 8 9

 

1 -1 0

2 3 6

-3 0 2

 

2 1 -1

1 -1 -2

0 1 2

The resulting output file should be of the following format:

1, -15, 18, 0

1, -6, 13, -28

1, -3, 1, 3

I don't know how to repeatedly read the data from the given text file. I think the procedure should be as follows.

>restart:

>with(LinearAlgebra):

>with(FileTools:-Text):

>fid:=Open("data.txt"):

>fid_1:=Open("data_1.txt"): #data_1 is the output file

>ReadFile(fid); #since the number of matrices is very large, I want the data to be read once

>numlines:=CountLines(fid);

>for i from 1 to numlines do

       here I need repeatedly read the data to a matrix M (I don't know how to do);

       P:=CharacteristicPolynomial(M,x);

       writedata[APPEND]("data_1.txt",map(i-> coeff(p, x, i), [seq(i, i = 0 .. degree(p, x))]));  #this statement cannot write the coefficients of a polynomial in the same row

>end do;

>Close(fid):

>Close(fid_1):

Now as I'm pretty new to Maple, I don't know any better and can't seem to get any information out of the help documents. 

Thanks a lot.

hi.i am a problem for solve analytic double integration as blow,plese help me....Thanks alot

int(int((2*gamma*cos(psi)/(D-r*sin(theta)*sin(phi))-2*gamma*cos(psi)/(D+r*sin(theta)*sin(phi)))*r^2*cos(theta)*sin(phi), r = 0 .. L), phi = 0 .. Pi)

 

I UPLOAD THIS INTEGRAL AS FOLLOW;;;;;int.mw

int(int((2*gamma*cos(psi)/(D-r*sin(theta)*sin(phi))-2*gamma*cos(psi)/(D+r*sin(theta)*sin(phi)))*r^2*cos(theta)*sin(phi), r = 0 .. L), phi = 0 .. Pi)

``


Download int.mw

I want to extract all the coefficients of a polynomial. For example, let p:=x^5-8x^3+2, and the function coeffs(p) returns 1, -8, 2. In fact, I want to obtain 1, 0, -8, 0, 0, 2. Thanks to everyone.

The toggle button in the embedded components has a default image which points up and down. Is there any way to rotate this image so that it points left and right?  I though I might actually just rotate the default image gif(?) directly, but the properties window does not give the location of the gif(?) used for this image. I also can't locate the image file simply looking at the Maple program folder. Otherwise, I have to go find or create an image of my own.

First 31 32 33 34 35 36 37 Last Page 33 of 61