MaplePrimes Questions

Hi there, this is my first post in this forum. I hope you can help me with my problem :)

I've created a little program to solve a problem for my class. This is the first time, I wrote a program with Maple, so please don't laugh. 

I've posted the Maple code below:

 

restart; randomize():
with(plots): with(plottools): with(LinearAlgebra): with(Statistics): with(MTM):

s:={1=2, 3=2}:

 

Realisierung:=proc(np,volfrac)

local m, h, adresses, rndmAdrs, omega: omega:=Vector[row](np,s);

adresses:=Vector(np-nops(s));

h:=1;
for m from 1 to np do
if(omega[m]=0) then
adresses[h]:=m;
h:=h+1;
end if
od;

randomize():
rndmAdrs:=Shuffle(adresses);

for m from 1 to volfrac*np do
omega[rndmAdrs[m]]:=1
od:

for m from 1 to np -(volfrac*np+nops(s)) do
omega[rndmAdrs[m+int8(volfrac*np)]]:=2
od:

omega;

end:

 


RealMatrix:=proc(np,nr,volfrac)

local m, alle:

alle:=Matrix(nr,np); for m from 1 to nr do

randomize();

alle[m]:=Realisierung(np,volfrac); od;

alle;

end:

RealMatrix(5,5,0.4);

 

I used the Shuffle function from Statistics-package to randomly permutate the components in the Vector adresses. Which works fine. By setting Randomize(); I get randomly results vor this permutation, when I execute the whole worksheet.

But when the "Realisierung" procedure is called in the for loop of the "RealMatrix" procedure, always the same Permutation is calculated.

This leads to the fact, that every row in my matrix looks the same.
Like in the example

2 1 2 2 1
2 1 2 2 1
2 1 2 2 1
2 1 2 2 1
2 1 2 2 1

but the lines should be randmly like

2 1 2 2 1
2 2 2 1 1
2 1 2 1 2
2 1 2 2 1
.....

 

Obvioulsy the problem is in the randomize()-command. I tried to place it directly after "restart" and directly before the Shuffling is executed.
But I had no succes. 

Maybe one of you can help me?
Would be great!
Thanks

 

 

 

 

 

 

restart;
a=1-(1+x)*exp(-x);
SS:=solve(%,x,allsolutions);
evalf(eval(SS,[_Z2=0,a=0.3]));evalf(eval(SS,[_Z2=-1,a=0.3]));

I know there are two branches for the lambertw function meet my demand.

I wonder whether there is a method to find the _Z2 value with SS::real, for the above commands, they are 0&-1.

thank you for any advice.

How to avoid the error described in the title

 

Hi All,

I want to solve for G, but cant seem to figure it out. Can anyone tell me what am I missing or doing wrong?

 

SSD:= ((155/9)*2.5)+((155/9)^2/(2*9.807*0.346));
Lc:= 2*SSD-(2*(sqrt(1.08)+sqrt(0.6))^2)/(G+0.04);
Ls:= 2*SSD-(2*(0.6+SSD*tan(Pi/180)))/(G);
Lcon:= 202-Lc-Ls;
Eq:= (G-0.043)(Lc/2)+(-G)(Ls/2)+G*Lcon-0.043*Lc=14;


fsolve(Eq);

 

thank you

Hi everyone!

I'm curious how to obtain in Maple 2015 same result as in Maple 18.

Here is my code:

restart:

L0 := ImportMatrix("C:\\Test.txt", source = delimited, delimiter = "\t", datatype = float[8]):

plot(L0[() .. (), 1], L0[() .. (), 2], axes = box, size = [600, 320]);

This is result which I get by Maple 18:

This is result which I get by Maple 2015:

 

My Test file:Test.txt

bags.mw

$15 is spread among four different bags. How  can you can make any whole number of dollars from $1 to $15 by selecting some of these bags of money, without taking any money out of the bags.
 
How is the money distributed ?

One bag must have $1 in it.
To be able to make $2, and each bag is different, so one bag must have $2 in it.
 can now make $3, but can’t make $4, so the third bag must have $4 in it.
With $1, $2 and $4 in three bags, can make every total up to $7. The last bag has the rest of his money in it – $8.

so the answer is $[1,2,4,8]

wondering how to do this with maple procedure. unsurprisingly my code doesn't work

 

 

I want to increase the stack limit. but i can not raise it above the hard limit....

 

so i wonder whether there is a way to increase the hard limit, or at least tell me how much is it?

Why nothing changes?

I tried to use java to call maple command, but end up jvm crash. after some digging, i found the command i issued returned a rather huge string (around 40KB...).

 

Is this the reason why jvm crash? should i constrant the length of a command result when calling it from Java code?

I am writing here because of a problem with writing mathematical expressions in Maple T.A.. I have been using it since two years, and I have a lot if questions created in version 9.0 and 9.5. A few months ago my university installed T.A. 10. At the beginning there were problems with the connections between T.A. and the Maple server. After the administrators got over these, there were another problems.

There are a lot of questions where I use greek letters, for example Sigma. Earlier it was easy, I wrote

in the 'Algorithm' section, and I could write

in the Text of the question. The letter had a perfect italic and bold style, like as it would be created with Equation Editor.

Now I have to write

sig2=maple("MathML:-ExportPresentation($sig1)");

Could someone help me understand what is happening to this procedure. When I run it, I get the subject error. Thanks.

game := proc()
  local player1, player2, roll;
  roll := rand( 1..6 );
  player1 := roll():
  player2 := roll(2):
  if player1>player2 then "A wins"
  elif player1=player2 then "Tie"
  else "B wins"
  end if;
end proc:

Derive the orbit of the Moon around the Earth by doing a Verlet algorith of Molecular Dynamics simulation. Use one hour for your step τ. Place the stationary Earth at the origin of the Cartesian system. For initial conditions, use the position and the speed of the Moon when it is at its apogee (furthest from Earth). Plot the orbit.

Dear friends.

I need a simple approach for reading a specified line of a text file.

FileTools[Text] module allows to count the lines. By sequential reading of lines it's possible to reach any position in the file. But for large file this takes a lot of time.

FileTools[Position] allows to set/get position in the file, but the position is counted in bytes.

Are there any workarounds for the problem or the use of Database Package is more preferable?

Using with(Physics):

On an initial condition setting for using dsolve when I do D(theta)(0) it returns  0=0

I'll have to check tonight if it's a mistake on my part.  But perhaps that is supposed to happen.

Hello,

please help check what's wrong with this code. I need the analytic solution and convert to Bessel but return error. Here is the worksheet ID_1.mw

Best regards.

First 1276 1277 1278 1279 1280 1281 1282 Last Page 1278 of 2430