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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Substitution and Differentiation Issues

Anousheh
10-Marble

Substitution and Differentiation Issues

Hello everybody,

Would you please open the attached worksheet and see if you can help.

My questions are there.

Thank you so much for your time,

Anousheh

15 REPLIES 15

The symbolic math of Mathcad do not love the if function - see please the attach.

Hello Valery,

Thank you for the reply.

1- This is a "Re" part of the function. Why we have Im(lambda)?

2- What happens to m after substitution?

Thank you,

Anousheh

Anousheh Rouzbehani wrote:

Hello Valery,

Thank you for the reply.

1- This is a "Re" part of the function. Why we have Im(lambda)?

Sorry, it is your not my function

2- What happens to m after substitution?

Replase m to m1 and see what happend!

Thank you,

I am still not sure about Re part of the function and why there is Im part too!!

And same thing for m. Why m disappears when differentiating?

Thanks for your time,

Anousheh

Werner_E
25-Diamond I
(To:Anousheh)

It could help if you clean up the confusion with your variables/parameters/constants Q, m and k and then repost your sheet. Obviously the meaning of these three is not the same throughout your sheet. At the top you set specific values for Q and calculate k and m. If these three assignment should be meant to just show a relationship you should have used the boolean equal sign. The way you did it, k is assigned sqrt(2)/2 and m gets the value sqrt(2). This has no effect as long as k is calculated locally in your program and as long as m is a function parameter.

But when you differentiate uk(lamda,m) m is replaced by sqrt(2) (and not sqrt(2)-1 as you thought).

Its not clear to me what your function uk should be dependent of (other than lamda). It is too confusion as you define a function uk several times but while you don't change the name of the function the parameters have a different meaning every time. Using am extern variable Q in you second definition of uk(lamda,m) is possible, but not preferrable. And then I thought k should be 1/m?

Hello Werner,

Thank you.

You're right. I removed m=1/k and the symbolic differentiation returned the right expression. The program reads m=sqrt2 which comes from m=1/k. Therefore this has solved the problem. Thanks.

Would you please, when you have spare time, give me some explanation regarding questions 1,2 and 4?

Appreciate your help.

Anousheh

PS Updated worksheet is attached.

Hi Anousheh,

I've reduced the file down to the last definitions of the functions (attached).

First , the easy one.

To the problem of not displaying the horizontal sections, you will need to apply some programming to calculate the value, then compare it against the condition you want to stop & return NaN (not a number) when the condition is met.

Graphing functions thrn ignore all the NaN points & the section is removed.

You will need to be careful that this does not cause new problems with your full mathcad sheet.

The differences between function uk(... & duk(...

1. the definition for m uses the boolean equals so it is not defined numerically.

2.

the definition for duk(lambda,m) sets m as a parameter so all of the uses of m in the function use the value given in the graph function call (1.5, 1.75 & 2) so the result is always defined by these values.

the definition for uk(lambda,m) is similar & m is defined to the same values as duk, but ... it also uses k which does have a relationship back to Q & so this function will vary with Q.

Regards

Andy

Hello Andy,

Thank you so much for your time and great help.

I appreciate this very much.

Your input and those of Werner helped me a great deal.

Thanks again and all the best,

Anousheh

Werner_E
25-Diamond I
(To:Anousheh)

I am still confused about your function uk and I am speaking of the final one with parameters lamda and m, not the first one which should be renamed anyway.

In this definition you have parameter m but you use Q and calculate k from a value outside. So the relationship beween m an k (one being the reciprocal value of the other) which you postulated at the top is violated and k takes the value of sqrt(2)/2 for every call of uk as long as you don't change Q at the top. Is that really what you want?? I doubt it . This is also the reason why the derivative of uk is missing variable k - it gets replace by the constant value.

According the questions 1 & 2 Valery gave the answer - symbolics don't like functions with if conditions. If the if's are used to set a function to zero for certain intervals of the argument this could be rewritten using the Heaviside function, but as you want to have NaN's this would not be an option. Also derivatives of functions defined that way look very nasty 😉

As to question 4 I guess Andy has provided a solution.

According the NaN: This trick to get away with unwanted plot section was given to you by Valery (http://communities.ptc.com/message/196754#196754) and was meant for plotting purposes only. So you should not apply it to the top of your worksheet and try to differentiate that function, etc.

Werner_E
25-Diamond I
(To:Anousheh)

In addition to my last remarks - take a look at the attached, cleaned up worksheet. I still think that you have a confusion and misanderstanding considering the relationships of your various m,k and Q and the dependencies of your functions. But even I fear that the attached worksheet is not exactly what you want (while its what you demanded according to your statements) it should help you to derive your own version of what you want as soon as you realize what that is 😉

Hello Werner,

Thank you very much for your time and help.

I am at work right now and the computer here is a little bit slow!

I shall post another reply as soon as I go through the worksheet you kindly made for me. Let me ask you this question: you said we make some assumptions/relationships at the top of the worksheet, and defined these by boolean equals. My question is: do the following functions understand these parameters or not?

Thanks and regards,

Anousheh

Werner_E
25-Diamond I
(To:Anousheh)

I am at work right now and the computer here is a little bit slow!

As is mine 😉

you said we make some assumptions/relationships at the top of the worksheet, and defined these by boolean equals. My question is: do the following functions understand these parameters or not?

No, the expression m=1/k is ignored by Mathcad (but not by me, as it has looked that this is what you want). Q is set to pi/4 and k is set to 1/sqrt(2) in your sheet and unless any of these are used as parameter of a function that values are automatically substituted. As you use m as parameter to your function I had to assume the the relationship m=1/k has to be preserved. So if you chose a specific m, I assume that k has to be 1/m and Q should be acos(1/m). The functions in my sheet are written accordingly.

Werner_E
25-Diamond I
(To:Anousheh)

I am at work right now and the computer here is a little bit slow!

I shall post another reply as soon as I go through the worksheet you kindly made for me. Let me

In case you could use it find a ttched a pdf of the sheet

Hello Werner,

Thank you so much.

Anousheh

Werner_E
25-Diamond I
(To:Anousheh)

Anousheh Rouzbehani schrieb:

Hello Werner,

Thank you so much.

Anousheh

You're welcome. Hope it can be of help.

Announcements

Top Tags