cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Translate the entire conversation x

Symbolic solver unit conversion with further substitution

Ivan_Pat
12-Amethyst

Symbolic solver unit conversion with further substitution

Dear PTC Mathcad Community,

I want to ask for clarification on the behaviour of units and symbolic substitution in Mathcad Prime (similar topics have already been raised, but I still haven't found an appropriate answer for my issue).

 So I try to find a symbolic expression for epsilon_c2, which is a parameter of the equation N.

Solver succeeded with the issue, but with incompatible units (see picture)

Ivan_Pat_0-1765875279227.png

So, I have tried to find out the solution in the community, but the advice of @Werner_E  with calculation options didn't resolve the issue (see the picture)

Ivan_Pat_1-1765875431392.png

So my issues are: 

1. How to make the symbolic solving more "seamless" with appropriate units' manipulation in the solutions?

2. Why does Mathcad not see the assigned values of the  epsilon_c2 obtained in the previous solution?

Ivan_Pat_2-1765875677338.png

 

After some time, when the file has been refreshed, some magic happened, and now I can use the roots of epsilon c1 and c2 in a "normal" manner.

Ivan_Pat_1-1765882285970.png

But the next issue is that it doesn't let me substitute the obtained symbolic solution into the following step calculation for the moment M calculation.

Ivan_Pat_0-1765882122108.png

As it can be seen, the factual equation is real, with proper units,

Nevertheless, Mathcad is still not satisfied with...

 

I am still convinced of Mathcad's power, but each time I get stuck with such a misunderstanding of Mathcad logic, I feel broken, exhausted and unable to continue to the next step - automation of my manual solution.

 

Any clarification, examples, or references to documentation would be greatly appreciated.
I am trying to align my workflow with my Mathcad Prime 10.0.0.0 internal logic rather than fight against it.

Thank you very much for your time and support.

 

The file with the manual calculation of M is attached.

 

ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald IV
(To:Ivan_Pat)

The best way of using the symbolic solver is to use it with symbols only. That is:

- Do NOT use units.

- Do NOT use floating point numbers ( integers are OK, instead of 0.5 use 1/2, instead of 1.414... use √2 ).

It means that any variables you use in the symbolics are not assigned a (numeric) value.

To obtain numerical results, you best assign the result of the symbolics to a function of all required variables and call that function with the numeric values, including their units.

So instead of:

LucMeekes_0-1765890859949.png

do:

LucMeekes_1-1765890898351.png

Oh, and in case you are not interested in the symbolic solution, and you just want a numeric solution, then use a numeric solver (solve block, root() function or other suitable numeric function) instead of a symbolic one.

 

Success!
Luc

View solution in original post

17 REPLIES 17
LucMeekes
23-Emerald IV
(To:Ivan_Pat)

The best way of using the symbolic solver is to use it with symbols only. That is:

- Do NOT use units.

- Do NOT use floating point numbers ( integers are OK, instead of 0.5 use 1/2, instead of 1.414... use √2 ).

It means that any variables you use in the symbolics are not assigned a (numeric) value.

To obtain numerical results, you best assign the result of the symbolics to a function of all required variables and call that function with the numeric values, including their units.

So instead of:

LucMeekes_0-1765890859949.png

do:

LucMeekes_1-1765890898351.png

Oh, and in case you are not interested in the symbolic solution, and you just want a numeric solution, then use a numeric solver (solve block, root() function or other suitable numeric function) instead of a symbolic one.

 

Success!
Luc

Hi Ivan,

You have set out to produce a reinforced concrete section moment-curvature diagram.

Want to help you but things vary from country to country.

Going back to your last post you have the polynomial coefficients for the shape of the concrete stress-strain block.

Can you show me a plot of the stress-strain block using these polynomial coefficients and values of relevant strain points as this is one of the things that vary between countries.

 

The problem can be solved without symbolics but using parametrized solve blocks, and root functions. 

 

Can you describe what the symbol gamma, and squiggly N are in equations 4.2.4?  Draw a diagram.

 

Look forward to hearing back.

 

Cheers

Terry

 

@terryhendicott 

Hi Terry!

Glad to see the community members are interested in resolving my issue.


@terryhendicott wrote:

Hi Ivan,

You have set out to produce a reinforced concrete section moment-curvature diagram.

Want to help you but things vary from country to country.

Going back to your last post you have the polynomial coefficients for the shape of the concrete stress-strain block.

Can you show me a plot of the stress-strain block using these polynomial coefficients and values of relevant strain points as this is one of the things that vary between countries.

 


As you correctly mentioned, the moment-curvature "comprehensive" diagram could be represented by different equations:

1. Here, in our Code (Ukraine) two possible ways are possible (formula (3.4) or (3.5):

Ivan_Pat_0-1765892825879.png

Ivan_Pat_2-1765893052835.png

 

Where ak- polynomial coefficients (5), for each grade of concrete, is taken from Appendix D

Ivan_Pat_1-1765892928955.png

The difference between the curves, realised by our Code and the formula, which is used in Europe, may be in the USA, if I'm not mistaken, is not significant. To prove this, I compared the two curves in Excel.

Ivan_Pat_4-1765894015134.png

 

As you can see, both dependencies are pretty similar and close to each other.


...

The problem can be solved without symbolics but using parametrized solve blocks, and root functions.


I'd like to hear from you a simple example of how the ROOT function can be implemented here.

Thanks a lot for your interest in my topic.

Hi Ivan,

The stress strain curve is intrinsic to the calculation of the moment-curvature do you think you can give me the Excel sheet behind your graph so I fully understand both methods.

 

Cheers

Terry

@terryhendicott 

Hi Terry,

The abovementioned graph shows only the concrete behaviour.

I guess it will be pretty helpful. Orange cells have a pop-up menu for convenience. Yellow cells are connected to formulae and shouldn't be changed.  


@terryhendicott wrote:

Hi Ivan,

You have set out to produce a reinforced concrete section moment-curvature diagram.

Want to help you but things vary from country to country.

...

The problem can be solved without symbolics but using parametrized solve blocks, and root functions. 

 

Can you describe what the symbol gamma, and squiggly N are in equations 4.2.4?  Draw a diagram.

 

Look forward to hearing back.

 

Cheers

Terry

 


Hi Terry!

The squiggly N  is the Hebrew character Alef. 

Alef (א) in equation (4.3)  is the curvature of the beam and is equal to א = (ec1-ec2)/h

Gamma (γ) is the (ec1/ec1_cd) which does not contain ec2.

Can you make a sample of your own on how to use parametrised solve blocks and root functions? 

Looking forward to hearing from you.

 

Ivan_Pat
12-Amethyst
(To:LucMeekes)

@LucMeekes  Thank you a lot, Luc. I'll consider it.

By the way, I got the result in my file.

Ivan_Pat_0-1765892004868.pngIvan_Pat_1-1765892149776.png

Ivan_Pat_2-1765892314550.png

The script works as it should.

Ready for the routine programming.

 

Ivan_Pat
12-Amethyst
(To:LucMeekes)

@LucMeekes 

Hi Luc,

Maybe you can assist with my next question:

Ivan_Pat_0-1765915103111.png

I guess that it is impossible for Mathcad, but I still ask:

Whether I want to obtain a symbolic result with a condition that contains the desired variable, can this be realised somehow in Prime?

It is crucial because if my symbolically derived value of epsilon_c2 leads the highlighted equation to a value greater than f_yd, it must be readjusted. ( I hope the SOLVE block will give me the chance to eliminate iterations with WHILE and FOR loops...😒

 

Sorry for annoying you. Knowing that I almost got to the point of resolving the issue, but embedding my condition in compliance with Mathcad syntax is hardcore...It really makes me crazy.
Maybe there are more tricky methods to get the correct value of epsilon_c2 that satisfies the condition???

Prime 10.0.0.0 file is attached. 

 

Werner_E
25-Diamond I
(To:Ivan_Pat)

The symbolic tries to evaluate the expression symbolically which means without knowing concrete values. Therefore branches and other conditions can't be evaluated.

The second argument ec2 in your function N() makes no sense as ec2 is the variable you are solving for.

Instead of your if..else.. you could use the "min" function, but this will not help with the symbolics.

Werner_E_0-1765921073757.png

 

I have not followed the complete thread and I have no expertise whatsoever in your field of work, but I wonder why you would use the symbolic solve.

 

You could use the root function. Your function N() seems to have a pole at ec2=ec1 (N-> inf) so I assume that you are looking for an ec2 > ec1.

One way to use the root function without a guess value would be that way:

Werner_E_1-1765921219405.png

 

Given your value of ec1 we get

Werner_E_2-1765921268885.png

 

I don't know what you intend to do with a function which returns ec2 depending on ec1 and I am not sure which values of ec1 you intend to feed into this function. I noticed that my attempt fails for values of ec1 larger than approx. 0.006393.

I have not investigated further, why, but it looks to me that there simply is no solution for larger value of ec1.

Werner_E_3-1765922513092.png

 

Prime 10 sheet attached

 

 

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Werner_E Hi Werner,

Thanks for your attempt to help, first of all.

The issue I've been messing with for the last week concerns non-linear concrete behaviour, which can be described with a "full state diagram": Moment-curvature.

The point here is that there are two equations (N and M), so the ec2 is the strain, which can be iteratively assigned to the equations to obtain the equilibrium. The value of ec2 is the input data for the following equation (M), which calculates the bending moment. 

This is the brief explanation. I'm not sure it added anything to your understanding. Still, the bottom line is that I used symbolic to eliminate the FOR and WHILE loop calculations, which are pretty tricky to create correctly in MathCAD.

I wanted to solve symbolically for the roots where the function N(ec1, ec2) equals zero. Then, by checking the conditions, to calculate the bending moment M and so on for ec1=01.,..1*ecu1,cd. by eliminating the WHILE and FOR loops.

I still know little about how to make the iteration correctly.

Ivan_Pat_0-1766177358143.png

Actually, I want to analyse my data with smth like this, where ec1 is predefined, as you see, and ec2 is calculated, which influences both sigma_s1, sigma_s2, and sigma_s3, as well as the curvature (ALEF) and moment M.

Ivan_Pat_1-1766177460608.png

Finally, there were some mistakes in my formulae that I fixed, but I'm still stuck.

Prime 10 attached.

 

 

 

Werner_E
25-Diamond I
(To:Ivan_Pat)

I have no experience whatsoever in your field of work and can't comment on concrete behaviour, moment curvature, etc. but I don't see a system of two equations in your extensive explanations so far.

What I had seen so far are the assignments of functions N and M (it seems to should be a function) and it looks like both should be dependent on ec1 and ec2:

Werner_E_0-1766184065320.png

and

Werner_E_1-1766184086842.png

The definition of M seems to be erroneous (unit mismatch).

 

Now you have the equation

Werner_E_2-1766184158119.png

but i don't see the second equation, which may

Werner_E_3-1766184196406.png

 

Once you actually have two equations you could try to solve them symbolically for ec1 and ec2 (not sure if Prime is capable enough to do so) or you could use a solve block to do so. In case there are more solutions, a solve block would only give you one of them. Which one you will get depends on the guess values you provide.

 

 

 

 

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Werner_E Hi Werner!

Thank you for your interest in the problem and for your help with the issue.

You figured out the mistake in the units of the M equation. The proper equation for N (4.3) and M  (4.4) should be as follows:

Ivan_Pat_3-1766222372664.png

In general we'll have such an  M(ec1, ec2) equation:

Ivan_Pat_4-1766222700380.png

 

 

 

As you correctly noticed, two functions should be treated simultaneously, one after the other, in the following way:


@Werner_E wrote:

I have no experience whatsoever in your field of work and can't comment on concrete behaviour, moment curvature, etc. but I don't see a system of two equations in your extensive explanations so far.

What I had seen so far are the assignments of functions N and M (it seems to should be a function) and it looks like both should be dependent on ec1 and ec2:


1. On the first step, we start to solve the governing equation, where N=0 by substitution on the first step the ec1=0.1*ecu1,cd (where ecu1,cd - ultimate strain value of each grade of concrete, is known) and ec2=0.02*ec1,cd, by controlling the stress value in reinforcement σs (that should not be greater, than fyd - limit design stress of the reinforcement).

Ivan_Pat_0-1766221324121.png

If the ec2 of governing equation is bigger than that, which leads to stress fydi in the reinforcement Asi, we assume that root (ec2) of the equilibrium equation (4.3)  as the solution and reassign it to the equilibrium equation 4.4 for moment (M):

 

Ivan_Pat_2-1766221953414.png

 

The obtained value for the moment will be the first point of the state diagram "Moment-curvature".

The cycle will continue until we reach ec1=ecu1cd.

 

Werner_E
25-Diamond I
(To:Ivan_Pat)

It looks to me that you confuse 'equation' with the definition of functions or variables.

This

Werner_E_0-1766233436714.png

is an equation, but this

Werner_E_1-1766233534795.png

is just the definition/assignment of a variable, not a second equation.

 

When I look at the equations 4.3 and 4.4 I miss the variables ec1 and ec2 which you concentrate on.

It looks to me that these variables are hidden in א and also in gamma?

 

So if the goal should be M=0 then we would have two equations which we could easily solve for ec1 and ec2.

Otherwise I won't know what the calculation should be as your description still is too technical for me. Maybe someone with experience in your field of work can help.

Ivan_Pat
12-Amethyst
(To:Werner_E)

@Werner_E Yes, you are right. I messed up the definition of the equation and the assignment here. As well, you are also right in the assumption that moment M in Equation (4.4) is the function of ec1 and ec2, where ec2 is a calculable argument from Equation (4.3) and ec1 is the iterable of ecu1_cd (known limit strain of concrete grade, which we put in the Equation (4.3) for the fitrst time ec1=0.1*ecu_1cd, for the second ec1= 0.2*ecu1_cd, and so on until ec1=ecu1_cd.

On each iteration of ec1, the ec2 is to be found. From Equation (4.3) under condition (fyd) and substituted afterwards into Equation (4.4) to find the i-th moment M value of the state diagram "Moment-curvature".

The moment is to be calculated after the ec2 led to zero in equation (4.3)

You are partially correct in:


@Werner_E wrote:

When I look at the equations 4.3 and 4.4 I miss the variables ec1 and ec2 which you concentrate on.

It looks to me that these variables are hidden in א and also in gamma?

 

Alef (א) in equation (4.3)  is the curvature of the beam and is equal to א = (ec1-ec2)/h

Gamma (γ) is the (ec1/ec1_cd) which does not contain ec2.

The goal is to find ec2 from Equation (4.3) under the condition of fyd and to substitute it into Equation (4.4)  where the moment M is to be calculated.

Equation (4.3) with double layers of reinforcement (As1 and As2)  will be as follows.

Ivan_Pat_1-1766246591314.png

We have to solve it with respect to ec2, subject to the condition:

Ivan_Pat_2-1766246835938.png

Ivan_Pat_3-1766246856449.png

Where fydi= yield strength of i=th reinforcement layer. If ec2 found in Equation (4.3) exceeds the ec2 that led to the left side of the expression Ivan_Pat_2-1766246835938.png to be bigger than fyd, then we need to use that  value to substitute into Equation (4.4) to find the factual moment M according to 

Ivan_Pat_4-1766247125157.png

And so on until we finish the iteration cycle with ec1 = ecu1_cd.

 

 

 

Werner_E
25-Diamond I
(To:Ivan_Pat)

I had already shown how to calculate ec2 for every ec1 using the "root" function and assuming that ec2 >= ec1.

I was not aware of additional constraints which you call fyd.

So there are three additional constraints that some expressions must be smaller than fyd]1,2,3 ?

You would have to use a solve block instead of the "root" function to be able to add additional constraints.

Are you sure that there is a solution for ec2 for every ec1 given that three additional constraints? As far as I had seen in the sheet I posted, the solution was unique even without any additional constraints...

 

Or are you trying to increase ec1 until you find a solution which fulfills all three constraints?

 

As I understand it, M has nothing to do with finding appropriate values for ec1 and ec2.

 

You may consider posting your sheet containing the corrected definition of M and also the constraints you were talking about.

Ivan_Pat
12-Amethyst
(To:Ivan_Pat)

@Werner_E @terryhendicott @LucMeekes 

💪Almost excellent! I got the follows:

Ivan_Pat_0-1766251464890.png

The two questions to experts arose:

1. How to modify the graph with ec1_0=0, in other words, how can I do the plot starting from the beginning of the coordinates?

2. By having the data in matrices like

Ivan_Pat_1-1766251647807.png

How can I obtain a more "seamless" view of the matrix like

Ivan_Pat_2-1766251731815.png

I'll be very grateful for any assistance in this regard!

Prime 10.0.0.0 is attached.

 

 

Werner_E
25-Diamond I
(To:Ivan_Pat)

With ec1=0 your calculations will result in a division by zero.
So what should be the values for all the variables in your table when ec1=0 ?

You will to have to add them atop (using stack) manually after calculating all the other values or you consider the case ec1=0 via if-statements in your program to avoid the division by zero. In the latter case you could use 

Werner_E_0-1766255837874.png

at the start of your program, but with the calculations given you would end up with a division by zero error.

 

Otherwise see my comments and modifications highlighted in red in the attached Prime 10 sheet.

Announcements

Top Tags