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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Translate the entire conversation x

Singularity function (Singularity function brackets). Evaluation of the singularity function.

Sergey
15-Moonstone

Singularity function (Singularity function brackets). Evaluation of the singularity function.

Hello.

 

I came upon an interesting case: singularity function defined in my particular case as < r - r_o >^0

It is also said that if r < r_o then the whole function is equal to zero. 

 

Do we have any means of evaluating this function in Mathcad, such that, if I plug inn any values of "r" and "r_o" into the function, it will return to zero (of course if r < r_o)? Otherwise this function is always 1 (if r > r_o and if we ommit the case when r = r_o).

 

Best regards,

Sergey

ACCEPTED SOLUTION

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

OK. I looked up the singularity functions in WikiPedia. It states that <r - r0>^0 is The Heaviside step function for r-R0, so:

LucMeekes_0-1745410933131.png

This function is 'simple' in the sense that its output is 1 when r>r0, 0 when r<r0 (and the result for r=r0 is debatable, sometimes given as 0, other times as 1 and 1/2 also occurs.

Mathcad 11, numeric and symbolic:

LucMeekes_1-1745411046417.png

I like the symbolic answer for F0(0,0).

Prime 11 gives:

LucMeekes_2-1745411139029.png

I'm on express so can't evaluate it symbolically.

You don't get negative values for <r - r0>^n . Not when n=0, see above, but also not when n>0, because the term (r-r0) get multiplied by F0(r-r0) which is 0 whenever r<r0. So wherever you thought it would become negative, it becomes 0.

 

Success!
Luc

 

 

View solution in original post

8 REPLIES 8
ttokoro
21-Topaz I
(To:Sergey)

image.pngimage.png

Sergey
15-Moonstone
(To:ttokoro)

Thank you.

LucMeekes
23-Emerald IV
(To:Sergey)

Do you mean this function?:

LucMeekes_0-1745409185143.png

Numerically it evaluates to 1 for any values of r and r0, so I don't see 0 as a result.

Interestingly it also evaluates to 1 when r=r0=0 (or any other value).

LucMeekes_1-1745409277132.png

But the symbolic processor of Mathcad 11  for the r=r0 case: it says it's undefined.

LucMeekes_2-1745409351840.png

I wonder what Prime 11 gives...

 

Success!
Luc

 

Sergey
15-Moonstone
(To:LucMeekes)

I tried it out. Mathcad evaluates function to 1 when r < r0, which is strange. Shouldn't it be -1?

I reffer to this regarding the zero value of the sigular function when r < r0. Any thoughts?

 

Sergey_0-1745410076881.png

 

LucMeekes
23-Emerald IV
(To:Sergey)

OK. I looked up the singularity functions in WikiPedia. It states that <r - r0>^0 is The Heaviside step function for r-R0, so:

LucMeekes_0-1745410933131.png

This function is 'simple' in the sense that its output is 1 when r>r0, 0 when r<r0 (and the result for r=r0 is debatable, sometimes given as 0, other times as 1 and 1/2 also occurs.

Mathcad 11, numeric and symbolic:

LucMeekes_1-1745411046417.png

I like the symbolic answer for F0(0,0).

Prime 11 gives:

LucMeekes_2-1745411139029.png

I'm on express so can't evaluate it symbolically.

You don't get negative values for <r - r0>^n . Not when n=0, see above, but also not when n>0, because the term (r-r0) get multiplied by F0(r-r0) which is 0 whenever r<r0. So wherever you thought it would become negative, it becomes 0.

 

Success!
Luc

 

 

Sergey
15-Moonstone
(To:LucMeekes)

So  Sergey_0-1745412216407.png is the way of writing < r - r_o >^0 in Mathcad?

 

 

 

Werner_E
25-Diamond I
(To:Sergey)

I would say that r=r0 is a removable discontinuity and (r-r0)^0 can be defined(!) as being 1 to make it continuous.
I see no reason defining it as 1/2 (which is the value for the Heaviside function at 0 which Mathcad settled at).

Werner_E_0-1745413146173.png

In Prime10 both the numeric as well as the symbolics seems to automatically apply this definition

Werner_E_1-1745413269557.png

 

> It is also said that if r < r_o then the whole function is equal to zero. 

WHO is saying so? Thats not true, of course as (-3)^0 = 1 as well. There is only a point of singularity at r=r0 which can be coped with by defining the result being 1 as well.

Or did you mean that you would like to define a function which returns 1 for r>=r0 and zero otherwise?
You may use a boolean expression to do so

Werner_E_0-1745428236942.png

or you may use the if function to do so (if you don't need symbolic evaluation with symbolic arguments

Werner_E_1-1745428275705.png

The difference from the definition with the Heaviside function is the result for r=r0, because in Mathcad and Prime, the Heaviside function is implemented so that its value at the point is 1/2. As Luc already wrote, this is not standardized and may be implemented elsewhere with 0 or 1. For example, the result of the Heaviside function at 0 in Wolfram Alpha is 1. Depending on the specific application, one or the other definition may have advantages. We have to accept the way its implemented in Prime.

Werner_E_2-1745428314193.png

Werner_E
25-Diamond I
(To:LucMeekes)


I like the symbolic answer for F0(0,0).

Prime 11 gives:

LucMeekes_2-1745411139029.png

I'm on express so can't evaluate it symbolically.

Like the answer Phi(0), too 😉

 

Both MC15 and Prime 10 symbolically evaluate Phi(0) to 1/2 - in agreement with the numerical implementation.

Announcements

Top Tags