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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Tough Derivative

schneidrax
2-Explorer

Tough Derivative

I'm trying to take the derivative of an improper integral by applying Integration by Parts. But my calculations appear incorrect.

I've tried changing the TOLerance and selecting the Singular Endpoint option all to no avail. Perhaps its a problem with Mathcad 2001i.

In any case, can someone offer assistance?

P.S.:--Just as an aid, I've attached a simple example to illustrate Integration by Parts.
45 REPLIES 45

Too many unverified, and unverifiable, equations in there for me to make much sense out of it. Without seeing the links from (A) to (B) I have no reason to trust (B) -- and (B) is clearly in error, at least to the extent that there is an n in it that is not dependent on r. Everything should be done with direct linkages all the way back to the original equation.

The derivative of ξ makes no sense. p is not an independent variable. It is defined in terms of r1. If r1 is a constant, then so is p and you cannot differentiate with respect to it. If r1 is not a constant then you need to account for its variation in calculating the derivative. And where did x come from? It just appears out of the blue.

Your change of variables and inconsistent use of ' are confusing. You use multiple ' for different orders of derivatives of n, but you seem to use multiple primes for different calculations of the derivative of ξ. And while you initially talk about differentiation with respect to p, the numeric derivatives you eventually calculate for ξ are with respect to h1, which is, after change of variables, more or less equivalent to r1.
__________________
� � � � Tom Gutman

On 9/11/2009 10:42:47 PM, Tom_Gutman wrote:
>Too many unverified, and
>unverifiable, equations in
>there for me to make much
>sense out of it. Without
>seeing the links from (A) to
>(B) I have no reason to trust
>(B) -- and (B) is clearly in
>error, at least to the extent
>that there is an n in it that
>is not dependent on r.
>Everything should be done with
>direct linkages all the way
>back to the original equation.
>
I didn't see the need to start from (A) since the validation process only compared (B) with its subsequent integration by parts. But in the light of your second comment it would have been better had I included it. In any case, I've attached the links from (A) to (B) below.
>
>The derivative of � makes
>no sense. p is not an
>independent variable. It is
>defined in terms of r1. If r1
>is a constant, then so is p
>and you cannot differentiate
>with respect to it. If r1 is
>not a constant then you need
>to account for its variation
>in calculating the derivative.
>
This issue probably lies at the heart of the matter. p is the product of r1 and the refractive index n(r1). As you point out, p can't be changed without changing r1. However, since the atmospheric refractive index n(r) changes so slowly with r [it is approximately unity for all r], I think that in taking derivatives I can let dp = n(r1)dr1. Of course that means I need first to apply Leibiz' Rule (to account for the derivative of the lower limit of integration) before applying Integration by Parts. This also means I need to return to "From A to B"
>
>And where did x come from? It
>just appears out of the blue.
>
x entered simply as a lhs placeholder for simplifying the derivative of the previous step. I was unable to get the symbolic processor to combine terms.

>Your change of variables and
>inconsistent use of ' are
>confusing. You use multiple '
>for different orders of
>derivatives of n,

I didn't mean to.
>but you seem
>to use multiple primes for
>different calculations of the
>derivative of �.
>
Just being lazy.

>And while
>you initially talk about
>differentiation with respect
>to p, the numeric derivatives
>you eventually calculate for
>� are with respect to h1,
>which is, after change of
>variables, more or less
>equivalent to r1.

That's because (1) r1 = a + h1 with a = constant (its the planetary radius), and (2) the atmospheric refractive index is more conveniently expressed in terms of h rather than r.

Thanks, Tom, for looking at this. I'll try again, making sure I vary both r1 and p.

My first reply (above) will be deleted shortly. Too many blank lines followed by editing. My second reply (hopefully) copied it vertatim.

On 9/12/2009 3:14:28 PM, schneidrax wrote:
>On 9/11/2009 10:42:47 PM, Tom_Gutman
>wrote:
>>Too many unverified, and
>>unverifiable, equations in
>>there for me to make much
>>sense out of it. Without
>>seeing the links from (A) to
>>(B) I have no reason to trust
>>(B) -- and (B) is clearly in
>>error, at least to the extent
>>that there is an n in it that
>>is not dependent on r.
>>Everything should be done with
>>direct linkages all the way
>>back to the original equation.
>>
>I didn't see the need to start from (A)
>since the validation process only
>compared (B) with its subsequent
>integration by parts. But in the light
>of your second comment it would have
>been better had I included it. In any
>case, I've attached the links from (A)
>to (B) below.

My previous attachment "From_A_to_B.mcd" and the one below should provide all linkages.

