85 Reputation

5 Badges

9 years, 189 days

MaplePrimes Activity

These are replies submitted by wswain

@Joe Riel 


thank you.  I abbreviated the imports for brevity, but the rest of the comments are great.  Will try shortly.

@tomleslie    I do try to dig through help before coming here.


I can see I have not worked much with the Maple matrix operators and this is just more familiariztion with the op command and the other nuiances.   

The approaches have been very helpful to put me back on track.






@dharr   would most Maple users that understand all the maple uniqueness considered heavy users on a daily basis?   As an engineer I am not a professional coder, but need to use the tool (any tool, Matlab, MathCAD, fortran of old, etc.) to solve problems.   Maybe this is all easy(?) for professional code writers.  How unique are these language constructs to other programming languages?


I use Maple for my Professional License continuing education needs as I believe the tool is the more robust but it has its code operations features that seem a bit difficult.  JMHO.


Thank you and will continue to press forward with this and the info above.  Appreciate any continued dialog.




@tomleslie    Thank You very much!

Looks like pretty much the goal.  I like your method of changing the '-', "&ndash"

This is my lack of maple experience and limited usage of -> arrow operator and the ~ tilde operator in next line.   I'll check in the morning in slow time.  any hints would be helpful.

Next the output matrix is great, my goal will be to reduce the 166 columns as a lot of that data is not necessarry.  But for ease at this moment I like the approach and if small memory footprint, just carry the excess data along.   

Just reading through how you extracted and if you could comment around the seq function on what it is doing within "Matrix".   I don't see the from 1 to end (or last row) as the seq idx.  Is the 1st argument the matrix  SD[1st row, all columns] being set to start scan as start row?

I see/note the scan=columns (read across columbs in a row?) at the end.   


the NULL line is confusing 

lastly forgive my newness with the op command.  In this case op[1,1] is referencing which expression that its grabbing the [1st operand of expression 1(?)] .  Is it the 1st row as expression 1?


Back on memory.  Did you check the import time and can the var SD be checked for memory utilization?  Presuming this grabs a copy of the full table.  I am not sure how some 10,000 record data sets will import though like this on performance.  I did look at the matlab xlsread as the goal I was trying with Maple (the hard ay) to scan in place the data without loading into mem as a var.







@tomleslie    The mw file is not really cleaned up for publishing.  Here is the main parts copied out.


Initial excel flat file form AISC,



Mydatafile := "aisc-shapes-database-v15.xlsx"

Steel_data := Import(Mydatafile, "Database v15.0")


len_Steel_data := Size(Steel_data)[1]

S_mod__min := 11.66666667

j := 1 (index for sub data collection matrix)

> for i to len_Steel_data do

    if S_mod__min < Steel_data[i, 41] and Steel_data[i, 7] <= 10.5 then

            location1_row[j] := i;

            location1_row[j, 2] := Steel_data[i, 7]; j := j + 1;

     end if;





[1082, 2], [1086, 2], [1087], [1086], [1085], [1084], [1083], [1082], [1085, 2], [1083, 2], [1087, 2], [1084, 2]


[10.1], [9.73], [255], [254], [253], [252], [251], [250], [9.92], [10.0], [10.5], [10.1]





for i in entries(location1_row, 'pairs') do
end do;

                        (1082, 2) = 10.1
                location1_row[(1082, 2) = 10.1]
                        (1086, 2) = 9.73
                location1_row[(1086, 2) = 9.73]
                           1087 = 255
                   location1_row[1087 = 255]
                           1086 = 254
                   location1_row[1086 = 254]
                           1085 = 253
                   location1_row[1085 = 253]
                           1084 = 252
                   location1_row[1084 = 252]
                           1083 = 251
                   location1_row[1083 = 251]
                           1082 = 250
                   location1_row[1082 = 250]
                        (1085, 2) = 9.92
                location1_row[(1085, 2) = 9.92]
                        (1083, 2) = 10.0
                location1_row[(1083, 2) = 10.0]
                        (1087, 2) = 10.5
                location1_row[(1087, 2) = 10.5]
                        (1084, 2) = 10.1
                location1_row[(1084, 2) = 10.1]

