Cody

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.

Solution Stats

47.5% Correct | 52.5% Incorrect
Last solution submitted on Jan 29, 2015

Problem Comments

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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more