Adri van der Meer

Adri vanderMeer

1400 Reputation

19 Badges

20 years, 136 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

MaplePrimes Activity


These are answers submitted by Adri van der Meer

...it is automatically filled with zeros on the empty places:

restart;
a1:=[1,2]:
a2:=[5,3,4,5]:
a3:=[4,8,4,5,3,2,3,4,5]:
a4:=[2,2,5,4,7,8]:
b := Matrix([seq(a||i,i=1..4)]);
B1 := b[..,1]; #first column
# etc. If you want to remove the zeros:
convert(b[..,5],list); B5 := remove(x->x=0, %);

 

restart;

Next line: choose 2D input, "×" symbol from palette; select the whole expression; Format→Convert to→Atomic Identifier (or Ctrl-Shift A)

`#mrow(mi(

`#mrow(mi(

(1)

In the next line: make an alias so you can type "axb" whenever you want "a×b" displayed

alias( %=axb ):

avector:=Vector(3,symbol=a):

bvector:=Vector(3,symbol=b):

axb := LinearAlgebra:-CrossProduct(avector,bvector);

 

`&x`(a, b) := Vector(3, {(1) = a[2]*b[3]-a[3]*b[2], (2) = a[3]*b[1]-a[1]*b[3], (3) = a[1]*b[2]-a[2]*b[1]})

(2)

 

 

Download AtomicIdentifier.mw

Alternative (if you really don't want to use the menu or the palette):

alias( `#mrow(mi("a"),mo("×"),mi("b"))`=axb);

...to make g such that g(sigma^2) yields the expression in the question?

f := 1/sqrt(1/3*q^2*sigma^2/Pi^2);
g := unapply( eval(f,sigma=sqrt(x)), x ): g(sigma^2);

This means that the limit doesn't exist (it is +∞). Bacuase you are using floats, maple makes a numerical approxximation. To make an exact calculation:

f := convert( LommelS1(4.04, 3.04, z)/z^5.04, rational );
limit( f, z=0 );

equ := 0 = -32*sigmas^2*ups*rp/(R*T)^2*(2/ln(S(x))^3)*(diff(ln(S(x)), x)) + 
   (1/2)*x*(sqrt(K(x)/S(x))*(diff(S(x), x))+sqrt(S(x)/K(x))*(D(K))(x))+sqrt(S(x)*K(x));

(thanks to Markiyan for the idea of the logplot)

restart;
A := [[0.5e-1, 2.7], [.1, 6.8], [.15, 12.7], [.2, 1100]]:
B := [[0.5e-1, 3.2], [.1, 7.4], [.15, 13.7], [.2, 1110.5]]:
p1 := plot([A, B], style=point, color=[red,blue], symbol = [diamond,cross], symbolsize = 30):
p2 := plot([A,B], color=[red,blue] ):
plots:-display({p1,p2}, axes=boxed, axis[1, 2] = [mode = log] );

n:=readstat("Input n:"):
A:=Matrix(n,n,0): # use Matrix, not matrix
for i from 1 to n do
for j from 1 to n do
A[i,j]:=readstat('A'[i,j] );
od;
od;
A;

What happened with your worksheet? I see semicolons in the first line, but no output.

With this worksheet: LaTeX.mw I get LaTeX.txt (I changed the *tex file to a *.txt file bacause I cannot upload tex-files). Note that I used Maple input in the worksheet.
With 2D input I get LaTeX2D.txt, which is also perfect.

Perhaps in older versions of Maple, the 2D input is not supported?

I observe the following:
(1)  p(max(m))=p(max(n)): you don't give a value for this, so I suppose it is random.
(2)  the list n has more elements than the list m; I make both lists random.

Than a table that satisfies all the requirements can be made as follows:

restart;
m := convert(LinearAlgebra:-RandomVector(6),list);
n := convert(LinearAlgebra:-RandomVector(10),list);
p[0]:=0:
p[max(m)] := rand();
p[max(n)] := p[max(m)];
M := [seq( sort(m)[i], i=1..nops(m)-1 )];
N := sort(n);
for i to nops(M) do p[M[i]]:= N[i] end do:
eval(p);

(1) This is the adjacency matrix of your network (graph). See ?AdjacencyMatrix in the GraphTheory package

(2) To get the vector of row totals you can take the matrix-vectorproduct of this adjacency matrix with a vector consisting of ones:

A := LinearAlgebra:-RandomMatrix(10, generator=0..1 );
v := A.Vector(10,fill=1);

To get the ranking vector:

u := Statistics:-Rank(v,order=descending);

The "and" construction isn't necessary in a piecewise function, because x<1, y1, x<x2, y2,x<x3,y3, y4 means:
if x<x1 then y1
elif x<x2 then y2
elif x<x3 then y3
else y4
end if

(you missed the else-clause)

Now we can construct the sequence tu use in a piecewise definition: (I generate random X and Y lists)

restart;
N := 5:
Y := [seq( randpoly(x,degree=2), i=1..N )]:
X := sort( [seq(RandomTools:-Generate(float(range=1..10.0), digits=2), i=1..N)] ):
H := ListTools:-Flatten( [seq( [x<=X[i],Y[i]], i=1..N )] ):
yp := piecewise( x<=0, 0, op(H), 0 );

You have (converted to Maple input):

f(x[]):=Re( add(Ei(z(n)*ln(x)), n=1..10)):

This has to be:

f := x -> Re( add(Ei(z[n]*ln(x)), n=1..10)):

Now you can calculate

 f(0.5);
                         0.01259288459
limit(f(x),x=1);
                        -Float(infinity)
plot(f, 0..0.1 );

What is Q? How can - h124 y  - h124 appear in the output ( it should automatically be simplified to
-2* h124*y). Please privide us with the output of lprint(Q);

Q := <3, 1 - h121 - h124*y  - h124*y - h125*x + h125*y>:
lprint(Q);
Vector[column](2, {1 = 3, 2 = -2*h124*y-h125*x+h125*y-h121+1}, datatype = anything,
storage = rectangular, order = Fortran_order, shape = [])
rtable_num_elems(Q);
                               2

Your cc is a list of vectors, so not a matrix. If you want a Matrix with given vectors as columns, you can do

g1 := Vector([0, y, x]):
g2 := Vector([0, y^2-x-y, 0]):
g3 := Vector([x, x+y, 0]):
g4 := Vector([y, -y, 0]):
g5 := Vector([0, x*y+x/2+y/2, 0]):
g6 := Vector([0, x^2-x/4-y/4, 0]):
cc := <g1|g2|g3|g4|g5|g6>;
cc[1,1..-1]; # First row

Maple cannot find a solotion to the IVP (but I get an other errormessage)

restart;
de := (1/4)*U*(diff(S(y)^4, `$`(y, 2))) =
   C*P1*((O*exp(G*y)-R*exp(J*y))/(P1*(exp(J*L)-exp(G*L)))+P2/P1):
sol := dsolve({de, S(0) = .1, S(v) = 0, (D(S))(0) = 0, (D(S))(L) = 0}, S(L));
sol :=
Y := rhs(sol);
Error, invalid input: rhs expects 1 argument, but received 0


First 12 13 14 15 16 17 18 Last Page 14 of 27