Christopher2222

MaplePrimes Activity


These are replies submitted by Christopher2222

@ pseudomondo, to answer your question, to be honest I have not worked through the examples given.  I thought my example could be done easily.  Just attach a few springs and away you go but it is not that simple.  It would be good for vibrational analysis and move on to more complex models.  It sounds like you had an easy solution for it, and if so I would like to see it however Joe Riel's reply seems to suggest the solution is much more complex than you might have thought.

It is perhaps something simple.  But I think there aren't many maplesimmers to answer my question.

I use that command a lot for Maple12 (note to maple12 users that where ? exists one must use ?? to work)

Yes StringTools surgery is a neccessity for the nature of this command.  It would indeed make sense to have a command that automatically sorts data into a Table.  Of course it would have to be a new command since HTTP[Get] is not always extracting or getting data from an http address of the same format which is why StringTools surgery is neccessary.

 

Can replies in posts be organized like they are in questions?  Posts are all flatlisted, a property I detest. 

ps. Why did we follow the layout of the stackoverflow website?  It is terrible!
                    |
** edit **   ^
                 /  \
       mapleprimes developers

Question - exactly that

Post - More of a ... I have an application to present to you, here it is ... type of thing. 

       - But also (as the mapleprimes designers also intended it for) a place to invoke a conversation of topics however the primary use of it is for presenting applications.

Some people ask questions in posts which are later converted to questions by senior members where appropriate. 

More insight here http://www.mapleprimes.com/posts/89389-What-Is-The-Difference-Between-A-Post

 

(okay, bit of free time.  Here is what I have). 

The graphs were obtained from gasbuddy.com but originally pulled from the hamiltongasprices.com website.  And sorry it is .bmp file not jpg.

The general idea was to extract the image, set up the grid for the graph, determine points of interest and finally plot.  At the end I decided to plot the errors as the precision of the data is determined by how much of the bmp intervals are visible.  Picking the values to use as markers was a bit tricky, you had to find the pixel color value.  But once that was determined all the graphs were the similar on that particular website and so could be applied again and again.  One would need to determine other values for other graphs but the general idea could be applied.  In fact just now I just thought of a way to do it automatically, unfortunately these days time is hard to come by.  Regardless, here is the worksheet and test graph in the zip link.

1-29.zip


Reverse engineered graph from an image

NULL

All we are doing here is taking an image of a graph where the actual data is unavailable and making an approximation of the point values using Maple.  By no means does it fully replicate the real data but allows us to create a fairly acurate data representation that closely resembles the one presented to us.  

 

Our target graph was the 1-month average retail chart from www.hamiltongasprices.com.  This method will not work on every graph the same way, but the general idea can be applied with some modifications.

 

with(ImageTools); with(ArrayTools)

a := Read("f:/1-29.bmp")

b := ToGrayscale(a)

topcorners := []; bottomcorners := []; for i to Width(b) do for j to Height(b) do if `and`(b[j, i] < 0.9412e-1, b[j, i] > 0.9411e-1) then topcorners := [op(topcorners), [j, i]] end if; if `and`(b[j, i] < 0.3138e-1, b[j, i] > 0.3137e-1) then bottomcorners := [op(bottomcorners), [j, i]] end if end do end do

NULL

na := hfarray(1 .. 202, 1 .. 582)

Copy(b[topcorners[1, 1] .. bottomcorners[1, 1], topcorners[1, 2] .. topcorners[2, 2]], na)

NULL

Gridline intervals (grayscale value of 0.827450980392156698)

vgridlines := []; for i to Width(na) do if `or`(na[2, i] = 0, `and`(na[2, i] > .8274, na[2, i] < .8275)) then vgridlines := [op(vgridlines), i] end if end do

NULL

vgridlinesm := map(`-`, vgridlines, 1)

[0, 21, 41, 61, 81, 101, 121, 141, 161, 181, 201, 221, 241, 261, 281, 301, 321, 341, 361, 381, 401, 421, 441, 461, 481, 501, 521, 541, 561, 581]

(1)

NULL

Using our x points we will scan for our y points

ypoint := []; for i in vgridlines do for j to Height(na) do if `and`(na[j, i] > .2, na[j, i] < .45) then ypoint := [op(ypoint), j]; j := Height(na) end if end do end do

NULL

ypointm := map(`+`, -ypoint, 202)

[3, 16, 69, 66, 74, 54, 55, 42, 43, 64, 63, 61, 44, 35, 67, 106, 134, 131, 138, 141, 129, 141, 146, 146, 147, 146, 154, 161, 183, 192]

(2)

NULL

In our particular graph we read the upper and lower price values

upperprice := 138.9

lowerprice := 123.0

NULL

ypointmprice := map(`*`, ypointm, (upperprice-lowerprice)/Height(na))

gasprice := map(`+`, ypointmprice, lowerprice)

[123.2361386, 124.2594059, 128.4311881, 128.1950495, 128.8247525, 127.2504950, 127.3292079, 126.3059406, 126.3846535, 128.0376238, 127.9589109, 127.8014851, 126.4633663, 125.7549505, 128.2737624, 131.3435644, 133.5475248, 133.3113861, 133.8623762, 134.0985148, 133.1539604, 134.0985148, 134.4920792, 134.4920792, 134.5707921, 134.4920792, 135.1217822, 135.6727723, 137.4044554, 138.1128713]

(3)

with(plots)

listplot(gasprice)

 

``

gasprice2 := zip(`[]`, vgridlinesm, gasprice)

