Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


2 Pages12>
Options
Go to last post Go to first unread
Offline Alex M.  
#1 Posted : 12 March 2016 10:53:43(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 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 account. New Registrations are disabled.

Offline Alex M.  
#2 Posted : 12 March 2016 11:16:42(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 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...
Offline Jean Giraud  
#3 Posted : 12 March 2016 16:52:53(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Non linear solver of some kind, poorly documented.
The Mathcad Given/Find would solve with an objective
function [my newbie interpretation]. The "M"
in the attached would solve "Pseudoinverse", posted
few weeks ago in the forum.

Polynomial fit_D[x].sm (19kb) downloaded 42 time(s).

Jean

thanks 2 users thanked Jean Giraud for this useful post.
on 12/03/2016(UTC),  on 12/03/2016(UTC)
Offline Alex M.  
#4 Posted : 12 March 2016 18:56:17(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 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?
solve error.png

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().
Offline Alex M.  
#5 Posted : 12 March 2016 19:22:32(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: ioan92 Go to Quoted Post
Alex,

Your problem is already solved in mechanics.
This means to make your equation system with a solution --> positive definite matrix.
In this purpose it is to add some additional constraints.
If you need a small help on that, I propose to you to define graphically the problem with known/unknown information and we will see easier how to find the unknown infos.
Normally, it is easier to do as usually engineers are doing - Cartesian technique - to decompose a new problem in small parts that have already solutions.


I will be working on this this weekend; once I give it a fair shot I will post my results or ask for help.

The tricky of what I was attempting to do was to assign the constraints once the symbolic solution to a system of equilibrium equations is known, e.i. once you know which variables depend on each other, I would make a judgement call to establish a relative ratio of the two (or more) codependent variables (one can alway guess which strut will carry more or less load at the node that has more unknown strut forces that equations of equilibrium).

In this case matrix is not positive definite (more unknowns than equations) when the solution is requested at first. I do not want to rely on FE / stiffness matrix to obtain a positive definite solution matrix, since by its nature, the most straight forward strut and tie solution is often the one that would make stiffness matrix non-invertible.

I know I sound confusing right now, please bear with me :-)

Anyway this is work in progress and once Im getting somewhere I will open up a new thread.

Edited by user 12 March 2016 19:24:20(UTC)  | Reason: Not specified

Offline Alex M.  
#6 Posted : 12 March 2016 19:46:35(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: ioan92 Go to Quoted Post
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.
thanks 1 user thanked Alex M. for this useful post.
on 12/03/2016(UTC)
Offline Alex M.  
#7 Posted : 12 March 2016 21:00:16(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 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.png
solveMaxima.sm (17kb) downloaded 44 time(s).

Edited by user 12 March 2016 22:11:55(UTC)  | Reason: Not specified

Offline Alex M.  
#8 Posted : 12 March 2016 21:33:46(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: ioan92 Go to Quoted Post
Alex,

As now things get more sense. Always an example or a sketch tell more than a long speech
Not 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:
201501121015359155.jpg
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.
Offline Alex M.  
#9 Posted : 12 March 2016 22:10:35(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: ioan92 Go to Quoted Post
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

Offline Alex M.  
#10 Posted : 12 March 2016 22:28:56(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: ioan92 Go to Quoted Post
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 Crazy ), 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 well

Edited by user 12 March 2016 22:33:11(UTC)  | Reason: Not specified

thanks 1 user thanked Alex M. for this useful post.
on 12/03/2016(UTC)
Offline Jean Giraud  
#11 Posted : 13 March 2016 05:05:58(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: ioan92 Go to Quoted Post
As I know the apparently forum composition, it is not here the right place to "negotiate" such afine item


I 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 maths
belongs to my trade, but as plant optimisation
represented im matrix form. Lucky for us, there
exist math packages doing such optimisation.
Often, the problem is ill posed like one author
said that a 10000 x 10000 matrix reduced to as
low as 100 x 100.

Jean



Offline Alex M.  
#12 Posted : 13 March 2016 05:29:53(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
like one author
said that a 10000 x 10000 matrix reduced to as
low as 100 x 100.

Jean



Jean, 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 = B

X = A^-1 x B



SolveEquationMaxima.sm (15kb) downloaded 20 time(s).

SolveEquationMaxima.sm.png

Edited by user 13 March 2016 05:56:04(UTC)  | Reason: Not specified

Offline Alex M.  
#13 Posted : 13 March 2016 07:45:53(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: Alex.M Go to Quoted Post
Originally Posted by: Jean Giraud Go to Quoted Post
like one author
said that a 10000 x 10000 matrix reduced to as
low as 100 x 100.

Jean



Jean, 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 = B

X = A^-1 x B


This is solved using DotNumerics plugin.

Thanks, Uni!

SolveEquationDotNumerics.sm (10kb) downloaded 34 time(s).

Edited by user 13 March 2016 08:07:09(UTC)  | Reason: Not specified

Offline Alex M.  
#14 Posted : 13 March 2016 08:02:23(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 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 Clap

S&T.png

Edited by user 13 March 2016 08:06:42(UTC)  | Reason: Not specified

Offline Alex M.  
#15 Posted : 13 March 2016 08:58:50(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: ioan92 Go to Quoted Post
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 28 time(s).they go to modify the physical height of the beam in order to satisfy the model, what's not usual in engineering.
alex2.png

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 item

Good luck!
Ioan


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


S&T2.png
Offline Jean Giraud  
#16 Posted : 13 March 2016 09:12:49(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Hello Alex,

Very imppressive and educative. I have done no Smath project
using "Dot Numeric" yet. One thing at time. A vector that
cancels 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 simple
stuff 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 working
on a picewise continuous function [not solvable]. Smath comes
close but never exact enough ... like Smath laughing hihihi !

Thanks, be good: Jean

thanks 1 user thanked Jean Giraud for this useful post.
on 13/03/2016(UTC)
Offline Jean Giraud  
#17 Posted : 13 March 2016 10:08:54(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 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
Offline Ber7  
#18 Posted : 13 March 2016 10:16:49(UTC)
Ber7


Rank: Advanced Member

Groups: Registered
Joined: 15/07/2010(UTC)
Posts: 437
Man
Israel
Location: Beer-Sheva

Was thanked: 520 time(s) in 288 post(s)
Originally Posted by: ioan92 Go to Quoted Post

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
thanks 1 user thanked Ber7 for this useful post.
on 13/03/2016(UTC)
Offline Jean Giraud  
#19 Posted : 13 March 2016 16:56:30(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: ioan92 Go to Quoted Post
pas trop vite...; pas plus vite que ton ange gardien!

Ioan[/quote

Mon 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

Offline Alex M.  
#20 Posted : 13 March 2016 18:15:37(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 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.