Melvin Brown

79 Reputation

6 Badges

13 years, 188 days

Social Networks and Content at Maplesoft.com

Maple Application Center

MaplePrimes Activity


These are questions asked by Melvin Brown

Am trying to analyse a set of strings.   Can anyone help?

We have 10 x10 matrix into which we need to add connection score.
ExY := [WPKCPYWFYWCXHY, WPKCTEYFHCFEEE, HYCYTFHYYWWKCE, HYHHTFHKFEYHEH, HKXWYHFECTFFTF, HKWEHPPECWWHTC, HKXWYTPXHFHWYP, HKFEXCTFECXFKP, HKFEYPPEEEPHYW, HYTHCCFEWPPEXX, HKXKXCKFCHTEWK, HYEKPPCKFTWXXW];
Here is the code to create the connection matrix 
A__c = A__a+A__d;
.
Blist:=[W,P,K,C,Y,F,X,H,T,E]:# basis letters
nWords:=numelems(ExY):Wletters:=length(ExY[1]):Bletters:=numelems(Blist):A:=Matrix(Bletters,Bletters):# set up dimensions
for iW from 1 to nWords do  # loop through words
  for iL from 1 to Wletters-1 do # loop through letters of each word
     fromLett:=C(iW,iL); # see char extraction from ExY list above 
     toLett:=C(iW,iL+1); # ditto
     BfromLett:=Search(fromLett,Blist);# column id   <<<<<< the search is returning 0, it works if one uses "A" rather than say fromLett=A 
     BtoLett:=Search(toLett,Blist);# row id   <<<<<  ditto here
     A(BfromLett,BtoLett):=A(BfromLett,BtoLett)+ 1; # add statistic to the A-matrix
  end do; # end letter loop
end do; # end word loop
Error, index out of bounds
The search function is failing: 
Blist; Wletters; Bletters; nWords; fromLett; toLett; BfromLett; BtoLett; A; iW; iL;
                 [W, P, K, C, Y, F, X, H, T, E]
                               14
                               10
                               12
                              "W"
                              "P"
                               0
                               0

                 [0  0  0  0  0  0  0  0  0  0]
                 [                            ]
                 [0  0  0  0  0  0  0  0  0  0]
                 [                            ]
                 [0  0  0  0  0  0  0  0  0  0]
                 [                            ]
                 [0  0  0  0  0  0  0  0  0  0]
                 [                            ]
                 [0  0  0  0  0  0  0  0  0  0]
                 [                            ]
                 [0  0  0  0  0  0  0  0  0  0]
                 [                            ]
                 [0  0  0  0  0  0  0  0  0  0]
                 [                            ]
                 [0  0  0  0  0  0  0  0  0  0]
                 [                            ]
                 [0  0  0  0  0  0  0  0  0  0]
                 [                            ]
                 [0  0  0  0  0  0  0  0  0  0]
 

I wish to process a string of letters into a list of one or more characters which are comma separated at each change of character. The following function will achieve this, but its output is not as list [ ] in the format required.  

Below is a routine to split a character string based on change of character: (ref: https://rosettacode.org/wiki/Split_a_character_string_based_on_change_of_character#Maple)

splitChange := proc (str::string) local start, i, len; start := 1; len := StringTools:-Length(str); for i from 2 to len do if str[i] <> str[start] then printf("%s, ", str[start .. i-1]); start := i end if end do; printf("%s", str[start .. len]) end proc;
splitChange("WPKCPYWYYYXHYY");# 

Here is the output:
W, P, K, C, P, Y, W, YYY, X, H, YY

This print-to screen output is not usable, instead I need the output in list format i.e. ListY:= ["W", "P", "K", "C", "P", "Y", "W", "YYY", "X", "H", "YY"].

Background

 In my model, each of these character strings is a node of a graph, and their adjacencies represent an edges of a graph.  I aim to automatically map strings into a set of directed adjacencies as output; for example:  

AdjSet:= {[W, P], [P, K], [K, C], [C, P], [P, Y], [Y, W], [W,YYY],[YYY, X], [X, H], [H,YY]}.

This set will be the input to a directed graph, e.g: 
M := Digraph(AdjSet); DrawGraph(M);
from which our objective, the adjacency matrix of the nodes can be obtained in MAPLE.  

Help

Can someone please help me by modifying the SplitChange rountine so that it produces output in the form of ListY above? 

Thanks in anticipation of your help

Melvin Brown
 

I am looking for a numerical solver for a parabolic PDE (up to 2nd order derivatives but no mixed ones) on the spatio-temporal domain [X x Y x T], either as an external package or as MAPLE code.  

I have coded the method of lines on the domain [X x T] and indeed also used pdsolve as a check for that case. However, pdsolve (numerical) cannot solve the PDEs on the domain [X x Y x T].  The run times and memory requirements for the latter case would of course be significantly greater.  

I am about to code up the method of lines (in MAPLE) on the domain [X x Y x T], but am wondering whether there exist external FORTRAN or C code packages that would be faster if called up in MAPLE and whose results would then be post-pocessed in MAPLE.

Does anyone have any suggestions?

MRB

I am using MAPLE 2016.1.

I have created an animation of points on a polarplot (2D), but would like it to be projected into 3D, with time t being the 3rd axis.  Here is my code for the polarplot animation:

with(plots);
Repltlist := proc (t) options operator, arrow; [[sin(t), 0], [cos(t), (1/3)*Pi], [cos(2*t), (2/3)*Pi]] end proc;
Impltlist := proc (t) options operator, arrow; [[-sin(3*t), 0], [-2*cos(t), (1/3)*Pi], [-cos(4*t), (2/3)*Pi]] end proc;
titleName := "Polar representation of time-dependence of degrees of freedom in configuration space"; captionName := "Re - red, Im - blue";
P := animate(polarplot, [Repltlist(t), color = "Red"], t = -Pi .. Pi, symbol = solidcircle, style = point, color = red, symbolsize = 12, frames = 100, gridlines = true);
Q := animate(polarplot, [Impltlist(t), color = "Blue"], t = -Pi .. Pi, symbol = solidcircle, style = point, color = blue, symbolsize = 12, frames = 100, gridlines = true);
R := display([P, Q], title = titleName, caption = captionName); R;

I have been trying use the plots[transform] to 'lift' this polarplot into 3D: 

with(plottools); with(plots);

plrPt(2); f := proc (tt) options operator, arrow; plottools:-transform(proc (r, theta) options operator, arrow; [r, theta, tt] end proc) end proc; display((f(2))(plrPt(2)));

but the last command gives no output.

Can anyone help?

MRB
PS:  I am now attemptiing to do the lift to 3D by using a cylinderplot but would like know why the transform function is not able able to lift the polarplot into 3D.

I am running MAPLE 2016.1

I am able to set the color option to a function in fieldplot, e.g.

plots[fieldplot]([y, -sin(x)-(1/10)*y], x = -10 .. 10, y = -10 .. 10, arrows = SLIM, color = sin(x)*sin(y))

works as expected.  

However, for plots[fieldplot3d] I cannot set color = f(x,y,z) . E.g.

plots[fieldplot3d]([2*x, 2*y, 2*z], x = -1 .. 1, y = -1 .. 1, z = -1 .. 1, grid = [5, 5, 5], arrows = SLIM, color = sin(x)*sin(y)*sin(z));

Error, (in plot/color) invalid color specification: sin(x)*sin(y)*sin(z)

Please can anyone help?

MRB  

1 2 3 4 5 6 Page 3 of 6