>>
>>The derivative of �x makes
>>no sense. p is not an
>>independent variable. It is
>>defined in terms of r1. If r1
>>is a constant, then so is p
>>and you cannot differentiate
>>with respect to it. If r1 is
>>not a constant then you need
>>to account for its variation
>>in calculating the derivative.
>>
>This issue probably lies at the heart of
>the matter. p is the product of r1 and
>the refractive index n(r1). As you point
>out, p can't be changed without changing
>r1. However, since the atmospheric
>refractive index n(r) changes so slowly
>with r [it is approximately unity for
>all r], I think that in taking
>derivatives I can let dp = n(r1)dr1. Of
>course that means I need first to apply
>Leibiz' Rule (to account for the
>derivative of the lower limit of
>integration) before applying Integration
>by Parts. This also means I need to
>return to "From A to B"

There was no need for me to return to "From A to B", but I did return to "Tough_Derivative.mcd" to address the p(r1) issue via Leibiz' Rule [see the attached file below]. Unless I've made a mistake, it seems to take us back to "Square One". In other word, I'm still not getting the correct answer.
>>
>
>>Your change of variables and
>>inconsistent use of ' are
>>confusing. You use multiple '
>>for different orders of
>>derivatives of n,
>
I'm now using ' only as a shorthand for derivatives. The rational forms (e.g. ddd/xxx) seemed too burdensome.
>>but you seem
>>to use multiple primes for
>>different calculations of the
>>derivative of �.
>>
No more. These are now denoted by subscripted variables.>
>
>Thanks, Tom, for looking at this. I'll
>try again, making sure I vary both r1
>and p.

See the new version attached below. I hope I've addressed all your concerns and that you can continue to help me.





I've made a few "cosmetic" changes to the worksheet in order make it flow more smoothly.

I also explicitly evaluated the uv product at the upper and lower limits of integration and included their difference in Equation (D) [although it evaluates to zero].

These changes have been highlighted in blue.

But the calculated values of the derivatives (now highlighted in yellow) remain the same. Still no agreement between them, at least in Mathcad 2001i. Is this also case in Mathcad 11?

On 9/13/2009 4:54:52 PM, schneidrax wrote:
>I've made a few "cosmetic"
>changes to the worksheet in
>order make it flow more
>smoothly.
>
>I also explicitly evaluated
>the uv product at the upper
>and lower limits of
>integration and included their
>difference in Equation (D)
>[although it evaluates to
>zero].
>
>These changes have been
>highlighted in blue.
>
>But the calculated values of
>the derivatives (now
>highlighted in yellow) remain
>the same. Still no agreement
>between them, at least in
>Mathcad 2001i. Is this also
>case in Mathcad 11?
______________________________

I have done my best trying to solve your (A) integral (image below) from knowing nothing about the scope of the project [abstract, source ...]. Just hope collabs solve what you can't and didn't understand my reply.

The problem: solve the integral



As soon as I close this thread, will remove of previous material in order not to confuse the audience. Wise to plot the integrand first and see what the integral might eventually look like.

jmG

>Still no agreement between them, at least in Mathcad 2001i. Is this also case in Mathcad 11 ? <<br> ______________________

If you believe something is correct in where you say or pretend to be. Your or else representation in (A) is not. (A) is only functional, but NOT solvable as far as I can see. It might be solvable from resulting values, but that is quite another story. Make it simple: plot (A) and I will return an inverse data set that will solve. Hopefully a good approximation of it.

Resume: plot (A) on few lines, and post.
Make sure you source (A), so no pedalling in butter. If you have no source for (A) that collabs can validate, maybe the project stops there ... before getting "only slightly pregnant" [as Tom said before !]



jean

I will be back tonight with good news and bad news. I can't work continuous on that, Qu�bec summer is short and I have plenty of friends to help . But in the mean time, could you explain where you are at: in Venus or around planet earth. You must abstract the project. My understanding is something about the refractive index of plasma around Venus, is it ?

Jean

There are a number of problems remaining.

MC11 symbolics have problems with integration limits that have literal subscripts. That causes symbolic evaluation of ξ to fail, confusing things quite a bit.

I cannot verify your (B). Not only the n without the dependence on r, but your f does not check with my result (found in the attached sheet). Nor can I verify that uv is actually zero. At best, it seems to be an indeterminate form that needs further evaluation. Looking at it I don't think it can be zero in general, it depends on the specific form of n(r). I also note that while your reply to Eden says that n can be less than one, the form you've used for evaluation does not actually allow that.

While you have a section on Leibniz' rule, you don't actually use it in calculating the symbolic derivative, treating r1 as a constant.