end do


CLUMSEY OUTPUT TO INDEX NEXT ACTIONS ON  (IMHO as List, with ramdom indices refs)

To use as a data vector to perform extra work on subset.


Establishing the size prior to first query and su set generation vs using "MyData[i] := assign value to matrix or array variable location" doesn't work well.   The pre DIM of array constructor seems a Fortran or C model vs dynamic managament of Size(M).

Have not used dataframe or select but have used Matlab with this type indexing.   P.S., not a fan of Matlab for many other reasons.  Really just wanter better understanding and ease with using and manipulating data in matrices from either equation generation data, or data from a reference source.

FYI, this short vid shows an indexing loop in Matlab to generate matrix elements.  Note ease of establisment :-)


Thanks again in advance.











As far as SQL, I do have systems that use SQL and these are real relational databases in Oracle or other.   The Server side vs the client side for the data query is non-trivial, but for complex relational info - I get it.


For simple flat table look-up like steel grade properties that I'm using to identify a sub-set of options are maintained, issued by AMS, IEEE, etc. in xls, xlsx formats often.   Export to csv is fine, but then loose connection to original file created by the data source.


I have been trying the import yesterday and it takes a bit (10-15 secs) to import the excel file into a matrix.  I am not sure how much memory is used by this matrix now.   My MemoryinUse() returns -> 27597656,  or kernelopts(bytesalloc)/1024 -> 124364, in kbytes which I presume is reading 124Mb?

On my status bar memory went from 44M to 77M.   So not sure which one is right and how much the data the Matrix var is consumeing.  On the one hand with a 8GB laptop this should be trivial.   I don't undertand the reason it takes 10-15 seconds to process the command and import the matrix data.  


The search was quite fast and now just working out how to create a sub-set array/matrix.   Since the "for i from 1 to last row do" an "If statement search" to look for the data of interest was returning a resonable response time but the response was a list with a arbitrary indices (i.e. 1086 for first element in list) for the elements returned.  Reallocation/fill of a proper Array/Matrix data structure with zeros of Size(x) is always a challenge when quering data sets within the program. 


As such, I won't know the size until I process the query.  Dynamic allocation, creation of array size based on results from the search seems a challenge in Maple.  Is it me or how I'm approaching dynamic allocation/creation of matrices/arrays.


The list result that did get established from the data record found was hard effort sorting the indices/pairs to then have a second step to process to a true vector, array or matrix for further processing.

Again, appreciate your reply.  Just trying to add to see if the way to manage data sources - which original thought is to open as a link and search using the file in its native source without import or copy to retain original state of information.  Yes read only always for data source info.   P.S, I did look at the database tools and recognise the big volcano database info example, and other GIS info references.


Again, Thanks in advance for any assitance here.








I have Maple2018  - sorry for the confusion.  This was very helpful.





@Joe Riel 


Is there any documentation that best describes the modules, toolboxes, directories, etc. as above.   I am using Maple18 so have the latest version.   I think the default directories and user directories are part of what is not clear.   I note the joinpath command which is helpful to know so I could create a library directory that can be added and is on the main path.   


I note the code above to create the toolbox (mla?).   I think the file name .mla is confusing versus .lib.   and toolbox versus a pure library, vs a module defintion.


Thank You

@Carl Love


P.S.,   I would most love to be able to have a command or library, start-up file that is something like useNIST, with(NIST) that sets everything into the NIST derived base 22 and secondary's as the basie output and only need the context menue occasionaly to convert.  This would really help work flow and developing worksheets, docs, etc without a lot of time spent on unit conversion to the common enginnering form.


Is this possible?  I have tried save/read for an include type file i.e., save(proc). 

I don't really have a good feel for how user to make, store a library, or (like old C #include) other ref files which are incorporated for set-up and initiation and Globals as best practice to established this.  (still a novice user).  For me this is like always step one before getting going to even work on a problem. Simplifying this start-up is almost a necessity.




@Carl Love 


Thank you.   I seemed to have gotten it to work with the context menu.  I am not sure UseUnit actually fixed the output.  Still trying to understand base units (Length (SI=m), mass (Ok = kg? or g?), current = A, etc.) to setup for a derived units set that will be valid for a session/worksheet such as J = m^2*kg/s^2 as the default output instead of always converting.


Again UseUnit didn't work quite right in this manner as I think you've noted.  I hope it is just my implementation.




@Rouben Rostamian  


Thanks for the assistance.  I have ordered the book.  Implemented the Maple Input interface and read through the beginning sample Amazon gives.   

Again, there is so much capability and language command knowledge that is more that just the general functions we most learn.   I also have a book, Introduction to Maple, 3rd Edition, Heck.   It is very mathematical with generalized concepts.  Mostly directed at the math proffesionals vs, engineering practitioners I think.  But has also been helpful with digging into the commands like "unapply" that you introduced.


Happy New Year, and again,...Thanks.



@Rouben Rostamian  


....  as you mentioned learning about Maple.  These kinds of problems help me discover how to approach some problems within Maple as you've used the "unapply" function which I can read to know what it is for and why it's used, you used it.   Plus, solving {BC} the way you applied the solve arguments  seems to me an unatural construct as I thought this was the equation U(x) in the first argument as defined in help.


I know you've done these things many, many times,...but with the sparse help on commands in the help section, do you have any other references that discuss these and other problem solving approaches, i.e. using the {BC} in the solve command? ?  that could help point me to these elements, again like "unapply" and why? 

My stuggles to fully embracing Maple as my math tool of choice is that I don't even know to do many of these functions at all.  This is much different than C/Fortran calls which I'd call primatives to the rich commend set of Maple, and natural layout/typesetting of MathCad implementation of equations.   Without your Worksheet, I'd have never thouht to look for this or that command or use in this manner.   


You've been very generous putting these togather and helpful in moving my goal to using Maple as the tool I know it's designed to do.  I know the strengths weaknesses of MathCad and Matlab.  I am hoping Maple becomes just as friendly as my cacluator and pencil.






@Rouben Rostamian  


This is exactly the direction I was trying to go and you surmized correctly.  Once I get better with the "mechanics" of the SW -  I'll most assuredly use the simple, fast method - knowing what it represents. And my Maple capability grows too.


i.e., I don't do all the matrix Linear Algebra to solve a matrix inversion, I let the SW do it, but I know if it's right or I have done something wrong in the set-up if things don't look right in the aswer or I get errors (which right now I get a lot due to equation formating, variables passing, etc.)   






@Rouben Rostamian  


I guess it is still about the learning of Maple.   Instead of using dsolve straight to the u(x) answer I tried after writing the response to manually integrate the dirac equation up through the various equations. 



On the first integration() Maple uplifted the dirac to heaviside, plus I added one integration constant:




I've attached the file to show where this goes off the rails for me. I've tried quite a few solution options to resolve the equations C's to hopefully walk up th the final u(x) as indicated by the dsolve function.

  As you can see it is Maple functionality that I am trying to learn to apply to the simple by hand (as you rightly indicate) but a little challenging by Maple function calls or my approach.   These intermediate solutions are important to me other than just u(x) as you've solved for


P.S. - I'm not sure the file upload took due to Chrome security warning.  Here is the commands after the above to solve:


Getting very stuck here and tried several methods (subs x=1 only) 

Coeff_C2 := evalf(solve(subs({a = .5, x = 1}, C1*x-10*Heaviside(x-a)*x+10*Heaviside(x-a)*a+C2) = 0, C2));
                    Coeff_C2 := -1. C1 + 5.

                          -1. C1 + 5.

