Christopher2222

MaplePrimes Activity


These are Posts that have been published by Christopher2222

It seems once in a while someone asks about converting from degrees minutes seconds format to decimal or the other way around. 

I created a little procedure for just that purpose. 

restart; gc()

NULL

A little procedure to convert the form of degrees, minutes, seconds to decimal and vice versa.  

NULL

dms := proc (d, m := 0, s := 0) local con, d1, d2, d3; if 0 < frac(d) then d1 := floor(d); d2 := floor(60*frac(d)); d3 := 60*frac(60*frac(d)); con := cat(d1, `° `, d2, `' `, d3, `"`) else con := d+m/60.+s/3600. end if; print(con) end proc

NULL

Examples of use.

 

dms(45.2365)

`45° 14' 11.4000"`

(1)

dms(45, 14, 11.4)

45.23650000

(2)

NULL

Download dms.mw

edit - a quick realization is to remove the decimals that changes the fractions to floating decimals and change print(con) to print(evlaf(con)) to avoid rounding issues.

MapleFlow is showing the exact same icon in the taskbar as Maple when both are open.  Be nice if they were slightly different.

There is something wrong with the search in mapleprimes. 

I noted one users comment last week about using the search to find something being very difficult to find.  The results don't often match the search.  Only just this morning I was looking for something and the results were less than satisfying often pointing to a list of more results which didn't seem to help. 

This has been a problem for a long time, is this going to be looked at or fixed soon?

The search query in the new Maple Application center is broken.  There is no advanced search options and a search for mapleflow or maple flow brings up 0 results.  There should at least be one found, for example the search should have at least brought up The Liquid Volume in a Partially-Filled Horizontal Tank".

Maple, please fix.

 

Here's a procedure using GraphTheory by morphing one four letter word into another by changing only one letter at a time.  This is my initial working version.  I've commented out the DrawGraph portion as it takes a long time (5 minutes or so) to produce.  Using the Neighbors command from the GraphTheory package the graph can be shrunk to only include the relevant paths and will take a shorter time to draw.  It's an initial version so there is room for improvements.
 

a := readdata("c:/sowpods.txt", string)NULL

with(StringTools)NULL

b := [seq(`if`(length(a[i]) = 4, a[i], NULL), i = 1 .. nops(a))]

NULL

The word morph procedure for 4 letter words.

NULL

morph := proc (w1::string, w2::string) local c, i, q, d, r, j, k, g, gg, sp; c := {seq(`if`(HammingDistance(w1, b[i]) = 1, b[i], NULL), i = 1 .. nops(b))}; q := {seq(`if`(HammingDistance(w2, b[i]) = 1, b[i], NULL), i = 1 .. nops(b))}; for i to nops(c) do c || i := {seq(`if`(HammingDistance(c[i], b[j]) = 1, b[j], NULL), j = 1 .. nops(b))} end do; for i to nops(q) do q || i := {seq(`if`(HammingDistance(q[i], b[j]) = 1, b[j], NULL), j = 1 .. nops(b))} end do; d := map(proc (x) options operator, arrow; {x, w1} end proc, c); r := map(proc (x) options operator, arrow; {x, w2} end proc, q); for i to nops(c) do d || i := map(proc (x) options operator, arrow; {c[i], x} end proc, c || i) end do; for i to nops(q) do r || i := map(proc (x) options operator, arrow; {q[i], x} end proc, q || i) end do; for k to nops(c) do for j to nops(c || k) do c || k || _ || j := {seq(`if`(HammingDistance(c || k[j], b[i]) = 1, b[i], NULL), i = 1 .. nops(b))} end do end do; for k to nops(q) do for j to nops(q || k) do q || k || _ || j := {seq(`if`(HammingDistance(q || k[j], b[i]) = 1, b[i], NULL), i = 1 .. nops(b))} end do end do; for i to nops(c) do for j to nops(c || i) do d || i || _ || j := map(proc (x) options operator, arrow; {c || i[j], x} end proc, c || i || _ || j) end do end do; for i to nops(q) do for j to nops(q || i) do r || i || _ || j := map(proc (x) options operator, arrow; {q || i[j], x} end proc, q || i || _ || j) end do end do; g := {d[], r[], seq(d || i[], i = 1 .. nops(c)), seq(r || k[], k = 1 .. nops(q)), seq(seq(d || j || _ || i[], i = 1 .. nops(c || j)), j = 1 .. nops(c)), seq(seq(r || j || _ || i[], i = 1 .. nops(q || j)), j = 1 .. nops(q))}; gg := GraphTheory:-Graph(g); sp := GraphTheory:-ShortestPath(gg, w1, w2); print(sp) end proc
Today, June 6 is international yoyo day.  So I start off with, of course, the word yoyo.

NULL

morph("yoyo", "four")

["yoyo", "boyo", "boys", "foys", "fous", "four"]

(1)

morph("door", "yoyo")

["door", "boor", "boos", "boys", "boyo", "yoyo"]

(2)

morph("four", "yoyo")

["four", "fous", "foys", "boys", "boyo", "yoyo"]

(3)

morph("zane", "quit")

["zane", "cane", "cant", "cunt", "cuit", "quit"]

(4)

morph("lair", "jump")

["lair", "gair", "gaur", "gaup", "gamp", "gump", "jump"]

(5)

morph("jump", "lair")

["jump", "gump", "gamp", "gaup", "gaur", "gair", "lair"]

(6)

morph("quit", "jump")

["quit", "luit", "lunt", "luna", "luma", "lump", "jump"]

(7)

morph("xray", "jump")

Error, (in GraphTheory:-ShortestPath) no path from xray to jump exists

 

NULL

With no path another level of iteration word groups will be needed.  Otherwise you can use an intermediate word as below

NULL

morph("xray", "door")

["xray", "dray", "drab", "doab", "doob", "door"]

(8)

morph("door", "jump")

["door", "poor", "poop", "pomp", "pump", "jump"]

(9)

morph("lair", "door")

["lair", "loir", "loor", "door"]

(10)

NULL

NULL


 

Download Word_Morph_3.mw

Word_Morph.maple

1 2 3 4 5 6 7 Last Page 2 of 38