# What I want:

Take an input, x

Take a formula. It has to be capable of reading something in the format:

• ax^m + bx^n + cx^o ... where m, n, o and any terms after that can represent any value.
• coefficients, again for any number. For example, 6x^2. (That means 6(x^2))
• Doesn't necessarily have to put up with spaces
• times, divide, plus and minus
• brackets - up to stacking of 5
• ANY negative numbers
• fractions
• To the power of x , these can be integeric (<-- is not a word, but that is the best word I can make up!)
• If x = 5, you can put -x to get -5 and -x^2 is -(x^2). You could use (-x)^2

After it interprets the formula, it has to plug x into the function, then output the value.

## The Challenge:

• Do it in as less bytes as possible
• The lowest number of bytes wins!

# Example

Key: bp = Background Process

• Give me an input, (x)

4

• Give me a formula:

2^x

• (bp) So I have to do 2 to the power of x, which is 2^4, which is 16
• Output: 16

## closed as unclear what you're asking by fəˈnɛtɪk, Business Cat, Stephen, betseg, BlueApr 28 '17 at 16:08

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• >Something in the form of ax means a*x – VortexYT Apr 28 '17 at 15:38
• Does 6-x^2 mean 6 * -(x^2) or 6 * ((-x)^2)? – Stephen Apr 28 '17 at 15:40
• I'm really not sure as to what this challenge is asking, could you at least add some test-cases? – Skidsdev Apr 28 '17 at 15:41
• Very closely related, almost duplicate. I'm not sure that adapting the answers to include the use of x would make a significant change to the solutions. – user62131 Apr 28 '17 at 15:58
• @ScottMilner: If I thought it was an exact duplicate I'd have thrown a close vote on. (And given that I got dupehammer rights yesterday, it'd close the challenge by itself.) I don't think it's quite close enough to do that, but it's certainly close enough to make people aware of the possibility. – user62131 Apr 28 '17 at 16:12

# TI BASIC, 6 bytes

This might change, since the rules are still not totally stable, but I wanted to post this while I could.

:Prompt X,F
:F


Asks for X, then parses whatever formula is put into F and displays it.

If I could assume that X was already stored in the memory, it would be

# TI BASIC (maybe), 0 bytes

Is this ok?Guess not. :-(

• How do I test this? – VortexYT Apr 28 '17 at 15:53
• @simplest_mathematics If you have a TI-83/84 calculator, you can create a new program and plug it in. If not, you can find emulators online. – Scott Milner Apr 28 '17 at 15:55
• I still don't understand – VortexYT Apr 28 '17 at 15:59
• A blank code block is <pre></pre>. However, I'm pretty sure the second answer won't work because it would need to take input with X= preceding it, which means you're taking input via a variable, something that's not allowed by default on PPCG. – user62131 Apr 28 '17 at 16:03
• TI BASIC is the programming language of TI 83/84 graphing calculators. You can create full programs in this language. You can find more information here – Scott Milner Apr 28 '17 at 16:03