Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Greetings.
The code (painted red on the worksheet) is delayed when I change the data, I would like to know if there is any way to lighten it.
Also, I do not know if there is any way to create a function that when entering the data (painted with blue in the worksheet), get the results "Reactions" (painted in yellow on the worksheet) -that would help me a lot - or also some way to keep the code waiting until you enter the data.
The code that I programmed is to find the "fixed end moments" of distributed loads, until now I have only checked it with the cases that appear in the sheet in screenshots.
If I understand correctly you find it annoying that when you change the four input values Mathcad starts its calculation as soon as you changed the first and works calculating your integrals while you change the second, etc.
One way out would be to put all input values in a vector. As long as the focus/cursor is in the vector Prime will not recalculate.
According your integrals: Its bad habit to use the variable of integration also as a limit. While Prime will accept that notation its mathematically incorrect. For example instead of writing
you should write something like
Also a bit confusing in your multiple integrals is the multiple use of the same variable of integration. Is this really as it should be?
Which of the two results is the correct one:
If its the first as used in your sheet, you may consider a notation like
Addendum: Creating a function with the four input values as argument and the yellow results as return value would require you to rewrite all calculations and turn them in functions depending on the four inputs.
So the first would be to change q(z) to q(z,q1,q2,L1,L2):=...
The same is true for your various multiple integrals and the solve block. You will have to turn all them them into functions of the inputs.
The next picture shows how you could turn the solve block into a function and use it.
I also used Lucs simplification of the if-construct.
all good, but when I want to get the results I get an incompatibility of units.
I guess in your first equation it should read A1, not A0.
In the various functions A with the intergrals the first function argument should not be z, or z.1 but rather L.v. Otherwise this argument would not have any effect and could be omitted.
The sheet you posted does not define values for z,q1, q2, L1, or L2. The function evaluation fails. Define values and it works.
@Fred_Kohlhepp wrote:
The sheet you posted does not define values for z,q1, q2, L1, or L2. The function evaluation fails. Define values and it works.
The plot for q can be done after the variables are defined as well as all the other plots from the former sheets.
The former sheet was turned into a function as desired - the variables should not be defined at the top!
The main problem was that the solve block fails as of unit mismatch and the reason was a typo (he wrote A0 instead of A1).
The next problem is that now calculation takes very, very long. Its needed to create an aux-function which precalculates the integrals.
Maybe I'll send a modified sheet later this evening.
If you have already tried, then you will have found that after correcting your typo (A0->A1) the calculation now takes almost endless. The reason is that now the time-consuming multiple integrals A, A0, A1, A2 are recalculated again and again at each iteration step of the solve block.
So I added an auxiliary function which first calculates the integrals (fortunately they do not depend on the solved for variables R1,R2,M1,M2) and then calls the solve block function which now has those four values as arguments.
I have left Lv as a parameter so that it can also be changed on the last program call.
If you rather like to hard code it you can define Lv at the top (as you had done) and delete Lv in the parameter list of all functions.
Worksheet in P4 format attached.
In that case, i think a slightly superior way is to use a table as input. I've switching to most of my input being in a one row table. It keeps it organized, compact and you can change as many as you want before it recalculates. And so long as it's one row it isn't treated as a vector.
You are right. A table is nicer than the vector I suggested.
Here you see that I don't use Prime regularly or for anything serious. Just when its necessary to answer a question here in the forum. So I still have not gotten used to those tiny improvements which even Prime can offer.
The table could also be used at the end of the new sheet with the functional approach I posted before.