subs(C2 = Coeff_C2, rhs(M(x)));

C1 x - 10 Heaviside(x - a) x + 10 Heaviside(x - a) a - 1. C1 + 5.



subs({a = .5, x = 1}, C1*x-10*Heaviside(x-a)*x+10*Heaviside(x-a)*a-1.*C1+5. = 0);
                  5. - 5.0 Heaviside(0.5) = 0

Coeff_C1 := evalf(solve(subs({a = .5, x = 1}, C1*x-10*Heaviside(x-a)*x+10*Heaviside(x-a)*a-1.*C1+5. = 0), C1));
                         Coeff_C1 := C1


Your solution

dsol := dsolve({de,bc})







@Rouben Rostamian  


Thank you for responding.  This might be a little long, but trying to get through the thoughts/ideas for clarity.

I am fairly familiar with the beam elastic Euler-Bernouli equations.  I am not so familiar with the maplesoft language and that is where the Dirac question lies.  I understand it is the equiv to concentrated load force vector (magnitude applied = -10 in example x unit impulse).  When using McCauley functions it is simply <x-a> ^-1.    When integrating to get shear and moment the exponent moves up.  SO, fundamentally there are a few differences in approach.  That is more my question for choosing the dirac function itself. 

Computer based it probably works very well which is what I am learning about Maple to use.   The heaviside (unit step) function I have used in Mathcad.  It was brute strength mehod of implementation versus Maple dsolve that you used which it looks like maple actually created for the equation  3 as a response to the dirac function call. 

However, Integration again should yield a ramp function if the load was a distributed load using the unit step.  If the load stopped is a minus heavystep used to turn off the remaining load diatance to beam end?  Can I model this and see what Maple does?

It also looks like with the BC conditions the Constants of integration have been solved and substituted accordingly (?). 

If I replace the BC D^2(u) = K*theta, the system of equations is now iner-related to the EI deflection occuring under load as well, plus the rotational stifness casue by the torsion spring.

Again just trying to understand the Maple capability, approach and language/function effort the computer can/will do to resolve this dependencies.  I wasn't expecting a.) what appears simplistic on its face for maple, but b.) know its only a simple loading at the moment in your case.   Although it is recognized by form.

Understanding maple and how it works is more important to me in rethinking just setting up the basic DE to set the computer working.  My background is mostly mathcad or hard code and am just really getting familiar and using Maple/maplesim for first time on some different problem sets to get comfortable with its features, language usage.

I do agree with your animation statement.  It is nice to see.  But, for me the graphical output is more a vsual to verify the springed hinge allowed rotation at the joint versus fixed and is zero (typical S shape of an example fixed-fixed).  And also knowing the equations interpretated the spring correctly as a function of theta which I can compare to the pinned condition with zero stiffness roatation as a function of the beam EI only.  I know the rotation will be between zero theta of fixed and pinned, zero K.  

In essence I am adding a compliance "flexure hinge" that has to be solved as part of the total solution where its effects along with the EI rotation will work in tandem as combined stiffness to the load.   Ultimately the prismatic will move into a more complex shape and a multi-point load.  Most literature treats the torsional spring joint uniquely and assumes the beam is ridged without its own EI flexure effects.


Therefore, I am needing to verify the maple approach and output on things that can be agreed and checked them before advancing into more complex geometry sets, boundary conditions.


Lastly, I just got MapleSim last week and had wanted to use this to understand how the flexible beam and connections worked vs. the rigid beam frame that doesn't allow for the EI beam deflection.  I've used modelica in a very limited way and labview diagram connections a lot, so therefore the Maplesim method is not alien, but the help in MapleSim is sparse in its treatment of the components fixings and reactions.


Again, really appreciate your guidance and assistance with maple, even maplesim as you have time for.


Kindest regards,


1 2 3 Page 2 of 3