http://blogs.mathworks.com/loren/2006/04/01/goto-coming-at-long-last-vectorized-no-less/ ]]>

On 4/0/15 6:24 AM, Max wrote:

> I was glad to hear that Mathworks has finally corrected their array

> indexing scheme to start with 0 instead of 1, so they’re now

> compatible with all the other languages out in the real world.

>

> Apparently they knew all along that array indexes actually start at

> zero, but a bug in the initial release of the code caused the ‘off by

> one’ problem. An admission of such a glaring math error would have

> been disastrous, so they claimed that they meant to do it.

>

> Mark this day on your calendar as the day when corresponding source

> code needs to be corrected.

Thanx for the try! ]]>

it is very funny fact. We can generalize it a bit by using an arbitrary number of nested absolute value. Here is my function :

function zout = fun_abs(x,y,a,n,b)

xtmp = abs(x);

for i1 = 1:n-1

xtmp = abs(xtmp+a);

end

ytmp = abs(y);

for i1 = 1:n-1

ytmp = abs(ytmp+a);

end

zout = abs( xtmp – ytmp ) >= b;

In the example of the post we have n=3, a=-1 and b=1/3.

]]>