dharr

Dr. David Harrington

5076 Reputation

21 Badges

19 years, 94 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a professor of chemistry at the University of Victoria, BC, Canada, where my research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are replies submitted by dharr

@dharr The Print routine for Iterator:-Combination incorrectly shows zero-relative ranks, which led to a duplcate partition in my original code. (SCR submitted.)

restart

M := Iterator:-Combination(4, 2)

_m1640374251104

Following suggests rank starts at 0

Print(M, showrank)

0: 0 1
1: 0 2
2: 1 2
3: 0 3
4: 1 3
5: 2 3

But actually it starts at 1

for i in M do
  Rank(M),i;
end do;

1, Vector[row](2, {(1) = 0, (2) = 1})

2, Vector[row](2, {(1) = 0, (2) = 2})

3, Vector[row](2, {(1) = 1, (2) = 2})

4, Vector[row](2, {(1) = 0, (2) = 3})

5, Vector[row](2, {(1) = 1, (2) = 3})

6, Array(%id = 36893489787840041436)

So to get only the second half, start with rank 4, not 3.

NULL

Download IteratorRank.mw

@Oliveira Here it is with the syntax error fixed.

TravelingSalesperson.mw

@PaulNewton You launcher worksheet idea is possible. See ?DocumentTools,RunWorksheet. Then the code following a successful "return" from the launched worksheet does not execute. The launched worksheet runs "headless", meaning that some of its interface functions are not running, so it may not do what you want. 

@mmcdara The original question seemed more about 1-D vs 2-D, so I wasn't thinking much about efficiency. There has been some discussion on how to speed up cartesian products, so I'm not surprised that it is slower:

https://www.mapleprimes.com/posts/41838-Cartesian-Products-Of-Lists

@merinoises Tom's solution just rearranges the equations and then uses the default Runge-Kutta numerical solver. Maple should have been able to do automatically what Tom did, which is why I submitted a bug report. method = laplace is not a numerical method to solve odes, but rather an exact method. It gives the solutions as sums of exponentials, where the exponential decay constants are the roots of a polynomial (related to the eigenvalues of the coefficient matrix). Since you wanted only numerical answers, I just put evalf around the answer, which numerically solved for the polynomial roots and gave numerical functions that are the solutions. In principle the laplace method is more accurate, and could be used with large settings of Digits.

@sursumCorda Agreed. There does seem to be quite a literature on this and the algorithms are quite complicated - hopefully Maple will improve in this respect.

See Wikipedia or Ref 2 on that page: doi: 10.1007%2F3-540-44969-8_5

@nm I agree with the general comments. It would be really useful if solve gave more regular information through the infolevel/userinfo mechanism. In this example setting infolevel for solve to 9 gives information for a while, but then nothing later on. So when it freezes you don't really know if it is actually working and can't be interrupted, or has died because of a bug.

After a few minutes of nothing I usually conclude that there is a bug. Occasionally if I really want a result, I will run something overniight. This rarely (never?) leads to success, yet if I had some indication it might still work, I would be happy to try for longer.

@PaulNewton I agreed with the your above behavior, and then got it back to tabbing through again. I think the key is to set tab navigation OFF, and then restart Maple so it is off when you load the worksheet. Sorry for the confusion since you did say you had tab navigation on.

@PaulNewton I hadn't checked the tabbing until you asked about it. I don't find that tab creates a new line. I agree in general that tabbing isn't convenient like in, say, Visual Basic, and using table cells for containing components lacks precision. On the other hand, it works for inputting a variety of inputs of different types, where one column has cells with math expressions in describing the input and then the next column has a text area for the actual input.

@PaulNewton Try changing the pKb values.

TextAreaPN.mw

1. and 2. 

Your can format numbers into strings using sprintf - see the content changed code for examples.

3.

You can't tab when the cursor is in a text box, but you can if it is not. Put the cursor to the left of the first text box and then try it. It tabs through the cells with txt boxes.

@PaulNewton So it seems you can cut and paste an empty plot component, but once it has a plot in it, it pastes as a regular plot and is not a plot component any more.

@Ronan Seems to be working. Just after those steps it returns to the initial state.

Q_24-12-22_NeighborArray.mw

@Ronan The error is because you are trying to alter the value of poplist that you passed in to the procedure. One way to fix this is to have the procedure return the updated list, and work on a copy.

Mutate1 := proc(vtx,poplist)
  description " Mutates population at a vertex";
  local i,mypoplist;
  global V,Nbs; 
  mypoplist:=poplist;
  print(vtx, "Pop at Vertex =  ",mypoplist[V[vtx]]);
  mypoplist[V[vtx]] := -mypoplist[V[vtx]] + add(mypoplist[i],i=[op(Nbs[V[vtx]])]);
  print(vtx,"Mutated Pop =  ", mypoplist[V[vtx]]);
  mypoplist
 end proc:

and then use it by

newerPopvs:=Mutate1(x,newPopvs)

 

@PaulNewton The image you showed has borders (and menu) for a selected regular plot (little squares at the corners and at the centres of the edges). A selected plot component has different borders. 

@Carl Love Thanks.

First 13 14 15 16 17 18 19 Last Page 15 of 49