Scott03

744 Reputation

10 Badges

14 years, 173 days

MaplePrimes Activity


These are answers submitted by Scott03

You can do what you are asking for just with your if statement so you would have something like

for m from 1 to 10 do
   for n from 2 to 11 do
      if m<>n then
         carry on with code
      end if;
   end do;
end do;

Another method is to use the the next statement.  In this case your example would be the following:

for m from 1 to 10 do
   for n from 2 to 11 do
      if m=n then next end if;
   carry on with code
   end do;
end do;

In this example, the next skips the rest of the code for the inner loop when m=n and proceds with the next iteration of the inner loop.

Scott
Application Developer
Maplesoft
 

This sort of feature doesn't exist in Maple.  You will need to click on the tab that you wish to switch to.  The only workaround is to have each worksheet in seperate Maple windows and use the short cut on your OS to switch between the program windows.

Scott

Hi Salvo,

It would be a lot easier for us to provide some hints if you give us some indication as to what you are trying to do?  It is possible that with the worksheet and an idea as to what you are trying to do, someone can make some suggestions to free up the memory or do some operations in place.

Scott
Application Developer
Maplesoft

Even though a block with that name is not currently in your model, MapleSim still has a version of the model in the palette for you to use.  Depending on the version of MapleSim you are using, this listing is in a different location.  For MapleSim 3 you can find this listing under the Project tab then go to Library Models > User.  For MapleSim 1 and 2 go to the bottom of the window, go click on "Subsystems" and look under the "User" selection.  As soon as you create a subsystem, the subsystem is copied into this selection.  This gives you the ability to drag in another copy of the subsystem without needing to recreate the model or copy and paste the subsystem.

Scott

Hi Jock84,

It is possible that dian had done the following:

  1. From within Matlab execute the command
        maple
    This command will launch a Maple worksheet that will be linked to Matlab
  2. Now execute the commands in Matlab
        >> syms x y
        >> g=int('sin(x*y)^2*x',x)
        >> setmaple('G',g)
  3. Go to the Maple workheet that had opened from step one and execute the letter G (remember that Maple is case sensitive).

 

Scott
Application Developer
Maplesoft
 

If you are wanting to put the values into a Matrix try doing this in one step with something like the following:

> Matrix(3, 3, RandomTools:-Generate(distribution(Normal(0, 1)), makeproc = true));

Scott
Application Developer
Maplesoft

If you are looking to reproduce the plot found on pages like this wiki page (http://en.wikipedia.org/wiki/Binary_entropy_function), you should note that they indicate the following on the page just below the function you quoted

"The logarithms in this formula are usually taken (as shown in the graph) to the base 2."

Therefore to get the base 2 logarithms change your function to the following

H := -p*log[2](p)-(1-p)*log[2](1-p);
plot(H, p = 0 .. 1);

 

Scott
Application Developer
Maplesoft

If you would like Maple to stop adding new execution groups after the executions, go to Tools> Options > Display and unselect the option for "Always add a new execution group after executing".  After selecting "Apply Globally", close down the current worksheet (or Maple) and you can reopen this same worksheet or a new worksheet and this option will be applied.  You will then see that you will not get more execution groups due to hitting the "!!!" button.

Scott
Applicaiton Developer
Maplesoft

Hi Alex,

Could you upload the worksheet that you are finding this by using the green arrow.  This way the Mapleprimes community can see your code and make suggestions that will have a better chance at fixing your problem.  Also, could you let us know what version of Maple you have so that we don't make a suggestion that may be in a newer version of Maple.

Scott
Application Developer
Maplesoft

It appears that the problem that you are finding is expected.  In the help page for convert,unit_free you will find that it states

Conversion to unit-free does not apply directly to any non-scalar Maple object or data structure, which may still have units embedded within it.

For this example you can get around this limitation by using the following command that will map the convert on the piecewise

map(convert, simplify(`&sigma;b`(`&epsilon;`)), unit_free);

Is this what you are looking for?

 

Scott
Application Developer
Maplesoft

How about this

A:=Array(0..2,0..2, fill=0):
B:=Array(0..2,0..2, fill=0):
for i from 0 to 2 do
for j from 0 to 2 do
    A[i,j]:=i+j:
    B[i,j]:=i-j:
od: od:

A+B;
 

The result will be something like

Array(0 .. 2, 0 .. 2, {(1, 0) = 2, (1, 1) = 2, (1, 2) = 2, (2, 0) = 4, (2, 1) = 4, (2, 2) = 4}, datatype = anything, storage = rectangular, order = Fortran_order)

Any entries in the Array that don't show up are 0.

Scott
Application Developer
Maplesoft

It is possible that something has happened to your Maple installation.  I would try to uninstall Maple 13 and reinstall it on the computer.  If you are still having problems, I would suggest that you contact Maplesoft Technical Support.

Scott

Try changing your array to the newer Array structure.

crossArea := 3.2*19.1;
force := Array([0., 1380.0, 2780.0, 5630.0]);
engineeringStress := force/crossArea;
engineeringStress[1].({0., 1380.0, 2780.0, 5630.0}/crossArea);

 

Scott
Application Developer
Maplesoft

One option to do this is pass the plot command with a list of functions of the form k*x with k being subsituted.

plot([seq(k*x,k in [2,4,8,10])],x=-5..5, legend=[2,4,8,10]);

Here the seq command (see ?seq help page for more information on this) to substitute the k values into the function.  You can either have 'k in [2,4,8,10]' if you have a list of values you wish to use, or if you just want a range of values, you can use 'k =2..10' or 'k=2..10,2'.

Scott
Applicaiton Developer
Maplesoft

latentcorpse's questions:

In principle I think this should be pretty easy. I need to make a MAPLE code that uses loops and arrays to carry out the procedure described here: http://people.revoledu.com/kardi/tutorial/ContinuedFraction/Decimal-Fraction-Conversion.htm

frac:=proc(x,Kmax,epsilon)
  local Kmax, epsilon:
    P:=Array(-1..Kmax-2):
    P[0]:=floor(x), P[-1]:=1:
   Q:=Array(-1..Kmax-2):
    Q[-1]:=0, Q[0]:=1:
    F:=Array(1..Kmax):
    a=floor(x):
    while i < Kmax and F[i]<epsilon do
    r=x-a
      y=1/r
      P[i]:=a*P[i-1]+P[i-2]:
      Q[i]:=a*Q[i-1]+Q[i-2]:
      F[i]:=P[i]/Q[i]:
  end do:
end proc:

i don't really understand why it's not working although i think it's to do with y and r.

any help appreciated. thanks.

 

2 3 4 5 6 7 8 Last Page 4 of 30