gkokovidis

2370 Reputation

13 Badges

20 years, 288 days
Draeger Medical Systems, Inc.

 

 

Regards,
Georgios Kokovidis
Dräger Medical

MaplePrimes Activity


These are answers submitted by gkokovidis

A couple of issues.  First, you are using commands from both the LinearAlgebra and linalg packages.  linalg has been deprecated.  Second, the package needs to be loaded using the "with" command, or you can use the short form of the command.  See help page here for an explanation.

restart:with(linalg):

k:=randmatrix(3,3);

j:=swapcol(k,1,3);

k := Matrix(3, 3, {(1, 1) = -7, (1, 2) = 22, (1, 3) = -55, (2, 1) = -94, (2, 2) = 87, (2, 3) = -56, (3, 1) = 0, (3, 2) = -62, (3, 3) = 97})

 

array( 1 .. 3, 1 .. 3, [( 2, 3 ) = (-94), ( 2, 2 ) = (87), ( 3, 2 ) = (-62), ( 3, 1 ) = (97), ( 1, 1 ) = (-55), ( 3, 3 ) = (0), ( 1, 2 ) = (22), ( 1, 3 ) = (-7), ( 2, 1 ) = (-56)  ] )

(1)

restart:with(LinearAlgebra):

k:=RandomMatrix(3);

k := Matrix(3, 3, {(1, 1) = 27, (1, 2) = 99, (1, 3) = 92, (2, 1) = 8, (2, 2) = 29, (2, 3) = -31, (3, 1) = 69, (3, 2) = 44, (3, 3) = 67})

(2)

ColumnOperation(k, [1,3]);

Matrix([[92, 99, 27], [-31, 29, 8], [67, 44, 69]])

(3)

 

Download column.mw

Regards,

Georgios Kokovidis

Dräger Medical

You can determine the speed difference yourself, to see which is better, based on how many values you need to calculate.  I ran both of your code segement twice.  The time difference will vary based on machine speed and memory.  For small values of i, <100000, the time difference between the two versions is not noticeable.

restart:st := time():

for i from 1 by 1 to 5000000 do

randomize():

rand()/(1000000000000.);

end do:

time() - st;

98.485

(1)

restart:with(RandomTools[MersenneTwister]):st := time():

for i from 1 by 1 to 5000000 do

randomize():

GenerateFloat();

end do:

time() - st;

81.640

(2)

restart:st := time():

for i from 1 by 1 to 5000000 do

randomize():

rand()/(1000000000000.);

end do:

time() - st;

97.234

(3)

restart:with(RandomTools[MersenneTwister]):st := time():

for i from 1 by 1 to 5000000 do

randomize():

GenerateFloat();

end do:

time() - st;

 

83.578

(4)

 

Download randtime.mw

 

Regards,

Georgios Kokovidis

Dräger Medical

This thread might answer your question.

 

Regards,

Georgios Kokovidis

Dräger Medical

See help page here.

From within Maple, you can access it this way:

?Student[LinearAlgebra][SwapRow]

Regards,

Georgios Kokovidis

Dräger Medical

Here is one way.

MM:=<IQ|DT>:

ExportMatrix("C:/temp/Data2.dat", MM, target = Matlab, format = rectangular, mode = ascii):

This will concatenate your two Vectors and Export them to a file called Data2.dat in the C:\temp directory on a PC running Windows.
 

Regards,

Georgios Kokovidis

Dräger Medical

restart:

int(lambda/(A+B*lambda)^2,lambda=0..1) assuming A::positive, B::positive;

-(ln(A)*A+ln(A)*B+B-ln(A+B)*A-ln(A+B)*B)/(B^2*(A+B))

(1)

 

Download integ.mw

Regards,

Georgios Kokovidis

Dräger Medical

See this thread, and try setting smartview=false in your plot command.  If that doesn't work, then upload your whole worksheet.  I noticed that you are using the command with(linalg), which is deprecated.  The one to use would be with(LinearAlgebra), so there might be something ahead of the plot command that is confusing it, because of the "enhanced" plotting features in Maple 16.

 

> plot(cos((1/2)*x)+sin(2*x), x = 0 .. 4*Pi, smartview=false);

Regards,

Georgios Kokovidis

Dräger Medical

I don't have Maple 16 loaded on my home machine yet.  This was done with Maple 15.  Download the file and see if it runs without errors on Maple 16.

restart:

plot(cos((1/2)*x)+sin(2*x), x = 0 .. 4*Pi);

 

 

Download plots.mw

 

Regards,

Georgios Kokovidis

Dräger Medical

Another option would be to use fsolve with range parameters.  I'm not sure I typed the equations correctly. 

>eq1:=H=(v[0]*sin(theta[0])*(v[0]*sin(theta[0])+y[0]))/g-(v[0]*sin(theta[0])+y[0])^2 /(2*g)+y[0];

