Negation and new variables - MATLAB Cody - MATLAB Central

Problem 1836. Negation and new variables

Difficulty:Rate

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

45.0% Correct | 55.0% Incorrect
Last Solution submitted on Mar 18, 2024

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
3
6

Problem Recent Solvers21

Suggested Problems

More from this Author43

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!