[[0, 123.2361386], [21, 124.2594059], [41, 128.4311881], [61, 128.1950495], [81, 128.8247525], [101, 127.2504950], [121, 127.3292079], [141, 126.3059406], [161, 126.3846535], [181, 128.0376238], [201, 127.9589109], [221, 127.8014851], [241, 126.4633663], [261, 125.7549505], [281, 128.2737624], [301, 131.3435644], [321, 133.5475248], [341, 133.3113861], [361, 133.8623762], [381, 134.0985148], [401, 133.1539604], [421, 134.0985148], [441, 134.4920792], [461, 134.4920792], [481, 134.5707921], [501, 134.4920792], [521, 135.1217822], [541, 135.6727723], [561, 137.4044554], [581, 138.1128713]]

(4)

dualaxisplot(gasprice2, gasprice2, gridlines = true)

 

help("dualaxisplot")

Typesetting:-mrow(Typesetting:-mo("?", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.1111111em", rspace = "0.1111111em"), Typesetting:-mi("error", italic = "true", mathvariant = "italic"))

with(Statistics)

Typesetting:-mrow(Typesetting:-mi("ErrorPlot", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("gasprice", italic = "true", mathvariant = "italic"), Typesetting:-mo(",", mathvariant = "normal", fence = "false", separator = "true", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.3333333em"), Typesetting:-mi("yerrors", italic = "true", mathvariant = "italic"), Typesetting:-mo("=", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("seq", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mn(".07", mathvariant = "normal"), Typesetting:-mo(",", mathvariant = "normal", fence = "false", separator = "true", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.3333333em"), Typesetting:-mi("i", italic = "true", mathvariant = "italic"), Typesetting:-mo("=", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mn("1", mathvariant = "normal"), Typesetting:-mo("..", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2222222em", rspace = "0.0em"), Typesetting:-mn("30", mathvariant = "normal")), mathvariant = "normal")), mathvariant = "normal", open = "[", close = "]"), Typesetting:-mo(",", mathvariant = "normal", fence = "false", separator = "true", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.3333333em"), Typesetting:-mi("symbol", italic = "true", mathvariant = "italic"), Typesetting:-mo("=", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mi("point", italic = "true", mathvariant = "italic")), mathvariant = "normal"))

 

nops(gasprice)

30

(5)

gasprice2

[[0, 123.2361386], [21, 124.2594059], [41, 128.4311881], [61, 128.1950495], [81, 128.8247525], [101, 127.2504950], [121, 127.3292079], [141, 126.3059406], [161, 126.3846535], [181, 128.0376238], [201, 127.9589109], [221, 127.8014851], [241, 126.4633663], [261, 125.7549505], [281, 128.2737624], [301, 131.3435644], [321, 133.5475248], [341, 133.3113861], [361, 133.8623762], [381, 134.0985148], [401, 133.1539604], [421, 134.0985148], [441, 134.4920792], [461, 134.4920792], [481, 134.5707921], [501, 134.4920792], [521, 135.1217822], [541, 135.6727723], [561, 137.4044554], [581, 138.1128713]]

(6)

nops(gasprice2)

30

(7)

whattype(gasprice)

list

(8)

NULL

``

NULL


Download reverse_graph_projec.mw

I have worked on such a project.  Getting data from a plot of a jpg graph.  Reverse engineering a graph, I called it.  I vaguely remember posting a question regarding such on mapleprimes (can't seem to find it).  However, will post worksheet shortly.

**edit add** sorry my work did not use the command getdata

Yes of course, even M12 can open M16 worksheets.  You will get these messages as you load worksheets created in newer versions of Maple. 

This worksheet was created with a newer version of Maple.  It may not work as expected.
Do you wish to continue?

The worksheet contains elements that are not recognized by this
version of Maple.
Your worksheet may be incomplete.

You will only loose out on the functionality of newer commands.

Just load the newest M16 applications from the Maplesoft application center and see for yourself.  It looks like you are wondering wether you will have to purchase M16 if you want to use those worksheets.  The answer is no, not necessarily.  You will only loose out, as you have mentioned, only on commands used that are not available in M15.  Also, if it has been saved as an executed worksheet, the outputs will be visible even if they are not executable in your old version and will only pose a problem if they are not executable in your version when you re-execute them.  Plot outputs are a different story, if they use commands not recognized they will not show. 

Whoa!  Much ahead of my anticipated schedule.  Based on past releases I expected a mid-April release.  This is good news.

Nice, I was wondering how one would do it with printf.  Reducing it to 3 columns and adding an extra \n copying and pasting into word document fits nicely on one page.  I wonder if we can we avoid Word altogether?

Is there not an option in Maple to output / print directly to the printer?

Nice, I was wondering how one would do it with printf.  Reducing it to 3 columns and adding an extra \n copying and pasting into word document fits nicely on one page.  I wonder if we can we avoid Word altogether?

Is there not an option in Maple to output / print directly to the printer?

Thanks

The division and multiplication are too advanced for my daughter right now anyways, even negative numbers she is just grasping.  Originally I just had + and then just added the list of the other signs last minute.  These are just exercises to strengthen the basics.

However, depending on the grade level of the student doing the exercises, 2/13 etc... could be answered a number of ways.

 

Thanks

The division and multiplication are too advanced for my daughter right now anyways, even negative numbers she is just grasping.  Originally I just had + and then just added the list of the other signs last minute.  These are just exercises to strengthen the basics.

However, depending on the grade level of the student doing the exercises, 2/13 etc... could be answered a number of ways.

 

I also sit on an older version, M12.  I don't know if I will upgrade yet either.

And how is it that Adept website has Maple 16 information and Maplesoft does not?

I also sit on an older version, M12.  I don't know if I will upgrade yet either.

And how is it that Adept website has Maple 16 information and Maplesoft does not?

First 96 97 98 99 100 101 102 Last Page 98 of 155