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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Please Help me with this bug - Integral functions and plotting

PH_9740325
3-Visitor

Please Help me with this bug - Integral functions and plotting

Hi all, I am new to MathCAD and i can just not figure out this bug. 

I am trying to plot a chart for beam deflection on prime4. I am using an old mathcad15 sheet as a reference and the cad 15 sheet calculates it fin so this should work but I cannot figure out why it's giving me an error. 

 

PH_9740325_0-1607014677259.png

PH_9740325_1-1607014724267.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

I need to point out that both of you have run afoul of the "English Units" tribulation.

 

"lb" is a unit of mass.  We're dealing with forces (lbf)

 

Attached is Werner's sheet modified (sorry Werner) to correct unit issues (including degrees.)

 

I only have Express, if opened in full Mathcad it should calculate properly.

View solution in original post

16 REPLIES 16

Even though Prime would accept its its bad math to use the same variable as limit and variable of integration like in

Werner_E_1-1607042984565.png

But as Prime is unit aware, you must even add the unit to a value of zero. This is different to real Mathcad which uses static unit checking. So a correct approach would be something like

Werner_E_2-1607043053204.png

Doing this consequently gives you

Werner_E_3-1607043416113.png

BTW, you should Prime let do the conversion from radian to degree and vice versa for you. There is a predefined constant/unit factor "deg" which is pi/180.

 

 

 

Thank you so much!! i will give this a go and report back! it looks like this will work!

The only thing really necessary is to add a unit of length to the lower integral limit.

I also deleted the constant functions E and I because I see no reason for defining them. If you need them later you might re-add them, of course.

 

yes, I did this and also deleted the constant functions. for some reason prime seems to think i have not defined 'x' 'y' and 'slope'. I'm baffled as to why.

It says to check that the label is set correctly. 

"I also deleted the constant functions E and I because I see no reason for defining them. If you need them later you might re-add them, of course."

 

Just to clarify (since you're commenting in an area that I spent my career dealing with):

  • "E" refers to Young's Modulus, the ratio of stress to strain.  This is a material property (this example is probably steel), and you're right--it will be a constant along the beam unless the beam is a composite of different materials that change along the span.
  • "I" is the second area second moment (closely related to second mass moment of inertia) and depends on the dimensions and shape of the beam cross section.  If the shape or dimensions of the beam change along the span then I will have to be a function of position.  

Okay!  Lecture over.  Werner, as always you very efficiently answered the question; I'm just in a lecturing mood this morning!  😉

Thanks for lecturing 😉

In fact, I hadn't thought for a moment about what the formulas might mean and analyzed them on a purely formal level. Admittedly, I have no competence in this area, so I'm always happy when someone with the relevant expertise looks over it again.

Ok, so it is still telling me that the variables are undefined. 

I don't see how this could be the case. 

PH_9740325_0-1607044547088.png

 

This is probably because you still have defined E:=E(x) and so you overwrite the variable E (which is used in the integral) with the function of the same name.

Either delete the definition of E(x) as I did or use E(xi) in the integral.

If thats not the problem, you'll have to attach your modified worksheet

 

I just saw your question in the other thread and that you had attached your modified worksheet.

The problem was an error in Primes auto-labelling. Some x and xi were labelled differently (and so were seen as different variables) and also the name "slope" in the integral for y(x) had a different label and the y errenously was labelled as "function" and not as "variable". Wrong autolabelling often occurs in Prime and is very nasty and annoying - most often it occurs when expressions are edited and simply retyping them from scratch often is quicker then looking for which name is labelled wrong.

Another error was that you forgot to add the length unit to the lower limit of the integral for M(x).

Next error was that you typed numeric evaluations (=) after the definition of the functions "slope" and "y". You can't do that - what kind of result do you expect from f(x):=x^2=...? So those equal signs must be deleted.

I also modified the function V(x) (replaced x=l by x>=l in the last if-statement) - reason is that the function should return a value for every possible input x even though you later avoid to call it with valued higher than l.

 

I attach the working sheet (Prime 6 format).

 

I need to point out that both of you have run afoul of the "English Units" tribulation.

 

"lb" is a unit of mass.  We're dealing with forces (lbf)

 

Attached is Werner's sheet modified (sorry Werner) to correct unit issues (including degrees.)

 

I only have Express, if opened in full Mathcad it should calculate properly.

Absolutely no need or reason to be sorry, Fred.
Thanks for looking over the sheet and cleaning up the units.

Yes, sheet calculates properly (of course recalc is necessary after opening). Only changes which are left to do are the units in the ordinate placeholders in the plots for V and M.

One last note:  there are ways to avoid programing (so you can get by with Express!

Fred_Kohlhepp_0-1607096659421.png

 

A couple of nested if-functions should do the job in Express, too, but your version sure is more clear.

 

BTW, can it be that you introduced an error when you posted the last sheet with the fixed units.

I reads Maximize(M(x),x) but it should be just Maximize(M,x)

 

 

"

BTW, can it be that you introduced an error when you posted the last sheet with the fixed units.

I reads Maximize(M(x),x) but it should be just Maximize(M,x)"

 

"Maximize is a Premium function, . . . I was guessing since root requires the function arguments.


@Fred_Kohlhepp wrote:

"

BTW, can it be that you introduced an error when you posted the last sheet with the fixed units.

I reads Maximize(M(x),x) but it should be just Maximize(M,x)"

 

"Maximize is a Premium function, . . . I was guessing since root requires the function arguments.


Yes, that's right, the syntax in Mathcad isn't always very consistent.

TO ALL 

 

Thank you all for your very helpful and quick responses. 
The update is that I finished the full sheet!! 

 

I was very surprised and happy to see the activity and enthusiasm on this site! 

 

I have gained a higher level of understanding of this tool that is new to me and hope to keep learning!!

Top Tags