>eq2:=y[0]=((R^2*g)/(2*(v[0]*cos(theta[0]))^2))-R*tan(theta[0]);

>g:=9.81:v[0]:=200:H:=100:R:=100:

> fsolve({eq1,eq2},{y[0]=0..100,theta[0]=0..100});


{theta[0] = 46.89329035496190753,

y[0] = 24.77141685501522015}

 

Regards,

Georgios Kokovidis

Dräger Medical

There is a multiplication sign missing between the x and the y.

restart:

with(VectorCalculus):

SetCoordinates('cartesian'[x, y, z]);

cartesian[x, y, z]

(1)

Del(x*y);

Vector[column]([[y], [x], [0]], ["x", "y", "z"], "field")

(2)

Del(xy);

Vector[column]([[0], [0], [0]], ["x", "y", "z"], "field")

                     (3)

 

 

Download Del.mw

 

Regards,

Georgios Kokovidis

Dräger Medical

See help file here as a starting point.

 

Regards,

Georgios Kokovidis

Dräger Medical

Add a multiplication sign after your constants and try again.

evalf(invlaplace (15/(s^3 + 6*s^2 + 15*s + 15), s, t));

 

Regards,

Georgios Kokovidis

Dräger Medical

See the following link.  Using 314159265 as the searc string, it  returned:

The numeric string 314159265 appears at the 70,326,148th decimal digit of E.  Knowing this, you can try it in Maple, using the code provided.  I would not recommend it on a laptop, which is what I am using @ home.

Regards,

Georgios Kokovidis

Dräger Medical

Here is a short example that you can modify to get you started.

restart:with(StringTools):

evalf(exp(1),2000):

aa:=convert(%,string):

Search("314", aa);

858

                                             (1)

 

Download search.mw

 

Regards,

Georgios Kokovidis

Dräger Medical

Replace the curly brackets {} in equations e1-e9 and you should be al set, at least for the

Warning, solutions may have been lost part.

restart:

e1 := (1/2)*alpha[2]^2+6*delta*alpha[2];

 

e2 := alpha[2]*alpha[1]+delta*(10*alpha[2]*lambda-20*alpha[2]*d+2*alpha[1]);

 

e3 := -V*alpha[2]+(1/2)*alpha[1]^2+alpha[2]*alpha[0]+delta*(8*alpha[2]*(d^2-lambda*d+mu)+3*alpha[1]*(lambda-2*d)+(4*alpha[2]*lambda-8*alpha[2]*d)*(lambda-2*d));

 

e4 := -V*alpha[1]+alpha[2]*alpha[-1]+alpha[1]*alpha[0]+delta*((4*alpha[2]*lambda-8*alpha[2]*d+2*alpha[1])*(d^2-lambda*d+mu)+(2*alpha[2]*d^2-2*alpha[2]*lambda*d+2*alpha[2]*mu+alpha[1]*lambda-2*alpha[1]*d)*(lambda-2*d));

 

e5 := C-V*alpha[0]+(1/2)*alpha[0]^2+alpha[1]*alpha[-1]+alpha[2]*alpha[-2]+delta*((2*alpha[2]*d^2-2*alpha[2]*lambda*d+2*alpha[2]*mu+alpha[1]*lambda-2*alpha[1]*d)*(d^2-lambda*d+mu)+alpha[-1]*(lambda-2*d)+2*alpha[-2]);

 

e6 := -V*alpha[-1]+alpha[0]*alpha[-1]+alpha[1]*alpha[-2]+delta*((alpha[-1]*lambda-2*alpha[-1]*d+6*alpha[-2])*(lambda-2*d)+2*alpha[-1]*d^2-2*alpha[-1]*lambda*d+2*alpha[-1]*mu);

 

e7 := -V*alpha[-2]+(1/2)*alpha[-1]^2+alpha[0]*alpha[-2]+delta*((alpha[-1]*lambda-2*alpha[-1]*d+2*alpha[-2])*(d^2-lambda*d+mu)+(2*alpha[-1]*d^2-2*alpha[-1]*lambda*d+2*alpha[-1]*mu+4*alpha[-2]*lambda-8*alpha[-2]*d)*(lambda-2*d)+6*alpha[-2]*d^2-6*alpha[-2]*lambda*d+6*alpha[-2]*mu);

 

e8 := alpha[-1]*alpha[-2]+delta*(2*alpha[-1]*(d^2-lambda*d+mu)^2+(4*alpha[-2]*lambda-8*alpha[-2]*d)*(d^2-lambda*d+mu)+6*alpha[-2]*(lambda-2*d)*(d^2-lambda*d+mu));

 

e9 := (1/2)*alpha[-2]^2+6*delta*alpha[-2]*(d^2-lambda*d+mu)^2;

 

solve({e1, e2, e3, e4, e5, e6, e7, e8, e9}, [alpha[2], alpha[-2], alpha[0], alpha[1], alpha[-1], V, C]);

 

(1/2)*alpha[2]^2+6*delta*alpha[2]

 

alpha[2]*alpha[1]+delta*(10*alpha[2]*lambda-20*alpha[2]*d+2*alpha[1])

 

-V*alpha[2]+(1/2)*alpha[1]^2+alpha[2]*alpha[0]+delta*(8*alpha[2]*(d^2-lambda*d+mu)+3*alpha[1]*(lambda-2*d)+(4*alpha[2]*lambda-8*alpha[2]*d)*(lambda-2*d))

 

-V*alpha[1]+alpha[2]*alpha[-1]+alpha[1]*alpha[0]+delta*((4*alpha[2]*lambda-8*alpha[2]*d+2*alpha[1])*(d^2-lambda*d+mu)+(2*alpha[2]*d^2-2*alpha[2]*lambda*d+2*alpha[2]*mu+alpha[1]*lambda-2*alpha[1]*d)*(lambda-2*d))

 

C-V*alpha[0]+(1/2)*alpha[0]^2+alpha[1]*alpha[-1]+alpha[2]*alpha[-2]+delta*((2*alpha[2]*d^2-2*alpha[2]*lambda*d+2*alpha[2]*mu+alpha[1]*lambda-2*alpha[1]*d)*(d^2-lambda*d+mu)+alpha[-1]*(lambda-2*d)+2*alpha[-2])

 

-V*alpha[-1]+alpha[0]*alpha[-1]+alpha[1]*alpha[-2]+delta*((alpha[-1]*lambda-2*alpha[-1]*d+6*alpha[-2])*(lambda-2*d)+2*alpha[-1]*d^2-2*alpha[-1]*lambda*d+2*alpha[-1]*mu)

 

-V*alpha[-2]+(1/2)*alpha[-1]^2+alpha[0]*alpha[-2]+delta*((alpha[-1]*lambda-2*alpha[-1]*d+2*alpha[-2])*(d^2-lambda*d+mu)+(2*alpha[-1]*d^2-2*alpha[-1]*lambda*d+2*alpha[-1]*mu+4*alpha[-2]*lambda-8*alpha[-2]*d)*(lambda-2*d)+6*alpha[-2]*d^2-6*alpha[-2]*lambda*d+6*alpha[-2]*mu)

 

alpha[-1]*alpha[-2]+delta*(2*alpha[-1]*(d^2-lambda*d+mu)^2+(4*alpha[-2]*lambda-8*alpha[-2]*d)*(d^2-lambda*d+mu)+6*alpha[-2]*(lambda-2*d)*(d^2-lambda*d+mu))

 

(1/2)*alpha[-2]^2+6*delta*alpha[-2]*(d^2-lambda*d+mu)^2

 

[[alpha[2] = 0, alpha[-2] = 0, alpha[0] = alpha[0], alpha[1] = 0, alpha[-1] = 0, V = V, C = V*alpha[0]-(1/2)*alpha[0]^2], [alpha[2] = -12*delta, alpha[-2] = 0, alpha[0] = alpha[0], alpha[1] = -12*delta*lambda+24*delta*d, alpha[-1] = 0, V = -12*delta*lambda*d+12*delta*d^2+delta*lambda^2+8*delta*mu+alpha[0], C = -12*alpha[0]*delta*lambda*d+12*alpha[0]*delta*d^2+alpha[0]*delta*lambda^2+8*alpha[0]*delta*mu+(1/2)*alpha[0]^2+72*delta^2*d^4-144*delta^2*d^3*lambda+96*delta^2*d^2*mu+84*delta^2*lambda^2*d^2-96*delta^2*lambda*d*mu+24*delta^2*mu^2-12*delta^2*lambda^3*d+12*delta^2*mu*lambda^2], [alpha[2] = 0, alpha[-2] = -12*delta*(d^2-lambda*d+mu)^2, alpha[0] = alpha[0], alpha[1] = 0, alpha[-1] = 12*(2*d^3-3*lambda*d^2+lambda^2*d+2*d*mu-lambda*mu)*delta, V = -12*delta*lambda*d+12*delta*d^2+delta*lambda^2+8*delta*mu+alpha[0], C = -12*alpha[0]*delta*lambda*d+12*alpha[0]*delta*d^2+alpha[0]*delta*lambda^2+8*alpha[0]*delta*mu+(1/2)*alpha[0]^2+72*delta^2*d^4-144*delta^2*d^3*lambda+96*delta^2*d^2*mu+84*delta^2*lambda^2*d^2-96*delta^2*lambda*d*mu+24*delta^2*mu^2-12*delta^2*lambda^3*d+12*delta^2*mu*lambda^2]]

(1)

 

Download brackets.mw

 

Regards,

Georgios Kokovidis

Dräger Medical

First 10 11 12 13 14 15 16 Last Page 12 of 75