Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to process the attached formula 2

Status
Not open for further replies.
Replies continue below

Recommended for you

IDS, I'm a big fan of the Python eval function (and Python in general). Years ago I wrote a lightweight equation solver using that function. I wish I now had something similar for C++, although I suppose it wouldn't make sense being that it's not an interpreted language like Python. I wrote an equation parser/solver in C++ which I've been in the process of testing. Testing a ridiculous equation like this is useful to me.

rapt said:
It is the equation for the horizontal centroid of the compression force for a trapezoidal concrete section with the Eurocode concrete stress/strain diagram in C++ code
I don't think that sentence has ever been written before! I did a similar thing in deriving equations for concrete sections comprised of triangular regions. The math very quickly got out of hand. I would not trust myself to solve this kind of equation by hand.

271828, the 2nd "good" option is certainly much more readable to me. There are plenty of situations where an equation may be written correctly in terms of order of operations, yet still be unclear. For the general public and probably a few engineers, I wouldn't necessarily trust an equation like "y = A - B x C + D" to be interpreted correctly. But simply writing it as "y = A - (B x C) + D" instead is much more clear.
 
The good option of the same formula,

dy1 = (concconstb * depth * (12.0 * concconsta * concconsta * concconsta * strainslope * strainslope * widthslope * horizcentslope
- 6.0 * concconsta * concconsta * concconstb * (-2.0 * concconstc * strainslope * widthslope * horizcentslope + 2 * strainslope * strain0 * widthslope * horizcentslope + strainslope * strainslope * (2.0 * width0 * horizcentslope
+ 2.0 * widthslope * horizcent0 + widthslope * horizcentslope * depth))
+ 2 * concconsta * concconstb * concconstb * (-6.0 * concconstc * strain0 * widthslope * horizcentslope - 3.0 * concconstc * strainslope * (2.0 * width0 * horizcentslope
+ 2.0 * widthslope * horizcent0 + widthslope * horizcentslope * depth) + 3.0 * strainslope * strain0 * (2 * width0 * horizcentslope + 2.0 * widthslope * horizcent0 + widthslope * horizcentslope * depth)
+ strainslope * strainslope * (3.0 * width0 * (2.0 * horizcent0 + horizcentslope * depth) + widthslope * depth * (3.0 * horizcent0 + 2.0 * horizcentslope * depth)))
+ concconstb * concconstb * concconstb * (6.0 * concconstc * strain0 * (2.0 * width0 * horizcentslope + 2.0 * widthslope * horizcent0 + widthslope * horizcentslope * depth)
+ 2.0 * concconstc * strainslope * (3.0 * width0 * (2.0 * horizcent0 + horizcentslope * depth) + widthslope * depth * (3.0 * horizcent0 + 2.0 * horizcentslope * depth))
- 2.0 * strainslope * strain0 * (3 * width0 * (2.0 * horizcent0 + horizcentslope * depth) + widthslope * depth * (3.0 * horizcent0 + 2.0 * horizcentslope * depth))
- strainslope * strainslope * depth * (width0 * (6.0 * horizcent0 + 4.0 * horizcentslope * depth) + widthslope * depth * (4.0 * horizcent0 + 3.0 * horizcentslope * depth))))
+ 12.0 * (concconsta * strainslope + concconstb * concconstc) * (concconstb * strain0 - concconsta * strainslope) * (concconstb * width0 - concconsta * widthslope) * (concconstb * horizcent0 - concconsta * horizcentslope)
* log(concconsta + concconstb * depth)) / (12.0 * concconstb * concconstb * concconstb * concconstb * concconstb);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor