dharr

Dr. David Harrington

5530 Reputation

21 Badges

19 years, 180 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 questions asked by dharr

For a table

T := table(sparse = {}, [1 = {a}, 2 = {b}])

T[3] returns {}. 

Is there an equivalent for an rtable?

restart

T := table(sparse = {}, [1 = {a}, 2 = {b}])

table( [( 1 ) = {a}, ( 2 ) = {b} ] )

T[1]; T[2]

{a}

{b}

Get the default value here

T[3]

{}

But (as documented), the sparseness of the table is not inherited - all elements are filled

Vector[row](6, T, storage = sparse); op(%)

Vector[row](%id = 36893490697130506636)

6, {1 = {a}, 2 = {b}, 3 = {}, 4 = {}, 5 = {}, 6 = {}}, datatype = anything, storage = sparse, order = Fortran_order, shape = []

fill = {} should fill in all unspecified values. but this is incompatible with storage = sparse (as documented).

Vector[row](6, {1 = T[1], 2 = T[2]}, storage = sparse, fill = {}); op(%)

Vector[row](%id = 36893490697130478916)

6, {1 = {a}, 2 = {b}}, datatype = anything, storage = sparse, order = Fortran_order, shape = []

And the default fill is still zero for datatype=set; I expected {} here.

Vector[row](6, {1 = T[1], 2 = T[2]}, storage = sparse, datatype = set); op(%)

Vector[row](%id = 36893490697130474412)

6, {1 = {a}, 2 = {b}}, datatype = set, storage = sparse, order = Fortran_order, attributes = [_fill = 0], shape = []

NULL

Download Sparse.mw

I am trying to understand the SymmetryGroup returned in the Logic Package. The help page says "The group is a permutation group; its elements are those permutations which preserve the Boolean structure of expr." [my bold], but later the definition is given as "A symmetry of a Boolean expression expr is a mapping f of each variable to some other variable or negated variable, such that the image of expr after applying f to each of its variables is a Boolean formula which is equivalent to expr." Is logically equivalent meant here, or something else? The help page examples don't answer this question.

The following example shows that a group permutation does not lead to a logically equivalent statement as I was expecting - is this a bug, or am I expecting too much here?

restart

with(Logic)

q := `&and`(`&or`(x[1], x[2]), x[3])

Logic:-`&and`(Logic:-`&or`(x[1], x[2]), x[3])

G, L := SymmetryGroup(q, output = [group, expressions]); g1, g2 := Generators(G)[]

_m1897409254784, [x[1], x[2], x[3], Logic:-`&not`(x[1]), Logic:-`&not`(x[2]), Logic:-`&not`(x[3])]

_m1897409280096, _m1897409281184

Exchanging x[1] with x[2], and (not x[1]) with (not x[2]) leads to a logically equivalent expression, so this is indeed a symmetry.

zip(`=`, L, L[convert(g1, permlist, nops(L))]); q1 := eval(q, %); Equivalent(q, q1)

[x[1] = x[2], x[2] = x[1], x[3] = x[3], Logic:-`&not`(x[1]) = Logic:-`&not`(x[2]), Logic:-`&not`(x[2]) = Logic:-`&not`(x[1]), Logic:-`&not`(x[3]) = Logic:-`&not`(x[3])]

Logic:-`&and`(Logic:-`&or`(x[2], x[1]), x[3])

true

Exchanging x[3] with (not x[3]) leads to an expression that perhaps has the same form but is not equivalent

zip(`=`, L, L[convert(g2, permlist, nops(L))]); q2 := eval(q, %); Equivalent(q, q2)

[x[1] = x[1], x[2] = x[2], x[3] = Logic:-`&not`(x[3]), Logic:-`&not`(x[1]) = Logic:-`&not`(x[1]), Logic:-`&not`(x[2]) = Logic:-`&not`(x[2]), Logic:-`&not`(x[3]) = x[3]]

Logic:-`&and`(Logic:-`&or`(x[1], x[2]), Logic:-`&not`(x[3]))

false

NULL

Download LogicTest.mw

The following worksheet was run from my desktop and finds both currentdir() and interface(worksheetdir) to be "C:\Users\dharr\Desktop" (either from opening it within Maple 2017 or double-clicking on it). The startup code is

DocumentTools:-SetProperty("TextArea0",value,currentdir());
DocumentTools:-SetProperty("TextArea1",value,interface(worksheetdir));

But if I load it from Maple Player 2018, then both currentdir() and interface(worksheetdir) are "c:\program files\maple player".

It means an interactive application that runs in Maple won't run in Maple Player.

Is this a bug or deliberate strategy to make it harder to open datafiles within Maple Player?


(Can't load the worksheet contents right now)

Download Test.mw

I'm really after a simple workaround for a file open dialog with embedded components - any suggestions?

View 127_phase coloring.mw on MapleNet or Download 127_phase coloring.mw
View file details

I am trying to color  3D plots according to phase using color=argument(x)/Pi/2

I get different results depending on the form I enter the expression x, as shown on the worksheet. Any suggestions to make this consistent?

When I use the labelling facility in the geometry package, the plot area does not include all of the drawing. For example, in the code below the word "top" at the top of the circle is cut off. restart;with(geometry):with(plots): point(top,0,1):point(bottom,0,-1): circle(c,[top,bottom]): draw([c,top,bottom],printtext=true,axes=none); I see it if I have axes, but I want to use axes=none. It seems like a bug. A couple of workarounds failed to solve the problem. I added the view option to draw: draw([c,top,bottom],printtext=true,axes=none,view=[-5..5,-5..5]); expecting to see a smaller circle. Instead the circle appears the same size, still with the word "top" chopped off. Surprisingly, the points are drawn in LARGER symbols! So I thought that using the view option in display might override that internal options that draw uses:
1 2 Page 1 of 2