Deprecated: Required parameter $errors follows optional parameter $type in /customers/5/9/f/padowan.dk/httpd.www/forum/include/parser.php on line 524

Topic: 2nd differential: bug or resolution limit?

Triangle waves tr1, tr2 and tr3 are functionally equivalent but only tr3 can be differentiated. The 2nd differential of tr3 should be 0 except when tr3=0, but when tr3 < about .004 the 2nd differential begins to increase as tr3 approaches 0. Is this just a symptom of a resolution limit in the method of differentiation?

Re: 2nd differential: bug or resolution limit?

File attached.

Post's attachments

Attachment icon Triangle waves.grf 922 b, 525 downloads since 2013-02-16 

Re: 2nd differential: bug or resolution limit?

The reason only tr3 can be differentiated is because Graph thinks that the fract function cannot be differentiated. As fract is in fact easy to differentiate, I will fix that in the next beta version.

The reason you get strange numbers for tr3''(x) when x gets close to 0 is indeed because of the accuracy when Graph evaluates the second derivative, which Graph finds to be

tr3''(x)=-4*(-4*0.5/sqrt(1-cos(2*pi*x)^2)*cos(2*pi*x)*sin(2*pi*x)*pi/(1-cos(2*pi*x)^2)*sin(2*pi*x)*pi+2*1/sqrt(1-cos(2*pi*x)^2)*cos(2*pi*x)*pi*pi)*pi*(2*pi)^2/(2*pi)^2^2

Re: 2nd differential: bug or resolution limit?

Thanks, Ivan. Probably also related to differentiability, here's 2 more similar definitions I've tried:

tr4(s, x)=1/2-abs(mod(s x, 1)-1/2)
tr5(s, x)=acos(cos(2 pi s x))/2pi

All 5 functions seem to have some issues with evaluation tools - Intersection, x-axis and Extreme y-value don't work on many of these. For tr4 it says the "sign" function cannot be differentiated, yet Graph does find intersections and extreme values for it. Others have no error message but non-functional eval tools. Does a function have to actually cross the x-axis or just touch it for that eval tool to work?

I generated an avi animation today. What an awesome tool!! Overall, Graph is a really great program. Thanks for all your hard work.

Regards,
David

Re: 2nd differential: bug or resolution limit?

The error message is for calculating f'(x) or f''(x), while you get a value for f(x). However I will add support for differentiating sign(x) to get rid of the error message.

For Graph to find an intersection with an axis or another function, the function has to actually cross. It is not enough to touch the axis  or function.