dharr

Dr. David Harrington

7720 Reputation

22 Badges

20 years, 240 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 retired professor of chemistry at the University of Victoria, BC, Canada. 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

@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.

@Ronan Thanks for pointing that out. The help says "Tables created with a list initializer, for example, table([a=A, b=B, c=C]), are created such that the assignment of the table entries proceeds from left to right.  That is, the first element of the list is inserted into the table first, the second is inserted second, and so on." But assigning them in that order separately as on the attached works differently, and as I would expect.

I think converting the tables to lists preserves the order in eval(Popvs), though perhaps I should have some more robust code for that as well. Edit: fixed so now either initialization method works.

Q_23-12-22_Test_Graph_indices4.mw

@zenterix If I copy @Carl Love's code, click on your document to start new input, type ctrl-M (cmd-M on Mac) and then paste it in, it works. 

code.mw

Edit: here is a 2-D version. I separated the restart and interface lines out from the proc. For the  `print/Trans` and Trans(M) .%  M lines I entered them in 1-D and converted to 2-D input with the right-click menu.

code2d.mw

@Otttimor @mmcdara uses the usual output from dsolve, and converts it to a vector. Another way would be to use the output=Array option of dsolve. I would use Norm from the LinearAlgebra package, or just add.

@Otttimor Maybe the meaning of 2-norm isn't clear to you? If that is the case, maybe this will help.

restart

Take Rouben's two sets of numbers - one could be from a simulation, the other could be from experiments

vals1 := Vector([1, 3, 5, 6, 6, 6, 7, 5, 3]); vals2 := Vector([1, 3, 4, 5, 6, 8, 7, 4, 4])

The most common measure of deviation would be to take the differences, square them and add them up.

This residual sum of squares (RSS) would be what would be minimized in a least-squares fit.

RSS := add((vals1[i]-vals2[i])^2, i = 1 .. numelems(vals1))

8

Shorter form

RSS2 := add(`~`[`^`](vals1-vals2, 2))

8

The square root of this is also a measure of the deviation. In linear algebra, summing the squares of the entries of a vector and taking the square root is called the  l__2 norm (or just 2-norm) or Euclidean norm.

dev := sqrt(RSS); dev2 := LinearAlgebra:-Norm(vals1-vals2, 2)

2*2^(1/2)

2*2^(1/2)

The p-norm (for any p >= 1) raises  the absolute value of each entry to the power of p, adds them and then takes the pth root (raises to power 1/p).
The infinity norm finds the maximum of the absolute values of the elements. So for deviations it focuses on the how far the worst data point is from its prediction.

dev3 := LinearAlgebra:-Norm(vals1-vals2, infinity)

2

Download devs.mw

@lcz I expected the order of the plot elements in the display command to determine this, but that doesn't seem to be happening here, even if I put them in a list or use redraw=false. Sorry, I don't have a solution; hope someone else can help.

First 43 44 45 46 47 48 49 Last Page 45 of 78