Domanda

Lets say I have a simple equation as follows:

x = 50 * (20 * item)

Is there a system or language to reverse this automatically? So lets say I have x as an input and want to find out which item it is.

item = (x - 50) / 20

A very trivial and probably misleading example, but just to illustrate the point. I'm not talking about solving equations with least squares fitting or such, but instead a system that can reverse equations effectively generating what you would have to code by hand. I'm not a mathematician so forgive the incorrect terminology (if any).

A colleage of mine said Matlab can do this natively. Anyone has any idea how? Can I actually specify which inputs I have and the output I'm looking for? Or do I simply have to use the inbuilt math functions to for a handwritten reversed equation?

È stato utile?

Soluzione

You're probably looking for http://www.mathworks.com/help/symbolic/solve.html

You should first declare a symbolic variable: syms item and then: solve(x == 50 * (20 * item), item) should give You what You're looking for.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top