And you have the basic discrepancy that whily you sysmbolically calculate (or attempt to calculate) the derivative with respect to p, the numeric derivatives to which you compare that are with respect to h. Different variable, different derivative.
__________________
� � � � Tom Gutman

>At best, it seems to be an indeterminate form that needs further evaluation. <<br> ______________________________

My Mathcad crashed at this point. Not exactly crashed but as it wouldn't end, I couldn't stop it and had to close the PC.

jmG

Tom:--Again, thanks for responding.

On 9/13/2009 10:25:57 PM, Tom_Gutman wrote:
>There are a number of problems
>remaining.
>
>MC11 symbolics have problems
>with integration limits that
>have literal subscripts. That
>causes symbolic evaluation of
>�� to fail, confusing things
>quite a bit.

I will eliminate the literal subscripts in my worksheet "Tough_Derivative.mcd" and (hopefully) submit it later today.
>
>I cannot verify your (B).

But you have, except that (1) you left out the factor of -2p from Equation A, and (2) you did not show that uv�� is actually zero. I've demonstrated this in your sheet below, at least for the Venusian atmosphere.

>Nor can I verify that
>uv�� is actually zero.
>At best, it seems to be an
>indeterminate form that needs
>further evaluation. Looking
>at it I don't think it can be
>zero in general, it depends on
>the specific form of n(r).

