## 89 Reputation

14 years, 78 days

## How to convert print to screen output to...

Maple 2018

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:
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

## Parabolic PDE ...

Maple

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

## Transforming a polar plot from 2D into ...

Maple

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.

## fieldplot3d (color option): can't set c...

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)

MRB

## Switching off saving results when saving...

Maple

I have worksheet that generates very large matrices and it seems to save all results, so it requires large amount of RAM to load and storage to save it.

There used to be a pop-up prompt not to save the results of the worksheet - to save space, but that no longer occurs.  Can someone help me to switch on that prompt not to save results or otherwise prevent saving results, when I open the spreadsheet.  It maybe that I agreed not to be prompted again, but now I am regretting it!!

MRB

 3 4 5 6 7 8 Page 5 of 8
﻿