wswain

200 Reputation

7 Badges

11 years, 313 days

MaplePrimes Activity


These are replies submitted by wswain

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

 

Initial excel flat file form AISC,   

https://www.aisc.org/globalassets/aisc/manual/v15.0-shapes-database/aisc-shapes-database-v15.0.xlsx

 

Maple:  

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

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

Size(Steel_data)

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;

 

OUTPUT

 

indices(location1_row);
 

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

entries(location1_row);

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

location1_row[1082];

                              250

numelems(location1_row);

                               12

for i in entries(location1_row, 'pairs') do
    print(i);
    location1_row[i];
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 :-)  https://www.youtube.com/watch?v=ESpvG6cgY5c

 

Thanks again in advance.

Bill

 

 

 

 

 

 

 

@dharr 

 

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.

 

Bill

 

 

 

@acer 

 

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

 

Bill

 

 

@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.

 

Ref:   https://physics.nist.gov/cuu/Units/units.html

https://physics.nist.gov/cuu/Units/units.html

 

@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.

 

Regards,

Bill  

@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.

Bill

 

@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.

 

Regards,

Bill 

 

 

@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.)   

 

Regards,

Bill

 

 

@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.


Coeff_C2;
                          -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
Coeff_C1;
                               C1

 

Your solution


dsol := dsolve({de,bc})

 

 

Regards,

Bill

 

 

@Rouben Rostamian  

Rouben,

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,

Bill

@Rouben Rostamian  

 

Rouben,

 

Did you select the Dirac intuitively, or is this normal?   When you slected Dsolve did the heaviside function come in as a result of the dirac usage and dsolve automatically?  Is this feature defined in help or other?

 

I am used to and use McCaualey singularities but find little info about, especially the integrations.  It would appear you've found the key to very simple 4-5 line MAPLE command flow sequence?

 

My main objective is to impart onto the hinge a K-theta compliance spring stiffness and solve for the moment and x,y component reactions as the load changes with EI stiffness of the beam.

 

Thank you and anymore insight into the DE, Dirac, solver info would be great.   I note you make the D@@2 = 0.  U=0 i get.  How did this decribe a hinge?   Where can I find this referenced? 

Regards,

Bill

 

 

 

@acer

So (a,b)->g(a) > g(b) compares each permutation(?) in the list of operands in the [list] to get the high/lower sequencing of the difforder for sort? where > is in higher to lower ordering?

Sometimes drives me buggy to find the "what it's doing" thing.   Was just chasing down the "tools/gensym".  I know gensym is generate symbol, but where is the reference to the base "tools/" library where this exists?   Again, maple docs failing me at the moment.

I wouldn't even know to use this if I hadn't seen it in your proc.

I really appreciate your assitance !!

Bill

 

 

 

 

@acer

 

Been through the code and proc and quite a nice piece of work. :-)  Checked out the DAG and see what you meant on storage inside maple.  Since this is a 'print/pre' proc the display (prettyprint) is the only thing changing - correct?

I understand the op() function now and the sort mechanism much better.  However, As an old time coder I sometimes can't wrap my head around (or say in words) of the arrow operator instantiation  (x -> x2 - clasic example in the guides).  Should this reads as,    X is assigned X2 function (?)

It seems so different and easy to just say f(x) = X2  which is relatively straight forward equation formulation.

 As such I get the "kinda" understanding of the programmer indexing (a,b) -> a > b

But, I can't say it accurately in words as an indexing method as to what a,b are doing.  As indexing of the [OP] returned list, indexing is 1,1; 1,2; 1,3 etc, in row, col format.  So, is (a,b) in arrow format to the comparison read as (a,b) pairs (r,c)  1,1; 1,2; 1,3, marching or 1,1 = a  and 1,2 = b,  then the arrow operator is the comparison?

The guide is a little short of describing the programmer indexing enough that I'm not getting it fully.

Sorry to be a little daft.  This is some of the nuances of maplesoft that sometimes needs help explaining.

 

Thanks much in advance if you can help.

Bill

 

 

@acer 

 

Thank you very much for your clarification.  I do not see anything lacking.  I think your response was a bit startling of content at first blush but as you mentioned you covered the d/dt variations of all the typesetting tpes.  That was a lot more than I expected.  

I am not sure why maplesoft orders them the way they do internal as I suppose that most people read left to right in the natural taught way of texts.  You indicated this is how they are stored, so presume there is a reason.  Any illumination here would be helpful.  It would also helpo me understand why this has not been a normal mode or display, nor a command to present it as such in the main library.

 

Just for my knowledge in learning more about Maplesoft, how did you declare the proc as 'print/pre'  yet use only pre() as the proc call?  I'm not that savy with the coding options for prcedures, procedure naming. 

 I think I need to walk through the procedure to follow all the textual parts of the code as parts of commands, i.e. subs([ops(eqn)], ...)   returns a number, as the item in the first position instead of x = y, of the substitution into the second position declared eqn.

 

Your assistance is greatly appreciated and this thype of coding a process actually helps me understand maplesoft much better in how it operates at alower level to use it more effectively.

Kindest regards,

Bill

 

  

 

 

1 2 3 4 5 Page 4 of 5