Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 1836. Negation and new variables

Inspired by Problem 1827 by Andrew Newell.

Write a function that has the following property:

(x~=y)

neg3(x)=x;

neg3(y)=y;

neg3(x)=-x;

neg3(y)=-y;

...

The test suite is simple. The goal is just to obtain a general method.

Problem Group

Solution Statistics

17 correct solutions 20 incorrect solutions
Last solution submitted on Aug 19, 2014