This may be true mathematically, but I suspect that for any n(��)~ 1 [beyond the atmosphere, in the vacuum of space], uv�� will always = 0 (although I'm not interested in showing this).

At this point, I hope we can agree that Equation B is indeed correct and focus on the evaluation of its derivative. If so, I will begin to address your other concerns (below). If not, I need to understand why not.

I
>also note that while your
>reply to Eden says that n can
>be less than one, the form
>you've used for evaluation
>does not actually allow that.
>
>While you have a section on
>Leibniz' rule, you don't
>actually use it in calculating
>the symbolic derivative,
>treating r1 as a constant.
>
>And you have the basic
>discrepancy that whily you
>sysmbolically calculate (or
>attempt to calculate) the
>derivative with respect to p,
>the numeric derivatives to
>which you compare that are
>with respect to h. Different
>variable, different
>derivative.

Again, thanks for looking at this.

On 9/14/2009 9:59:44 AM, schneidrax wrote:

>But you have, except that (1) you left

>out the factor of -2p from Equation A,

>and (2) you did not show that uv�� is

>actually zero. I've demonstrated this

>in your sheet below, at least for the

>Venusian atmosphere.



But I didn't. What I showed was that u ~ 0, not the uv product.

So I needed to take a closer look, and be a little more careful.


Hopefully, I've done that. In the file below I've demonstrated that uv(8)=0 (at least for the Venusian atmosphere

On 9/14/2009 9:59:44 AM, schneidrax wrote:
>
>On 9/13/2009 10:25:57 PM, Tom_Gutman
>wrote:
>>MC11 symbolics have problems
>>with integration limits that
>>have literal subscripts. That
>>causes symbolic evaluation of
>>�� to fail, confusing things
>>quite a bit.
>
>I will eliminate the literal subscripts
>in my worksheet "Tough_Derivative.mcd"
>and (hopefully) submit it later today.
>>

The literal subscripts (and derivative primes) have been eliminated in the version below.

Perhaps this will also help jmG.

>Perhaps this will also help jmG. <<br> ______________________

NO, because of the km unit !

Jean

How can you say that the result I get from the integration by parts of (A) is the same as what you have as (B) when the verification step (du+f(r)=0) fails? They are clearly not the same, the only question is which is wrong (and why).

I have figured out why you can ignore the variation of r1 with p. The derivative of an integral with respect to a limit of integration is the value of the integrand (negative thereof for a lower limit), and the integrand here has a value of zero at the lower limit. Hence the contribution of the derivative with respect to that lower limit is zero.
__________________
� � � � Tom Gutman

On 9/14/2009 5:44:58 PM, Tom_Gutman wrote:
>How can you say that the
>result I get from the
>integration by parts of (A) is
>the same as what you have as
>(B) when the verification step
>(du+f(r)=0) fails? They are
>clearly not the same, the only
>question is which is wrong
>(and why).
>
It seems to me that you're saying if two integrals are the same, they must have the same integrands. That's surely not true.

What is the basis of your verification step? Can you show me why that must be true?

In haste, I've got to meet my son for tennis. I'll log on later this evening.

For a specific definite integral with specified integration limits, it is certainly possible to have different integrals which end up with the same value. But for two integrals to be identically equal, giving the same value for all integration limits the integrands must be identical.

What is your basis for claiming that (B) is a correct representation of (A)? You say it has been verified. How? Where is the verification? When I do the integration by parts, using the same parts, I get a different answer. Why?
__________________
� � � � Tom Gutman

On 9/14/2009 5:44:58 PM, Tom_Gutman wrote:
>How can you say that the
>result I get from the
>integration by parts of (A) is
>the same as what you have as
>(B) when the verification step
>(du+f(r)=0) fails? They are
>clearly not the same, the only
>question is which is wrong
>(and why).
>
Actually they are the same. du and f(r) are identical. Take a look at the attached file.

Ndu and the numerator of f(r) are indeed the same. But this is a prime example of why I am so set against manual copying and manual manipulations. Ndu is not the numerator of du, nor the negative of that numerator. It is a manual copy and an incorrect one. Do steps manually and errors are inevitable.
__________________
� � � � Tom Gutman

On 9/14/2009 11:10:34 PM, Tom_Gutman wrote:
>Do steps manually and errors are
>inevitable. >� Tom Gutman

I will need to tattoo your statement on my wrists or at least pin it to my screen.

It has now been verified that f(r) = -du.

I would like to claim that the problem lay in my misinterpretation of the symbolic processor's statement (see page 1 of the attached file_. But that wouldn't be true. The problem lay in doing some steps manually. As you predicted, errors were inevitable.

So what I propose is that I re-do both of my original sheets (minding your admonition), and resubmit them in this same thread. I am, of course, still interested in calculating the derivative of xi.

Tom, thanks for your help. I'll try to do better next time around.

P.S.:--It'll take me a few days to clean up the mess.



Do remember that simply saying the derivative of ξ is inadequate. You have to specify with respect to what, and in your sheet you are taking derivatives with respect to different variables (p and h1).
__________________
� � � � Tom Gutman

Sorry for that one, because the collab login while I was composing the text. You were looking for the derivative of an improper integral, my reply is the same as the nature the maths concerned: the derivative of an integral is the integrand itself.

On 9/14/2009 10:13:17 AM, schneidrax wrote:
...
>I'm not willing to go back prior to my
>"Square One". Let's just take it from
>the Get-Go that (A) is an improper
>integral for which we are seeking its
>derivative.

Try to understand what I did, have questions.

Jean

On 9/15/2009 11:41:55 AM, schneidrax wrote:
>On 9/14/2009 11:10:34 PM, Tom_Gutman
>wrote:
>>Do steps manually and errors are
>>inevitable. >� Tom Gutman
>
>So what I propose is that I re-do both
>of my original sheets (minding your
>admonition), and resubmit them in this
>same thread.

These sheets are attached below

>Tom, thanks for your help. I'll try to
>do better next time around.

It's clear I'm no saint. I cut-and-pasted
Equation (E) - (but no others).

But in a word: SUCCESS! Both of the original worksheets have been carefully redone and the derivative of the bending angle derived using the symbolic processor of Mathcad 2001i. The numeric processor was used to compare calculations based on (1) an analytic form derived using Integration by Parts, (2) a differential form obtained using Mathcad�s derivative operator, and (3) a difference form. All three results are found to be in reasonable agreement, although the first two sometimes prove unstable.

I learned a few things along the way:

1. When evaluating expressions symbolically, avoiding cutting and pasting. �Manual steps lead inevitably to errors� - Gutman�s Admonition. (but see 7 below).
2. The symbolic processor cannot simplify expressions �through� integral signs. [This was the reason for recasting the result of the worksheet �From_A_to_B.mcd� into a different form.]
3. Differential forms from the symbolic processor need careful scrutiny for their proper interpretation.
4. I was unable to use Mathcad�s derivative operator on the symbolically derived Equation (B) [see Section 5 of Tough_Derivative.mcd]
5. Using the symbolic processor, I was unable to get an explicit expression for the integrand of the final result [see last line of Section 3]
6. Integration of the final symbolic result required the Romberg option. I was surprised that AutoSelect or the Adaptive option failed. I was also surprised that the Romberg option had to be reset each time the worksheet was opened.
7. The most reliable calculated results were based on the risky, cut-and-pasted Equation (E) in Section 5 [the only cut-and-paste in worksheet!]. This was unexpected � I had thought that the Integration by Parts derivative would prove the best.

I would not have been successful in deriving the derivative using Integration by Parts without the help of Tom Gutman. I am thankful beyond words for his assistance. Any other further comments would be welcome.

Tom, thank you.



I haven't had a chance to go through the main sheet yet. I've just gone through th A to B sheet. There are some comments, and some problems, in the attached file.
__________________
� � � � Tom Gutman

It seems that the problem is in the numeric evaluation of the original integral. Changing TOL to 1e-9 changes that value from .04501 to .09758, reasonably close to the .09769 (which is unchanged from the value with the default TOL of 1E-3).
__________________
� � � � Tom Gutman

I've now had a chance to go through your main sheet. I've incorporation the A to B sheet (including my comments and emmendations) into this sheet, my previoous posting is now redundant.
__________________
� � � � Tom Gutman

On 9/19/2009 12:27:13 AM, Tom_Gutman wrote:
>I've now had a chance to go
>through your main sheet.



Again - many thanks.


Why did I persevere despite the claims of success? In large part because I'm a skeptic and don't generally accept unverified claims. And here your graph did not support your claim, showing three very distinct curves. While when comparing calculated reults to measured results one has to consider what is "good enough" (since measured results have errors, often large errors, and calculations are not for the actual system but a model of the system, often with failry large modelling errors), when comparing the results of algebraic transformations there should be essentially no differences, only roundoff errors of various sorts. Nothing that should be visible on a graph.

Besides which, you invited comments. So I went looking through the sheet for any issues, stylistic as well as errors.

I didn't consider infinite upper limits to be a particular challenge. Mathcad has always been able to handle them. The need for units on the infinity is something that Mathcad tells you about in no uncertain terms if you omit them. As is the need to specify the units in base units (as Mathcad has this idiosyncratic definition of ∞ as a specific very large, but finite, number and does not use the proper IEEE infinity).

I don't know if MC2001i can evaluate the combination of a singular (infinite value) integrand at one end and the infinite limit at the other end. But it doesn't matter much. Those doubly improper integrals are there more for my benefit, to verify that the supposedly equivalent integrals do indeed represent the same value, than as a part of the main calculation.

I had run into the issue of the symbolic processor not properly picking up definitions from math regions in text regions. One of the things I forgot about, not using MC2001i for a long time. Easy enough to work around, once one recognizes the source of the problem.

Functions are just a data type, like complex numbers and strings. The symbolic undefinition idiom (x:=x) applies to the name x, regardless of the type of data (if any) that that name refers to. Mathcad has no syntax for defining a function abstractly (λ notation, in computer theory), the definition of a function is tied to the assignment of that definition to a name. Bur once the value has been created it can behandled like any other value, assigned to any name and, subject to a few strange restrictions, used as an element of an array.

As to the numeric derivatives, I don't have a complete answer. But I do know that numeric derivatives can fail. There's an old thread somewhere showing the numeric derivative of a simple exponential failing for a particular range of arguments.

While Mathsoft never implemented general limits numerically, both numeric derivatives and Romberg integration are based on a numeric algorithm for limits. The limits are cast as limits going to zero by a change of variables (x becomes x0+δ) and an analysis of the behaviour for different values of δ is done. The choice of a proper δ is critical, and Mathcad appears to have a simplistic, and not quite adequate, algorithm for that. Apparently it just uses a fraction of x0, or a fixed "small" value if that is zero. What I think is happening is that when you try to do d/dr(n(r)) δ is taken as a fraction of r, which is very big, and δ is too big. The different values of δ are all in the range such that n(r+δ) is the same, so no derivative can be calculate. Do d/dh(n(a+h)) and δ is a fraction of h, a much smaller number, one that actually works. The point is that numeric derivatives, like other numeric algorithms, cannot be taken for granted but need a certain amount of care and validation.
__________________
� � � � Tom Gutman

>Why did I persevere despite the claims of success? In large part because I'm a skeptic and don't generally accept unverified claims. And here your graph did not support your claim, showing three very distinct curves...<<br> ___________________________________

Same thing I did, i.e: ignore both work sheets.
Solving the integral as given in pure scalar mode.

jmG

Jean-

Although I do appreciate your efforts, I don't understand them. However, I can offer some guidance:

First, the function that you employed for the refractive index, n(r) = r, is not a reasonable choice for this problem which addresses the propagation and bending of radio rays in a planetary atmosphere. The refractive index must always be greater than zero otherwise radio propagation ceases. (It can, however, be less than one).

Second, any atmospheric refractive index model should approach unity as its upper limit, since beyond the atmosphere (in vacuum) n(8)=1. I used this boundary condition in applying both Leibniz' Rule and Integration by Parts.

Third, propagation takes place only above the planet's surface. Thus, 0 < a < r1 < r. The refractive index need not be specified within the planet where r < a.

Finally, I've been using a Venusian model for the refractive index [see my Section 5]. It would help me if you could use that same model to illustrate your points.

Thanks, as always, for your efforts.
Announcements

Top Tags