Error

 2 Pages12>
 Previous Topic Next Topic
 Alex M. #1 Posted : 12 March 2016 10:53:43(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Hi All,I have searched through the forum and could not find whether it is possible to define the new variable programmatically in SMath, in my case inside a for loop.here is the problem statement.I am attempting to create a solver for a strut&tie model. The solver will loop through all the nodes of the model and create / solve equations of equilibrium. As long as there is as many equations as there is unknowns I can solve for unknowns by simple matrix inverse & multiplication (we all know how it works).However say we have 4 non co-linear struts meeting at one node. There is more unknowns than equations, hence you cannot do X = A^-1 x B. It would be useful to define and solve actual equations of equilibrium so you can get your solution in terms of some unknown variables. As a designer you can guesstimate a ratio of one strut force to another after the fact, effectively substituting one of the unknown variables by hand after actual solution was done symbolically by SMath.So the take away: a for loop needs to go through the nodes of the model creating equations of equilibrium. In order to do that it needs to define variable(s) with different names inside a for loop programmatically . How can it be done?P.S.: Frankly if functionality does not exist I would not expect it to be difficult to create a function that takes input str2var("b7") and spits out just b7 without "". I am just not sure it is worth creating a separate plugin for such a function.Edited by user 24 November 2016 21:58:20(UTC)  | Reason: Not specified
 Wanna join the discussion?! Login to your SMath Studio Forum forum accountor Register a new forum account.
 Alex M. #2 Posted : 12 March 2016 11:16:42(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) I have realized I can create a variable x by using str2num() function.However I cannot use this variable to solve an equation (at least not from the first try):This will throw an error Code:``solve((str2num("x"))^2+((str2num("x")))^3-90≡0,str2num("x"))`` this will work Code:``solve((str2num("x"))^2+((str2num("x")))^3-90≡0,x)`` May be if i go get some sleep it will all make sense in the morning...
 Jean Giraud #3 Posted : 12 March 2016 16:52:53(UTC) Rank: Advanced MemberGroups: Registered Joined: 04/07/2015(UTC)Posts: 4,576Was thanked: 775 time(s) in 615 post(s) Non linear solver of some kind, poorly documented.The Mathcad Given/Find would solve with an objectivefunction [my newbie interpretation]. The "M"in the attached would solve "Pseudoinverse", postedfew weeks ago in the forum. Polynomial fit_D[x].sm (19kb) downloaded 29 time(s).Jean 2 users thanked Jean Giraud for this useful post. on 12/03/2016(UTC),  on 12/03/2016(UTC)
 Alex M. #4 Posted : 12 March 2016 18:56:17(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Jean, I am not quite sure how to use your solver in my case... From what I understood you were attempting to solve the under/overdeterminate system of equations (this is what I have); I am somewhat confused to what is the solution?Ioan I take by array you mean matricies created by using str2num()? I will play with that :-) It was late at night yesterday when I discovered that str2num does what I was asking for to begin with. Now I just need to figure out how to create and solve an equation using variables defined by str2num().
 Alex M. #6 Posted : 12 March 2016 19:46:35(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Originally Posted by: ioan92 Alex,Pardon me if I entered with my big shoes in your thread.I simply think that is reasonable to separate physical treatment of the subject from the programming side..It's not the same the scientific side and the programming side of the problem..A problem clearly formulated is as solved.I promise to leaving you on your way...I am not against formulating the problem clearly.. Question to you. How would create a generic solution for what is basically a truss with a non-invertible stiffness matrix?Strut and tie is all about solving equations of equilibrium; it does not consider the stiffness of the elements. It can also be "unstable" from perspective of a stiffness matrix (a classic trapezoid strut and tie).My approach is to cycle through nodes of the model and solve equations of equilibrium. When the model is indeterminate, after the solution is done, I would substitute values for the unknowns not solved by hand as a ratio to some other unknowns (I have a lot of flexibility here since strut and tie is a lower bound approach).I am not against formulating a better approach / solution; it must be generic though. 1 user thanked Alex M. for this useful post. on 12/03/2016(UTC)
 Alex M. #7 Posted : 12 March 2016 21:00:16(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) There is wisdom in what you say and I might or might not continue on this path.Discussions like this are better done in-person - "correct" way of doing things is highly subjective and closely tied to a particular task to be accomplished.Anyway, from educations perspective, is the a way to solve the following without using Maxima: solveMaxima.sm (17kb) downloaded 28 time(s).Edited by user 12 March 2016 22:11:55(UTC)  | Reason: Not specified
 Alex M. #8 Posted : 12 March 2016 21:33:46(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Originally Posted by: ioan92 Alex,As now things get more sense. Always an example or a sketch tell more than a long speechNot importing on your mathematics tool you are in front of a mechanism case (physically speaking) that means that you have 3 equations and 4 unknowns.Such a system has a simply infinity of solutions.As I already said, you need a complementary condition to determinate the system from mathematical viewpoint.One solution is to take one of unknowns as parameter and to determine it with an optimization technique, for instance in respect with the energy.Three things here:- Would you happen to know the answer from my previous post? I would prefer not to use Maxima unless I have to...- A fake mechanism is quite typical in strut and tie, many of the typical solution-by-matrix will not work. Try to solve this (pin supports at each end of member) in any analysis software:The mechanism is implied, but non existent in reality (we are looking at a chunk of concrete). Solution is generated by satisfying equilibrium at nodes.- Im likely to revise my approach and define all conditions prior to, rather than after the solution - i appreciate your constructive criticism.
 Alex M. #9 Posted : 12 March 2016 22:10:35(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Originally Posted by: ioan92 Never mind Maxima, not necessarily to involve, even it is nice...For your case if you add a horizontal support on the upper chord, then you solve it (preferable with a general FEM tool) to see if in the external support there is no reaction, that's a good solution. O course if you choose a parameter and you look it (graphically, why not) you can handle problems.However you have 2 aspects where the human must act: propose a struts and ties pattern, choose mechanisms parameters and optimize to define them.What I can help you is with this FEM analysis tool.Of course I do not wont to interfere if you do not need.Myself, I'm also almost always a little bit nervous in front of some new problems...PS:In you case, if the 2 forces are not equals, you do not have equilibrium !In any case you must respect the equilibrium condition.Ioan, one of the reasons why I am not going the FEA way for this task, is because in my design office there is a strong opinion against it (not the best tool for the task? influence of late James MacGregor? - I do not know) Those zero force members almost always end up carrying some load.. Anyway - I must do it the sum(F.x) = 0 & sum (F.y) = 0 way.So if you, or anyone else know how to solve equations from post 11 the SMath way (3 equations, 4 unknowns, symbolic solution of 3 unknowns in terms of the 4th unknown) I would much appreciate it. So far I tried roots() and maxima's Solve(). Solve() works.Edited by user 12 March 2016 22:15:01(UTC)  | Reason: Not specified
 Alex M. #10 Posted : 12 March 2016 22:28:56(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Originally Posted by: ioan92 It's not a problem of somebody's knowledge on maths.So long as your system has more unknown then equations, the problem is with a infinity of solutions.Only if you add some conditions, you can hope for a solution; if not no miracle (marabou) hope...But of course, wait for some others lights.Why not, maybe we ignore some sides... You are correct - there are some other sides to it. One of them is that when there are 3 unknowns (3 struts whose force is unknown, one strut whose force is known) and two equations of equilibrium at the node, you can guess the ratio between the unknowns (say strut 1 has same load as strut 2 while strut 3 is different, and strut 4 is known). You can base your guess on stiffness, however you do not always know the stiffness before proportioning struts, ties, and nodal zones. You can base your guess on strut angle. You can even do a wild guess, and given the nature of strut and tie (lower bound solution) the structure will behave AT LEAST as good as your guess was, and most likely better (if your guess was incorrect the structure will find a better load path).So you always have same # of unknowns as # of equations. Except that some of the equations come from engineering judgement (difficult to program ), while others are from routine equilibrium.And I probably can setup my solution in a way that does not require solving 3 equations with four unknowns, but heck, for educational purposes, can SMath do it (and how)? Maxima can.I hope I explained myself wellEdited by user 12 March 2016 22:33:11(UTC)  | Reason: Not specified 1 user thanked Alex M. for this useful post. on 12/03/2016(UTC)
 Jean Giraud #11 Posted : 13 March 2016 05:05:58(UTC) Rank: Advanced MemberGroups: Registered Joined: 04/07/2015(UTC)Posts: 4,576Was thanked: 775 time(s) in 615 post(s) Originally Posted by: ioan92 As I know the apparently forum composition, it is not here the right place to "negotiate" such afine itemI decline too by honest faith, not my cup of tea.In some way, Mathcad Given/Find is kind of NLP[Non Linear Programming]. This type of mathsbelongs to my trade, but as plant optimisationrepresented im matrix form. Lucky for us, thereexist math packages doing such optimisation.Often, the problem is ill posed like one authorsaid that a 10000 x 10000 matrix reduced to aslow as 100 x 100. Jean
 Alex M. #12 Posted : 13 March 2016 05:29:53(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Originally Posted by: Jean Giraud like one authorsaid that a 10000 x 10000 matrix reduced to aslow as 100 x 100. JeanJean, would you happen to know how to find and remove reduntant rows from a coefficient matrix A, that happens to have more rows than columns:A x X = BX = A^-1 x B SolveEquationMaxima.sm (15kb) downloaded 14 time(s).Edited by user 13 March 2016 05:56:04(UTC)  | Reason: Not specified
 Alex M. #13 Posted : 13 March 2016 07:45:53(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Originally Posted by: Alex.M Originally Posted by: Jean Giraud like one authorsaid that a 10000 x 10000 matrix reduced to aslow as 100 x 100. JeanJean, would you happen to know how to find and remove reduntant rows from a coefficient matrix A, that happens to have more rows than columns:A x X = BX = A^-1 x BThis is solved using DotNumerics plugin.Thanks, Uni! SolveEquationDotNumerics.sm (10kb) downloaded 23 time(s).Edited by user 13 March 2016 08:07:09(UTC)  | Reason: Not specified
 Alex M. #14 Posted : 13 March 2016 08:02:23(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) And a little teaser of what I am working on... Everything you see was created by an EXCEL macro (from graphical representation perspective), solved in SMath and presented in EXCEL.Process of model creation / presentation / solution is fully automated.By the way, Ioan, SMath solution of this strut & tie worked from the very first attempt - felt like a miracle Edited by user 13 March 2016 08:06:42(UTC)  | Reason: Not specified
 Alex M. #15 Posted : 13 March 2016 08:58:50(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Originally Posted by: ioan92 Alex,I googled around the subject and I noticed an enormous quantity of documents, many dedicated to the experimental side.It seems that the treatment is often very specific to any concrete problem.For instance in the appended document ci2505wight.pdf (156kb) downloaded 25 time(s).they go to modify the physical height of the beam in order to satisfy the model, what's not usual in engineering.However, the subject is for specialists and therefor, I decline my intrusions; I'm a specialist but not in this item.It's strange for me to understand how they obtained that the reaction on the left support is 428k while a simple calculation gives 640*107/(107+53)= 361k and the beam is nothing that a simply supported beam. Does the beam know this forcing "joke" ?As I know the apparently forum composition, it is not here the right place to "negotiate" such a fine itemGood luck!IoanAnd this little guy took me about 20 minutes to setup.. Mostly defining coordinates and stuff. If the drawing was to scale I could have just located the nodes of my strut & tie graphically.
 Jean Giraud #16 Posted : 13 March 2016 09:12:49(UTC) Rank: Advanced MemberGroups: Registered Joined: 04/07/2015(UTC)Posts: 4,576Was thanked: 775 time(s) in 615 post(s) Hello Alex,Very imppressive and educative. I have done no Smath projectusing "Dot Numeric" yet. One thing at time. A vector thatcancels rows is one thing, though my understanding of Non-Linear Programming wrt your application is an iterative trial/error ... usually done via "While" loop for simplestuff solving for not conventionally solvable [one unknown],for more that one unknown, Smath is missing the program code"on error" for branching the "while" loop. I'm actually workingon a picewise continuous function [not solvable]. Smath comes close but never exact enough ... like Smath laughing hihihi !Thanks, be good: Jean 1 user thanked Jean Giraud for this useful post. on 13/03/2016(UTC)
 Jean Giraud #17 Posted : 13 March 2016 10:08:54(UTC) Rank: Advanced MemberGroups: Registered Joined: 04/07/2015(UTC)Posts: 4,576Was thanked: 775 time(s) in 615 post(s) ... just solved the "unsolvable". Ah ! the silent bugger.What is it ? the piecewise continuous function is very granular. So, "init" has to be pushed manually, surprise.Jean
 Ber7 #18 Posted : 13 March 2016 10:16:49(UTC) Rank: Advanced MemberGroups: Registered Joined: 15/07/2010(UTC)Posts: 343Location: Beer-ShevaWas thanked: 447 time(s) in 240 post(s) Originally Posted by: ioan92 It's strange for me to understand how they obtained that the reaction on the left support is 428k while a simple calculation gives 640*107/(107+53)= 361k and the beam is nothing that a simply supported beam. Small typo:640*107/(107+53)= 428 1 user thanked Ber7 for this useful post. on 13/03/2016(UTC)
 Jean Giraud #19 Posted : 13 March 2016 16:56:30(UTC) Rank: Advanced MemberGroups: Registered Joined: 04/07/2015(UTC)Posts: 4,576Was thanked: 775 time(s) in 615 post(s) Originally Posted by: ioan92 pas trop vite...; pas plus vite que ton ange gardien!Ioan[/quoteMon ange gardien: paresseux, il sieste dans la boîte à bois !Like in Mathcad, solving for a line crossing the circle.Too far away the guess => no solution. Close enough => one solution ... better guess => two solutions.Applying the constraining domain => two solutions. How do you optimise an elastic ? Cheers Collabs: Jean
 Alex M. #20 Posted : 13 March 2016 18:15:37(UTC) Rank: Advanced MemberGroups: Registered Joined: 03/03/2014(UTC)Posts: 402Was thanked: 119 time(s) in 92 post(s) Hi All,Did not expect this topic to spur such a conversation but hey, the more opinions the merrier! Very impressive and clean truss model, Ioan, looks great.Side thought - I am not really going "outside from the road" with my solution... simple force equilibrium at nodes. We can chat more.Alex
 Users browsing this topic
 2 Pages12>
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.