text:
Numbers with Rotational Symmetry
Given an integer, output a truthy value if it is the same upside-down (rotated 180°) or a falsy value otherwise.
0, 1, and 8 have rotational symmetry. 6 becomes 9 and vice versa.
Sequence of numbers producing truthy results: OEIS A000787
0, 1, 8, 11, 69, 88, 96, 101, 111, 181, 609, 619, 689, 808, 818, 888, 906, 916, 986, 1001, 1111, 1691, 1881, 1961, 6009, 6119, 6699, 6889, 6969, 8008, 8118, 8698, 8888, 8968, 9006, 9116, 9696, 9886, 9966, 10001, 10101, 10801, 11011, 11111, 11811, 16091, ...

This question is inspired by my own reputation at the time of posting: 6009.

May we take the input as a string?

@xnor If the language has numeric types, it should use them, for function parameters, for example. But if, in Python for example, you take raw_input, the user entered an integer, which would become a string behind the scenes. That's fine.

On seven-segment displays,  and  both rotate to themselves - that would make a worthwhile extension to this challenge.

Related: lol is an ambigram, dad isn't

05AB1E, 12 bytes
žhÀ•yΘOñ•‡RQ

Try it online!
I somehow managed to beat Adnan's 05AB1E answer lol. This
Explained
žhÀ             # Push "1234567890"
   •yΘOñ•       # Push "1000090860"
         ‡      # Transliterate the input based upon the previous two strings
          RQ    # Check if the reverse of that equals the input

Python 2, 50 bytes
lambda n:`n`==`map('01xxxx9x86'.find,`n`)`[-2::-3]

The method '01xxxx9x86'.find takes a digit character to it's upside-down number, with any unflippable digit giving -1. This function is mapped to the reversed number string, producing a list of digits.
This is converted to a string with the [1::3] trick, except it's reversed instead by doing [-2::-3] (thanks to Dennis for this, saving 4 bytes),  and compared to the original number string. Any -1's from unflippable digits will misalign the conversion, making it fail.

56 bytes:
lambda n:`n`[::-1]==`n`.translate('01xxxx9x86______'*16)

Checks if the number string reversed is the same as it with the upside-down replacements. Digits that can't be flipped are replaced with 'x' to always give the wrong answer.
The replacement is done with translate on a string of 256 chars, replacing the corresponding ASCII values. Only the 10 values 48 to 57 matter, but I padded to length 16 to make the total length be 256. I wonder if there's a shorter way.
Some other approaches (lengths 59, 60, 60):
lambda n:set(zip(`n`,`n`[::-1]))<=set(zip('01896','01869'))
r=lambda s:set(zip(s,s[::-1]));lambda n:r(`n`)<=r('9018106')
lambda n:all(a+b in'001188969'for a,b in zip(`n`,`n`[::-1]))

Maybe this will help: http://codegolf.stackexchange.com/a/48994/34718

Regex (ECMAScript / Python), 366 323 254 201 180 148 135 bytes
^(x$|x{8}$|(?=.*?(?=(((x*)\4{8}(?=\4$))+x$))(x*)\5{99})(?=(\2x)(|\6{5}(\6\6|\2{3}|xxx))(?!\2)(x*)\9{9}$)(?=(x*(?=\5|$))(|\5x)\9$)\10)*$
Takes its input in unary, as the length of a string of xs.
Try it online! - ECMAScript
Try it online! - Python
Try it on replit.com! - RegexMathEngine (much faster), in ECMAScript mode
It's impossible for a ECMAScript regex to match the sequence in decimal, but as demonstrated here, it's possible in unary.
The regex works by looping the following logic:

Carve away both the leading and trailing digit if they are an allowed pair, or (for single-digit values) an allowed single digit.
Prevent the value sent to the next iteration from having any leading zeroes, since the regex operates on numbers, not strings, so any leading zeroes would be stripped. If it has a leading zero, add \$1\$ to both the leading and trailing digit. If both were zero, both will be changed to \$1\$, preserving the trait of symmetry. If the trailing digit was nonzero (meaning the input is not a rotationally symmetric number), adding one of \$11, 101, 1001, ...\$ is guaranteed not to change it to one that is symmetric, because for example \$1001\$ could only be added to any number in the range \$0001\$ to \$0999\$ with a nonzero last digit, which can only yield a number in the range \$1002\$ to \$2000\$ with a last digit other than \$1\$, none of which are rotationally symmetric. This allows us to golf off 13 bytes, due to not needing the trailing zero check (?=(x{10})*$).

The 135 byte version has been tested from 0 to 1000000 using RegexMathEngine without finding any false positives or negatives. The test took 29.342 hours (single-threaded) on my i7-4930K @ 4.1 GHz.
(This was originally part of this answer and was split due to being very different in nature. See that post's edit history for changes made prior to the 254 byte length.)
^                        # tail = input number
(
    x$                   # If tail==1, let tail=0 and end the loop
|
    x{8}$                # If tail==8, let tail=0 and end the loop
|
    # Assert tail >= 10; find \2 = the largest power of 10 that is <= tail
    (?=
        .*?              # Decrease tail by the minimum necessary to satisfy
                         # the following assertion:
        (?=
            # Assert tail is a power of 10 >= 10; \2 = tail
            (((x*)\4{8}(?=\4$))+x$)
        )
        (x*)\5{99}       # \5 = floor(tail / 100)
    )

    # Require tail is of the form 1.*1, 8.*8, 6.*9, or 9.*6
    (?=
        (\2x)            # \6 = \2 + 1
        (
                         # 1.*1
        |
            \6{5}
            (
                \6\6     # 8.*8
            |
                \2{3}    # 9.*6
            |
                xxx      # 6.*9
            )
        )
        (?!\2)
        (x*)\9{9}$       # Assert tail is divisible by 10;
                         # \9 = tail / 10 == floor((N % \2) / 10)
    )

    # Set tail = \9, but if \9 is of the form 0.*0, the next iteration would
    # not be able to see its leading zero, so change it to the form 1.*1 in
    # that case, otherwise leave it unchanged. If \9 is of the form 0.*[1-9],
    # don't go to the next iteration.
    (?=
        (                # \10 = tool to make tail = \9 or \9 + \5 + 1
            x*
            # Assert that the leading digit of tail is not 0, unless tail==0
            (?=
                \5       # Assert that the leading digit of tail is not 0
            |            # or
                $        # Assert that tail==0
            )
        )
        # Iff necessary to satisfy the above, tail += \5 + 1
        (
        |
            \5x
        )
        \9$              # tail = \9
    )
    \10                  # tail = \9 or \9 + \5 + 1
)*                       # Execute the above loop as many times as possible,
                         # with a minimum of zero iterations.
$                        # Assert tail==0

05AB1E, 22 16 15 14 bytes
Code:
Â23457ð«-69Â‡Q

Try it online!

Previous code:
Â69Â‡Q¹¹„vd•ÃQ*

To figure out if the string is rotational symmetric, we just need to transliterate 69 with 96, reverse the string and check if they are equal. The other thing we need to know is if the number only contains the digits 0, 1, 8, 6 and 9. So that's exactly what we are going to do:
Â                     # Bifurcate the input, which pushes input and input[::-1]
 69Â                  # Bifurcate 69, which pushes 69 and 96.
    ‡                 # Transliterate 69 with 96 in the input, e.g. 1299 becomes 1266.
     Q                # Check for equality.
      ¹¹              # Push input again twice.
        „vd•          # Compressed version for 10869.

The „vd• part actually converts the string vd from base 190 to base 10. You can try this out here.
            Ã        # Keep the characters of the second string in the first string.
                       667788 would become 6688 (since 7 is not in 10869).
             Q       # Check for equality.
              *      # Multiply the top two numbers, which actually does an AND function.

Uses CP-1252 encoding. Try it online!

Your code doesn't seem to work on TIO anymore. Why is that?

Ruby, 54 46  bytes
 ->a{(b=a.to_s).tr('1-9','1w-z9x86').reverse==b}

I don't know, is anonymous functions like that allowed or not
Basically same idea as Python2 answer.
If input is not integer, act bad (i.e. aba gives true)

Welcome to Programming Puzzles and Code Golf! Nice first answer :D Anonymous functions are allowed in any context where normal named functions are allowed.

What even is a “function” by our standards?

Regex (Perl / PCRE2 / Boost / Pythonregex), 35 bytes
^(([018])((?1)\2|)|6(?1)9|9(?1)6|)$

Takes its input in decimal.
Try it online! - Perl
Try it online! - PCRE2
Try it online! - Boost
Attempt This Online! - Python import regex
^              # Assert this is the start of the string
(              # Define (?1) recursive subroutine call
    ([018])    # \2 = match a 0, 1, or 8
    ((?1)\2|)  # Optionally match (?1) followed by \2
|              # or
    6(?1)9
|              # or
    9(?1)6
|              # or
    # Match an empty string
)
$              # Assert this is the end of the string

Regex (Ruby), 43 bytes
^(([018])(\g<1>\k<2+0>|)|6\g<1>9|9\g<1>6|)$

Try it online!
This is a direct port of the Perl/PCRE2/Boost version to Ruby's subroutine call syntax and behavior; (?1) has been changed to \g<1>, and \2 to \k<2+0>.
In Perl, PCRE, and Boost, the contents of capture groups are passed to deeper recursion levels, but upon return from a subroutine call, all captures are returned to the state they were in before the subroutine was called, i.e. there is no way to pass captures done within a subroutine call back to its caller. But in Ruby, captures are passed to the caller. So \2 will refer to whatever it captured at the deepest recursion level, and so would \k<2>. It is possible, however, to refer to a capture's value at a specific recursion level; that is why \k<2+0> is used here to refer to its value at the current level.
Regex (.NET), 94 77 66 53 bytes
^((?=([018]|6.*9|9.*6)(?<=(.))).?)+(?<-3>\3)*(?(3)^)$

Try it online!
Implementing this using .NET's Balancing Groups feature turns out to provide an edge over the 57 byte .NET-compatible version that doesn't use any .NET-specific features.
^                 # Assert we're at the beginning of the string
(
    (?=
        # Depending on what the next left-edge digit is, push its corresponding
        # right-edge digit onto the Group 3 stack.
        (
            [018]
        |
            6.*9
        |
            9.*6
        )
        (?<=(.))  # \3 = the right-edge digit (push it onto the Group 3 stack)
    )
    .?
)+
(?<-3>\3)*        # Match all right-edge digits in reverse order as they're
                  # popped from the stack.
(?(3)^)           # Assert that the Group 3 stack is now empty (literally: if
                  # its stack is not empty, assert something impossible, that
                  # we're at the beginning of the string).
$                 # Assert we've reached the end of the string, having matched
                  # all of its characters.

Regex (Perl / PCRE / .NET), 106 62 57 bytes
^((?=([018]|6.*9|9.*6)(?<=(.))).?(?=.*(\3(?(4)\4))))*\4?$

Try it online! - Perl
Try it online! - PCRE1
Try it online! - PCRE2
Try it online! - .NET
In PCRE1, subroutine calls are atomic, which prevents the Perl/PCRE2/Boost version (which requires backtracking to extend into nested subroutine calls) from working. As for .NET (and Java), subroutine calls are not supported.
In this version, instead of using recursion, we read inward from the left and right edges, one pair of characters at a time, remembering the right-edge position using capture group \4. A set of alternatives followed by a lookbehind is used to set the required right-edge digit based on whether the left-edge digit was [018], 6, or 9.
^
(
    # Depending on the next left digit, capture the required right digit in \3
    (?=
        (
            [018]
        |
            6.*9
        |
            9.*6
        )
        (?<=(.))       # Capture the previous character (the right digit) in \3
    )
    .?
    (?=
        .*
        (              # Capture \4 as the following:
            \3
            # Match \4 iff it has been captured (i.e., iff this is not the
            # first iteration). As such, \4 will be prepended with the current
            # right digit.
            (?(4)\4)
        )
    )
)*
\4?
$

Regex (Perl / PCRE / Java / .NET), 113 76 69 64 bytes
^((?=([018]|6.*9|9.*6)(?<=(.))).?(?=.*(\3(\6\4|(?!\6))())))*\4?$

Try it online! - Perl
Try it online! - PCRE1
Try it online! - PCRE2
Try it online! - Java
Try it online! - .NET
This is a port of the Perl/PCRE/.NET version, removing the use of the conditional due to their lack in Java, and emulating it with an empty capture whose set/unset status can be detected. Only the modified portion is shown below:
            # Match \4 iff it has been captured (i.e., iff this is not the
            # first iteration). As such, \4 will be prepended with the current
            # right digit.
            (
                \6\4
            |
                (?!\6)
            )
            ()         # \6 = set and empty, to signal \4 is captured

JavaScript (ES6), 56 bytes
n=>n==[...''+n].reverse().map(c=>'0100009086'[c]).join``

What does the ... in the array do?

@ericw31415 In this case it turns the string into an array of characters. More generally, you can provide anything iterable and it will iterate it and include the elements in the array.

So [...''+n] is essentially the same thing as n.split("")? Where can I read more about this?

@ericw31415 Yes, in this case I use it as a shorthand for split\``. See A more powerful array literal

Retina, 40 38 33 bytes
$
;$_
T`92-7`69`;.+
+`(.);\1
;
^;

Try it online!
Explanation
This uses a completely different approach from the other Retina answer. Instead of removing all symmetric parts, we simply perform the transformation of reversing the string and swapping 6 and 9s and then compare for equality. To make sure that no non-symmetric digits appear we also turn them into 9s in one half.
$
;$_

We duplicate the input by matching the end of the string and inserting ; followed by the entire input.
T`92-7`69`;.+

This performs a character transliteration only on the second half by matching it with ;.+. The two transliteration sets expand to:
9234567
6999999

Because 2-7 denotes a range and the target set is padded with the last character to match the length of the source set. Hence, the stage swaps 6 and 9 and also turns all of 23457 into 9s.
+`(.);\1
;

Repeatedly (+) remove a pair of identical characters around the ;. This will either continue until only the ; is left or until the two characters around the ; are no longer identical, which would mean that the strings aren't the reverse of each other.
^;

Check whether the first character is ; and print 0 or 1 accordingly.

Lever, very lever.

sh, 40 33 bytes
[ `rev<<<$1|tr 6923457 96` = $1 ]

Input via command line argument, output via exit code. Generate all testcases:
for i in `seq 0 10000`
do
  if [ `rev<<<$i|tr 6923457 96` = $i ]
  then
    echo $i
  fi
done

I'm guessing this is Bash, rather than standard shell, given the <<< redirection?

C, 73 82 bytes
f(x){int y=0,z=x;for(;x;x/=10)y=y*10+"0100009086"[x%10]-'0';return z==y;}

Expanded
static const char s[] = "0100009086";
int f(int x)
{
    int y=0, z=x;
    for(; x; x/=10)
        y = y*10 + s[x%10]-'0';
    return z==y;
}

Explanation
We reverse the digits of x using modulo-10 arithmetic, replacing 6 and 9 by their reflections as we go.  We replace the rotationally-asymmetric digits by zeros (note that we can handle symmetric fives and/or twos by simply changing the replacement table s).  If the new number is equal to the original (saved in 'z'), then it is rotationally symmetric.
Test program
#include <stdio.h>
int main()
{
    int i;
    for(i=0;  i <= 16091; ++i)
        if (f(i))
            printf("%d\n", i);
}

This prints the list of symmetric numbers given in the question.

68 bytes by using unprintable characters in the string literal, and moving the declaration of temporary variables into the function's argument list (nicer than the global variables offered by @c--).

Knight, 70 bytes
;=p=sP;=a'';Ws;=a+I|?54=bAs?57bA-111bI||?48b?49b?56bAb''a=sSsF1''O?a p

Working with strings is a pain in Knight
Try It Online!
Test Suite

Just a note: this link doesn't work: https://github.com/knight-lang/knight/knight.kn (it's linked on the language page: https://github.com/knight-lang/knight-lang). So if you are the creator or know that person, let 'em know.

@mbomb007 I'm not the creator of the language but here is the correct link: https://github.com/knight-lang/knight-lang/blob/master/knight.kn

@mbomb007 The creator of the language is actually @sampersand, maybe leave a comment under one of his answers?

Thanks. I did so. Also, it's cool that people still answer my questions from years ago even though I don't really codegolf anymore.

@mbomb007 In this case, your question was a dupe target for another recently asked question. I've already created an answer for that question but it got closed, so I decided to post the answer here instead.

@mbomb007 Also, if I may ask, how come you don't code golf anymore? Is it because you got bored of it?

Kind of. It's still interesting, but it had little reward. The main reason is that programming is my job, so I don't want to code outside of work. Also, most of my posts were during work at a job that sometimes left me without much to do. However, I now work at a job that's more demanding. Yet, I still get to have some hacky fun, as I make use of Retina at work for manipulating data when coding in another language (e.g. expanding a list of member variables into a full class w/ constructor)

The compliant version is ;=p=s+''n;=a'';Ws;=a+I|?54=bAs?57bA-111bI||?48b?49b?56bAb''a:=sSs 0 1''=b?a p

The last colon following an a can be removed..

@doug Error: Unknown identifier: n

Also Ss 0 1 can be SsF1. EDIT: Actually, your suggested code doesn't output anything, even if it did work??? It has no OUTPUT function anywhere.

Something might have gotten lost in the cut-and -paste.  The main point is the second arg to GET is a length and you want this string to get shorter so passing in Ls every time shouldn’t work.  Or rather you’re relying on undefined behavior. You can use SUBSTITUTE instead.

Ah, mine was cut-and-pasted from the Test Suite version.  That’s where the n came from.

Fixed the link, thanks @mbomb007

@doug Eh if it works then it works, but I'll change my answer to be spec compliant; it's the same byte count anyways.

No worries.  You’re welcome.

For what it's worth AidenChow and @doug, I'm in the process of revamping the Rust version, which will have some flags which you can toggle to make it only accept 100% spec-compliant programs

@Sampersand Not really related to what we are talking about right now, but I was wondering which implementations listed in the github page are fully updated to current specs? For example, I was looking through the js interpreter source code and it didn't seem like it had the ASCII function implemented.

@AidenChow Sorry, I was on a work trip without my laptop. The AST-C one is currently the most up to date, but I plan on going through and updating all the versions for knight2.0

GNU sed, 84 bytes
(including +1 for -r flag)
:
s/^6(.*)9$/\1/
s/^9(.*)6$/\1/
s/^([081])(.*)\1$/\2/
t
s/^[081]$//
s/.+/0/
s/^$/1/

If the line ends with a rotation of its beginning character, trim both ends by one.  Repeat until there's no match.  Account for a single symmetric character, then if anything remains, the input was not symmetric, and we return false; otherwise return true.

You can get -20B by merging first 4 substitutions together s/^(([081])((.*)\2)?|6(.*)9|9(.*)6)$/\4\5\6/.

Jelly, 16 15 bytes
,ȷ9+90860¤Dị/⁼Ṛ

Try it online!
How it works
,ȷ9+90860¤Dị/⁼Ṛ  Main link. Argument: n (integer)

         ¤       Evaluate the three links to the left as a niladic chain:
 ȷ9              Yield 1000000000.
    90860        Yield 90860.
   +             Add to yield 1000090860.
,                Pair; yield [n, 1000090860].
          D      Convert both integers to base 10.
           ị/    Reduce by index, i.e., for each digit of n, retrieve the element
                 of [1, 0, 0, 0, 0, 9, 0, 8, 6, 0] at that index (1-based).
              Ṛ  Yield the digits of n in reversed order.
             ⁼   Test for equality.

This answer is tied with another at 15 bytes, but the other answer was posted first. Can you shave off 1 byte?

I've tried quite hard; I don't think I can. However, our default tie breaker is first answer to achieve the winning score, and I think I got to 15 first.

In a newer version of Jelly, ȷ9+90860¤ can be “?¡pm’ for 12 bytes

Retina, 57 49 bytes
8 bytes saved thanks to @Martin Büttner.
+`^(([018])(.*)\2|9(.*)6|6(.*)9)$
$3$4$5
^[018]?$

Apply reduction as such: 1610880191 -> 61088019 -> 108801 -> 0880 -> 88 -> (empty).
Returns 1 if only 0, 1, 8, or (empty) is left.
Returns 0 otherwise.

Try it online!

TSQL, 122 bytes
I am new to code golf, so not quite sure how to count the characters. Counting it as 1 here since the number used in this case is 8
This will return 1 when the reversed value match and nothing when it doesn't match:
SELECT 1FROM(values(8))x(x)WHERE(x)NOT like'%[23457]%'and REPLACE(REPLACE(x,6,4),9,6)=REVERSE(REPLACE(REPLACE(x,9,4),9,6))

Human readable:
SELECT 1
FROM
  (values(808))x(x)
WHERE(x)
  NOT like'%[23457]%'
  and REPLACE(REPLACE(x,6,4),9,6)=REVERSE(REPLACE(REPLACE(x,9,4),9,6))

Wolfram Language (Mathematica), 56 bytes
#~ContainsNone~{2,3,4,5,7}&&Reverse@#==(#/.{6->9,9->6})&

Try it online!
Takes input as a list of digits.
Explanation:

#~ContainsNone~{2,3,4,5,7} Check if the input contains no unflippable digits
&&Reverse@# and that the reverse of the input
==(# is equal to the input
/.{6->9,9->6})& where all 6s are replaced with 9s and 9s with 6s.

Try it online! - shows the values that return True; better than a raw True/False printout. But your function should take an integer (71 bytes), not a digit list.

Julia
47 bytes
The first attack.
!x=10(d=digits(x))+reverse(d)⊆[0,11,88,69,96]
Attempt This Online!
39 bytes
Using @b_str it can be golfed further as proposed by @MarcMush and @Deadcode:
Attempt It Online!

I love this approach! you can destroy my solution by using a @b_str 41 bytes

and using 9 instead of 10 seems to work too 40 bytes

@MarcMush You can just use a raw NUL character instead of escaping it for 39 bytes

Pure bash, 99 bytes
Using shopt -s extglob:
o=;for i in ${1//*()/ };do o=${i//6/_}$o;done; o=${o//9/6} o=${o//_/9}
[[ ${o//[23457]} == "$1" ]]

There are 98 bytes +1 for extglob -> 99 bytes.
Without extglob, 101 bytes
o=;for((i=${#1};i--;)){ o+=${1:i:1};};o=${o//6/_} o=${o//9/6} o=${o//_/9}
[[ $1 == "${o//[23457]}" ]]

Sample:
rotatable() {
    o=;for i in ${1//*()/ };do o=${i//6/_}$o;done; o=${o//9/6} o=${o//_/9}
    [[ ${o//[23457]} == "$1" ]]
}
for((x=0;x<10000;x++)){ rotatable $x&&echo $x;}|column
0       69      111     689     906     1111    6009    6969    8888    9696
1       88      181     808     916     1691    6119    8008    8968    9886
8       96      609     818     986     1881    6699    8118    9006    9966
11      101     619     888     1001    1961    6889    8698    9116

Perl, 29 26 bytes
Includes +1 for -p
Run with the input on STDIN:
rotation.pl <<< 69

rotation.pl:
#!/usr/bin/perl -p
$_=reverse==y/962-7/69a/r

MATL, 25 21 22 bytes
j69801VmAGtP69VtPXE=vA

Try it Online!
Explanation
j       % Explicitly grab input as string
69801   % Number literal
V       % Convert to a string
mA      % Check if all input chars are members of this list
G       % Explicitly grab the input
tP      % Duplicate and flip it
69      % Number literal
V       % Convert to string ('69')
tP      % Duplicate and flip it ('96')
XE      % Replace all '6' with '9', and '9' with '6'
=       % Check that this substituted string is equal to the original
v       % Vertically concatenate all items on the stack
A       % Ensure everything is true
        % Implicitly print boolean result

Pyth, 17 bytes
!-FmC_B`d,QC\

Test it in the Pyth Compiler.
How it works
!-FmC_B`d,QC\  (implicit) Store the input in Q.

            \  Yield the Unicode character with code point 1068901.
           C    Compute its code point.
         ,Q     Pair the input and 1068901.
   m            Map; for each d in [Q, 1068901]:
       `d         Yield the string representation of d.
     _B           Yield the pair of `d` and `d` reversed.
    C             Zip. For the second string, this gives
                  ['11', '00', '69', '88', '96', '00', '11'].
 -F             Fold by difference, i.e., removes all pairs in the second list
                from the first list.
!               Logically negate the result, returning True iff the list is empty.

This doesn't work in current version of Pyth, but it can be shortened to 16 bytes anyway using a 3-byte ASCII string instead of a single Unicode character: Try it online!

Visual Basic for Applications, 150 111 bytes
Usable in console or as an UDF.
Function c(b)
c=(Not b Like"*[!01869]*")And b=Replace(Replace(Replace(StrReverse(b),9,7),6,9),7,6)
End Function

Improved by taking advantage of implicit type conversions and by doing three steps swapping instead of two steps on each side of the equation. Count includes Function and End Function statements.

AWK, 85 84 82 80 bytes
{n=split($1,a,s="");for(;n;){b=a[n--];s=s (b~/[2-57]/?9:b~6?9:b~9?6:b)}$1=s~$1}1

This feels like brute-forcing, but awk has very limited tools, mostly aimed to text processing. This code allows multiple inputs.
{
n=split($1,a,s="");    # this splits $1 (the input) into the array _a_
                       # using an empty string as token. each element of the
                       # array is a digit of the input number.
                       # also, sets the number of elements to _n_,
                       # and sets the empty string to _s_.

for(;
    n;          # loops until n==0 (evaluates to false)
   ){
      b=a[n--]; # sets the _n_ element of the array to _b_. this will save bytes later
                # immediately after, decrements _n_ by 1 (one less byte here)

                        # here the magic happens:
      s=s (             # this appends a chaining conditional to the variable _s_
          b~/[2-57]/?9: # if _b_ equals 2, 3, 4, 5 or 7, returns 9 (dummy number)
          b~6?9:        # otherwise, if _b_ equals 6, returns 9
          b~9?6:        # otherwise, if _b_ equals 9, returns 6
          b             # otherwise, returns its value
          )
    }
$1=s~$1      # evaluates if _s_ matches $1, and sets this boolean to $1
}
1            # prints $1.

Try it online!

AWK, 78 bytes
This is almost the same as above, but without the s variable. Two less bytes, with the effect of allowing only one input.
{n=split($1,a,"");for(;n;){b=a[n--];s=s (b~/[2-57]/?9:b~6?9:b~9?6:b)}$1=s~$1}1

Try it online!

Stax, 16 bytes
ê±°";╙ñ♀C¼EE^☼ùΣ

Run and debug it

Julia 1.0, 45 bytes
!x=prod(d->"01....9.86"[1+d],digits(x))=="$x"

Try it online!

Vyxal, 12 bytes
»\Π»F∑69S*Ṙ=

Try it Online!
    F∑       # Remove elements of...
»\Π»         # 23457
         *   # Ring translate by...
      69S    # "69"
          Ṙ= # Does it, reversed, equal the input?

Haha 69 funny number

JavaScript (Node.js), 55 bytes
n=>!(e=[...''+n]).some(c=>'0x'+'01aaaa9a86'[c]-e.pop())

Try it online!
Half test of n=>![...''+n].some((c,i,e)=>'0100009086'[c]-e.slice(~i)[0])

C# (Visual C# Interactive Compiler), 58 bytes
n=>$"{n}".Aggregate("",(z,c)=>"01----9-86"[c-48]+z)==n+"";

Try it online!

PHP, 49 bytes (anonymous function)
fn($s)=>$s==strrev(strtr($s,"6923457","9600000"))

Try it online!
The strtr translates 6 to 9, 9 to 6, and all non-symmetric digits to 0 (any character other than themselves would work). The digits 0, 1, and 8 are left unchanged. (The order I put them in is purely a stylistic choice; I don't think it even makes a difference in speed.)
Then strrev reverses this result, which is then compared with the original string; if they're equal, it has rotational symmetry.
PHP -F, 51 bytes (full program)
<?=$argn==strrev(strtr($argn,"6923457","9600000"));

Try it online!

Pyth - 21 bytes
&!-z+`180K`69qzX_z_KK

Test Suite.

X_zK does the same job as X_z_KK. 3rd parameter is optional.

Seriously, 23 bytes
,$;`"01xxxx9x86"í`MRεj=

Try it online!
This is essentially a port of xnor's Python 2 solution.
Explanation:
,$;`"01xxxx9x86"í`MRεj=
,$;                      push two copies of str(input)
   `"01xxxx9x86"í`M      map: get each digit's rotated digit (or x if not rotatable)
                   Rεj   reverse and join on empty string to make a string
                      =  compare equality with original input

Kotlin, 69 bytes
This takes the number, converts it to a string, rotates it, and then compares it with the original as a string for equality. Non-rotatable digits are simply converted to 0
{i->"$i".map{"0100009086"[it-'0']}.joinToString("").reversed()=="$i"}

Test it Here!

R, 111 bytes
With integer input and 0 output corresponding to truthy
f=sum
p=1:nchar(a<-scan())
b=a%%(l<-10^p)%/%(l/10)
d=(b-rev(b))^2
f(b>2&b<8&b!=6)+f(d[b<2|b==8])+f(d[!b%%3]!=9)

Try it online!

Nobody had posted a Python 3 solution so I'll go with my rubbish one
Python 3, 190 95 bytes
lambda x:not str(x).replace('0','').replace('1','').replace('6','').replace('8','').replace('9','').replace('0','')and str(x)[::-1].replace('6','z').replace('9','6').replace('z','9')==str(x)

EDIT:
lambda x:(x:=str(x))==[x:=x[::-1].replace(*p)for p in['6z','96','z9']][2]and not{*x}-{*'01689'}

You can shorten this to 95 bytes by using Python 3.8

K (ngn/k), 25 24 bytes
{d~|"01986""01689"?d:$x}

Try it online!
-1 byte thanks to @ngn
My first version was 74 bytes but then I read @xnor's solution and decided to translate that.

Using a Bubbler train doesn’t save any bytes here. f:~/1(|"01986"@"01689"?)\$:

you can remove the @

shorter: {d~|x[<x]x?d:$y}"01986"

Clever!  It’s enough of a leap that I’ll leave mine as is though.  This feels like a fresh idea.

ok, i'll post a separate answer. i have yet another idea.

K (ngn/k), 21 bytes
{y~|x[>x]x?y}/$68910,

Try it online!
68910, prepend 68910 to the argument
$ format both as strings
{ }/ apply a function to x="68910" and y= the original argument as string
x?y find the positions of the elements of y among x. use "null" (0N) for "nout found".
x[>x] down-sorted x, i.e. "98610"
x[>x]x?y index x[<x] with x?y. out-of-bounds indexing produces spaces
| reverse
y~ test if y matches that

Zsh, 65 56 bytes
Thanks to pxeger for saving a whopping 9 bytes!
>${(j..)${(Oas..)1}}<${${${${1//6/.}//<2-7>}//9/6}//./9}

Try it online!
Try it online!
Outputs via return code. The > construct creates and opens a file whose name is the reversed number for writing. The program will only exit truthy when the < construct attempts to read from a file with 6/9 swapped, and 2/3/4/5/7 removed.

-2 bytes using the <-> glob syntax to match numbers: Try it online!

Save another 7 by abusing the filesystem for the string comparison: Try it online!

Swift, 148 bytes
var a=[0,1,6,8,9],b=[0,1,9,8,6],c=readLine()!.map {Int(String($0))!},f = false,t = c.count;for i in 0..<t{f = c[t-i-1] == b[a.index(of: c[i]) ?? 0]}

PHP, 83 bytes
<?=$argn==strrev(str_replace([6,9,x],[x,6,9],preg_replace("/[^01689]/","",$argn)));

Save the code in a file (let's say symmetry.php) and run it as:
php -d error_reporting=0 -F symmetry.php

Run it online on TIO.
The algorithm is simple: remove the non-symmetric characters, replace 6 with 9 and 9 with 6 then reverse the result. If it equals the input string then it is a rotationally symmetrical number.

Brev, 80 bytes
(define(r n)(= n((as-list reverse(over(vector-ref #(0 1 3 4 5 6 9 8 8 6)x)))n)))

Non-minified:
(define (rotsym? n)
  (= n ((as-list reverse (over (vector-ref #(0 1 3 4 5 6 9 8 8 6) x))) n)))

Scala, 184 bytes
Golfed version. Try it online!
def f(n:Int)=n.toString.map{case '1'=>'1';case '2'=>'w';case '3'=>'z';case '4'=>'y';case '5'=>'x';case '6'=>'9';case '7'=>'x';case '8'=>'8';case '9'=>'6';case c=>c}==n.toString.reverse

Ungolfed version. Try it online!
object Main {
  def f(n: Int): Boolean = {
    val original = n.toString
    val transformed = original.map {
      case '1' => '1'
      case '2' => 'w'
      case '3' => 'z'
      case '4' => 'y'
      case '5' => 'x'
      case '6' => '9'
      case '7' => 'x'
      case '8' => '8'
      case '9' => '6'
      case c => c
    }
    original == transformed.reverse.mkString
  }

  def main(args: Array[String]): Unit = {
    for (n <- 1 until 1005 if f(n)) {
      println(s"$n satisfies the condition")
    }
  }
}

Lua, 73 bytes
r=''s=...s:gsub('.',load'r=({0,1,0,0,0,0,9,0,8,6})[...+1]..r')print(r==s)

Try it online!

Thunno 2, 12 bytes
kDḣ»©®£~»Ṇr=

Try it online!
Thunno 2, Vyxal, and 05AB1E all at 12 bytes!
Explanation
kDḣ»©®£~»Ṇr=  # Implicit input
kDḣ           # Push "123456789"
   »©®£~»     # Push "100009086"
         Ṇ    # Transliterate
          r   # Reverse it
           =  # Equals the input?

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Tips for golfing in dc
What general tips do you have for golfing in dc?
dc is a calculator utility for UNIX/Linux that predates the C language. I am interested in how to make my dc programs (calculations?) shorter. I'm looking for ideas that can be applied to general code-golf that are at least a little bit specific to dc (eg. removing comments is not a helpful answer)
Please post one tip per answer.

Use Marvel instead.

Arrays
Although they're a headache for beginners, dc offers arrays. They work like this:
value index :a    # store `value' in array linked to top of stack `a', with index `index'
      index ;a    # push a[index] on (main) stack

As usual, the first element has the index 0. Arrays can be useful when working with sequences, like in the SUDSI sequence, especially in combination with counters. Arrays can reduce the amount of number-shuffling you need to do (and the number of counters and comparisons) if you want to select a particular element without destroying your environment. For example, if you want to move a stackful of numbers into an array, you could write a recursive function that uses z (stack depth) or z 1- as the index, stores the element, and checks whether z == 0 to terminate itself.
[z 1- :a z 0 !=F]dsFx    # or I could just write such a function for you :)

Be aware of the following:

Arrays are associated with instances on named stacks. If you push a new value on a stack that has an array associated with it, that array will also be "pushed back", and a "new" array will take its place. The old array won't be usable until the corresponding value on the named stack is also usable (i.e., on top of its stack). This is a complicated concept that would be better explained with a good animation, which is beyond me.
You can store stuff in a named array without actually pushing a value into the corresponding named register. However, if you do this, you cannot access the stack/register with that name for the rest of the session. dc will crash.
If you pop a value off a named stack, any values in the corresponding array will be lost—no warnings, no safeguards, nothing. Just gone (which can also be useful).

Nice job with the DC tips!

dc may have been updated recently, and array behavior may have changed slightly with regard to crashing. Can't confirm either right now, but I think something was different last time I used it on Linux.

If you try to read an index from an array that hasn't been set, you get 0 and not an error. Which can be very useful, but is also worth being mindful of if you're potentially putting 0s in arrays... You'll need another way to test that the index has been touched.

If-then-else statements
Suppose we want to check the condition a==b (let a and b be stored in their respectively-named registers).

edit:

[         # Everything is wrapped in one big macro
  [         # An inner macro for our *then* part
              # <-- Stuff to execute if a==b here
  2Q          # Then quit the inner and outer macro
]sE       # `E' is for Execution register ;)
la lb =E  # if a==b, execute E
          # if E is executed, it will quit the whole macro, so the rest is never reached:
          # <-- Stuff to execute if a!=b here
]x        # End macro; Execute

Let (foo) be a placeholder, for the purpose of condensing:
[[(then)2Q]sE(condition)E(else)]x

Pretty sure this is the most compact if statement possible (also featured here).

Maybe [[thenaction]P][[elseaction]P][r]sI 2 4 =I x sI f is a start? The actions for tehn and else are on the stack, the "If" macro swaps them and is caled conditionally. then the top of stack will executed and the unused macro will be dropped in I to clean up the stack. 2 4 are just the example data to compare. Alternatively the [x]sI part can be moved to the comparison, if considered more readable: [[thenaction]P][[elseaction]P] 4 4 [r]sI =I x sI f. The f in the examples just shall show tat the stack is clean afterwards...

Rosetta Code's page about Dc mentions 3 flavours of dc and that was the 1st page where I saw OpenBSD dc's if-then-else construct. I think we need a dc fan bundle with all 3 flavours for all major operating systems... o:-) ...and my if-then-else proposal above does not work on the original dc because it lacks the r command... :-(

What about:  [[(if)2Q]si(condition)i(else)]x -- wrapping the whole thing in a macro, and the if-portion inside another macro inside that, so that you can 2Quit your way out of the whole thing before reaching the else-portion. So if you want to do if 1 == 1 then print 1 else print 2, it would be 1[[1P2Q]si1=i2P]x (untested as I don't have access to dc right here and now. Was also sure I  had done this trick in an answer here before but couldn't find it)

Yup, I did the math, my suggestion is shorter. With the same example and  "notation", and removing whitespace it's [/*else*/]sE[[/*then*/]sE]sIlalb=IlEx vs [[/*then*/2Q]sIlalb=I/*else*/]x -- 6 bytes difference. Still untested tho :P

Nice work, @daniero! I'll update the post when I have time, or you can do it if you want.

You can save input with d
By using d, which duplicates the ToS (top of stack) you can move the input out of the way for later use, while still being able to use it.

0 to the nth power instead of conditionals/macros
Sometimes you might need something like c ternary conditional:
A == B ? C : D;

A nice way to handle this is described in @Joe's answer.  However we can do better:
0AB-^E*C+

where E is D - C.
This tests for equality by raising 0 to the power of the difference of the two values.  This results in 1 if equal and 0 otherwise.  The rest just scales the 1 or 0 to the values C or D.  This works because dc gives 00 = 1 and 0n = 0 for n != 1.

Digits A to F may be used in substitution for the numbers 10 to 15.  However they must still be treated effectively as base 10 digits (assuming input base is 10) when in different places.  In other words, with input base 10 FF would not represent 255, it would represent (15 * 10) + 15 or 165.
In fact this works for all digits 0 to F in any input base 2 to 16.  So if the input base is 5, then 26E would be (2 * 5^2) + (6 * 5) + 14, or 94.
Note this behaviour is in effect for the unmodified GNU sources.  However, as @SophiaLechner points out, RedHat-based distros appear to use bc-1.06-dc_ibase.patch which changes this behaviour so digits >= ibase are treated as ibase - 1, regardless of their actual value.  Note the TIO dc appears not to have bc-1.06-dc_ibase.patch (even though its Fedora 28 ¯_(ツ)_/¯ ).

This isn't quite right - although single digits above the input base are interpreted as you'd hope, if the literal has multiple digits, or even a decimal point, invalid digits for the base are interpreted as (base-1). So in input base 10 FF represents 99, in input base 5 26E is the same as 244, i.e. base 10 74.

@SophiaLechner Are you sure? https://tio.run/##S0n@/9/QIJ/L0CCTy82tgMs0k8vIzLXg/38A  Which dc version are you running?  I'm using GNU dc 1.4.1 on ubuntu and GNU dc 1.3 on MacOS

Interesting. I'm running 1.3.95 on Red Hat, and here's your sample program:
 [slechner@XXX]$ dc -e '10o 10i FFp 5i 26Ep'
 99
 74
 [slechner@XXX]$ dc --version
 dc (GNU bc 1.06.95) 1.3.95

Argh...can't make the code block work in comment. The point is that FFp outputs 99 in 1.3.95. Could you check this in your MacOS version, then?

And TIO says it's running 1.4.1

The GNU dc manual is silent on this, but the bc manual (for 1.06) says "Input numbers may contain the characters 0-9 and A-F. (Note: They must be capitals. Lower case letters are variable names.) Single digit numbers always have the value of the digit regardless of the value of ibase. (i.e. A = 10.) For multi-digit numbers, bc changes all input digits greater or equal to ibase to the value of ibase-1. This makes the number FFF always be the largest 3 digit number of the input base." Based on my dc --version output, I think it's been implemented as a front end to bc.

@SophiaLechner Your output appears to be due to bc-1.06-dc_ibase.patch, which seems ubiquitous in RedHat-based distros, but not so much in debian-based.  As far as I can tell, patch has not made it upstream to the GNU sources

Sure thing! Thank you for all the research.

Sometimes it is necessary to discard a number from the stack.  One way to do this is to simply pop it into an unused variable, i.e. st.  However in some situations, you can pop it to a couple of other places, e.g. the input base when you have no more numerical input or to the precision specifier if you don't have any more operations to do where precision would make a difference.  In the former case, use i.  In the latter case, use k.

If numeric output isn't important, o can be used too. And if any of these things are unimportant, they can be used as storage as well as mere discard - I/K/O recall them respectively, and saves bytes over sa/la etc. Valid values AFAIK: i 2-16; k any nonnegative integer; o any integer greater than 1.

Length Calculation: Z, X, and z
Z pops the ToS and pushes the number of digits (decimal) if it's a number or the number of characters if it's a string. This can be useful for detecting the length of a result (for buffering output) or computing string length. Note that for numbers, Z pushes the combined length of the integer part and the fraction part.
X pops the ToS and pushes the number of digits in the fraction part of the number. If the ToS was a string, 0 is pushed.
To find the number of digits in the integer part of the number, one might use dZrX-. If you haven't changed the precision from the default k==0, using 1/Z is shorter, but suppose you need to maintain a particular non-zero precision after the operation: Kr0k1/Zrk is rather an eyesore.
z pushes the number of items on the stack. One of my favourite commands, it does not actually pop any values! It could be used to generate a sequence of numbers or increment a counter. Using zd repeatedly (say, at the start of a macro) could let one test a calculation on each natural or whole number in ascending order.

Have used z for this and that before, but never occurred to me to use it as a hack of a counter… Excellent…

If an operator is restricted from source, make a new one with a
Something that has come in handy for me a couple of times now is to avoid using a specific operator by pushing the ASCII value of the operator, using a to convert it to a string, and storing this in a register to be executed as a macro later on. For example, I need to do division, but am either disallowed from or trying to avoid using the character /. I can, instead do 47asd and then in the future when I need to divide 16 by 4, 16 4 ldx.

This will only work for single-character operators (can't build up a string), and will not work for commands like s that need to be postfixed by something.
This adds quite a few bytes, and is therefore only suitable when avoiding the specific character is necessary or somehow affords a score bonus.

When initialising a function macro (we'll use F) that you want to run immediately, use something like dsFx rather than sFlFx. The same works for variables: dsa rather than sala.
If you need to do other stuff in between the storing and the loading (e.g., sa[other stuff]la), still consider whether the above is viable: If you leave a value on the stack before the other operations, will it be back at the top by the end of those operations?

Just discovered this by accident. Yet another way to generate a zero: _.
_ is a signal to dc that the following digits are a negative number. Example:
_3 # pushes -3

But what if we don't follow it with a number?
_ # pushes 0...sometimes

This works when the next non-blank character following the underscore is not a digit. If a digit follows it, even after a newline, it is interpreted as a negative sign.
c4 5_6  # -6,5,4
c4 5_ 6 # -6,5,4
c4 5_
6       # -6,5,4 # still a negative sign since the next thing it sees is a digit
c4 5_z  #  3,0,5,4 # if it's followed by a non-digit, it's a 0
c4 5_p6 #  6,0,5,4
c4 _*   #  0 # 4*0=0

If the contents of the entire stack needs printing at the end of a program, a recursive macro loop could be used to achieve this.  However, it is much shorter to simply use the f command.

dc reads input a line at a time.  If you need to read in multiple items, doing it one-per line either requires a ? for every line to be read, or a cumbersome macro loop.  Instead, if all input items can be put on one space-separated line, then a single ? will read all the input items, pushing each one onto the stack.
For example in seq 10 | dc -e'?f', seq outputs integers 1-10, one per line.  the ? will just read the first 1 which will be output when f dumps the whole stack.  However in seq 10 | tr '\n' ' ' | dc -e'?f', the tr makes the input integers all space separated.  In this case the ? will read all the integers from the line in one go, and f will output them all.

Avoiding whitespace
Avoiding whitespace comes up in quite a few challenges, and is generally easy in dc. Aside from strings, the one very specific time that whitespace becomes necessary is when pushing multiple numbers in a row: 1 2 3. If this must be avoided:

Execute an empty macro in between: 1[]x2[]x3[]x.
If brackets are off the table, store a NOP of a macro ahead of time: 35asn and execute it in between: 1lnx2lnx3lnx.

You can also comma separate numbers, if you are willing to put up with dc: ',' (054) unimplemented warnings.

I hadn’t thought of that — presumably that applies to any given token that doesn’t resolve to a command… interesting…

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Solve a quadratic equation using Vieta's formulas
Exposition
Your mathematics teacher is a big fan of Vieta's formulas, and he believes that you should use them to solve quadratic equations. Given the equation
ax^2 + bx + c = 0

the product of its roots is c/a, and their sum is -b/a. When all of a, b and c are nonzero integers, assuming the roots are rational numbers, it's enough to try all possible numbers in the form
r1 = ±s/t

where s is a divisor of abs(c), and t is a divisor of abs(a). For each such r1, plug it into ax^2 + bx + c, and see whether the result is 0. If yes, then r1 is a root. The second root is -b/a-r1 or (c/a)/r1 - you can choose whatever formula you like.
Your teacher decided to give you many exercises, and he expects you to describe how you used Vieta's formulas to solve each one. Each exercise looks like this (example):
9x^2+12x+4=0

Write a subroutine or a program that gets an exercise as input, and outputs your alleged "solving process" to appease your teacher.

Input
Since you will feed the exercise to your program manually, format it in any convenient form. For example, use space-separated values on stdin:
9 12 4

or call a function with 3 parameters:
SolveExercise(9, 12, 4);

or parse the exercise literally:
9x^2+12x+4=0

Your output should be formatted as described below. Use the standard output device or return it as a string from your subroutine.
Output (example)
x = 1? 9x^2+12x+4 = 25
x = 2? 9x^2+12x+4 = 64
x = 1/3? 9x^2+12x+4 = 9
x = 2/3? 9x^2+12x+4 = 16
... (as many or as few failed attempts as you like)
x = -2/3? 9x^2+12x+4 = 0
r1 = -2/3
r2 = -12/9-(-2/3) = -2/3

Alternatively, the last line can be:
r2 = 4/9/(-2/3) = -2/3

Some additional notes:

The minimum number of line-breaks in the output is as described in the example (trailing line-break is not required). Additional line-breaks are permitted.
All coefficients in input are integers in the range [-9999...9999], none can be equal to 0
All roots are rational numbers, and should be output as such - e.g. 0.66666667 is not equal to 2/3 and so is incorrect
In the final expressions for r1 and r2, integers should be output as such, e.g. -99/1 is unacceptable, and should be output as -99; in other places in the output, denominator equal to ±1 is acceptable
Reduced form for rational numbers is not required - e.g. 2/4 is a good substitute for 1/2, even though it's ugly, even for roots r1 and r2
Parentheses in the output are sometimes required by rules of mathematics, e.g. in the expression 12/9/(2/3). When precedence rules of mathematics permit omission of parentheses, they are not required, e.g. -12/9--2/3. Superfluous parentheses are permitted: 4-(2) is OK, even though it's ugly
There should be at least one case (input) for which your program tries 3 or more non-integer values for r1; however, it's allowed to "guess the right answer" almost always on the first try
All trial values for r1 must be rational numbers ±s/t, where s and t are constrained as described above

Test cases

Input
x^2-x-2=0

or
1 -1 -2

Possible output
x=1? x^2-x-2=-2
x=-1? x^2-x-2=0
r1=-1
r2=-2/1/-1=2

Input
-x^2+2x-1=0

or
-1, 2x, -1

Possible output
x=1? -x^2+2x-1=0
r1=1
r2=-2/-1-1=1

Input
7x^2-316x+924=0

or
X(7, -316, 924);

Possible output (a divisor of 924 is 42, which solves the equation by "luck")
x=42? 7x^2-316x+924=0
r1=42
r2=316/7-42=22/7

Input
6x^2-35x-6=0

or
[6 -35 -6]

Possible output (even though your program may "know" that 6 is a root, it decides to show some failed trials)
x=1/2? 6x^2-35x-6=-88/4
x=1/3? 6x^2-35x-6=-153/9
x=3/2? 6x^2-35x-6=-180/4
x=6/1? 6x^2-35x-6=0
r1=6
r2=35/6-6=-1/6

Alternative versions for the last line:
r2=--35/6-6=-1/6
r2=-6/6/6=-1/6

Impossible input (no rational solutions)
x^2+5x+1=0

Impossible input (zero coefficient)
x^2-1=0

Does it have to be in ax^2 + bx + c form, or can we have the input simply be a b c?

Simple input is OK; updated the text

Was this downvoted for being "too advanced", or am I missing something... ?

Python - 202 200 bytes
2 bytes saved thanks to @FryAmTheEggman.
from fractions import*;f=Fraction
lambda a,b,c:"\n".join(["x=%s?%dx^2+%dx+%d=%s"%(i,a,b,c,a*i*i+b*i+c)for i in[f(1,a),f(-1,a),f(c,a)]]+["r%d=%s"%((3-i)/2,f(i*(b*b-4*a*c)**.5-b)/f(2*a))for i in[1,-1]])

from fractions import*;f=Fraction?

JavaScript (ES6), 373
(a,b,c,z='',A=Math.abs,M=(c,x,a)=>'-+'[c>0|0]+(x&&a<2?x:a+x),G=(a,b)=>b?G(b,a%b):a,O=(n,d,g=G(n,d))=>(g=d*g<0?-g:g)-d?n/g+'/'+d/g:n/d,e=M(a,'x^2',o=A(a))+M(b,'x',A(b))+M(c,'',q=A(c)),K=s=>(z+=`
x=${s}/${t}? ${e}=`+(v=a*s*s+b*s*t+c*t*t)+(v?'':`
r1=${O(s,t)}
r2=(${c}/${a})/(${s}/${t})=`+O(c*t,s*a)),v))=>{for(s=0;++s<=q;)for(t=0;++t<=o;)if(!(q%s||o%t||K(-s)&&K(s)))return z}

Test

f=(a,b,c,z='',A=Math.abs,M=(c,x,a)=>'-+'[c>0|0]+(x&&a<2?x:a+x),G=(a,b)=>b?G(b,a%b):a,O=(n,d,g=G(n,d))=>(g=d*g<0?-g:g)-d?n/g+'/'+d/g:n/d,e=M(a,'x^2',o=A(a))+M(b,'x',A(b))+M(c,'',q=A(c)),K=s=>(z+=`
x=${s}/${t}? ${e}=`+(v=a*s*s+b*s*t+c*t*t)+(v?'':`
r1=${O(s,t)}
r2=(${c}/${a})/(${s}/${t})=`+O(c*t,s*a)),v))=>{for(s=0;++s<=q;)for(t=0;++t<=o;)if(!(q%s||o%t||K(-s)&&K(s)))return z}

// Less golfed
U=(a,b,c,
   // locals
   z='',
   A=Math.abs,
   M=(c,x,a)=>'-+'[c>0|0]+(x&&a<2?x:a+x),
   G=(a,b)=>b?G(b,a%b):a, // GCD
   O=(n,d,g=G(n,d))=>(g=d*g<0?-g:g)-d?n/g+'/'+d/g:n/d, // output a fraction
   o=A(a),q=A(c),
   e=M(a,'x^2',o)+M(b,'x',A(b))+M(c,'',q), // espression from coefficients
   K=s=>( // check & output a candidate solution
      z+=`\nx=${s}/${t}? ${e}=`+(v=a*s*s+b*s*t+c*t*t)+(v?'':`
r1=${O(s,t)}
r2=(${c}/${a})/(${s}/${t})=`+O(c*t,s*a)),v
  )
)=>{
  for(s=0;++s<=q;)
    for(t=0;++t<=o;)
      if(!(q%s||o%t||K(-s)&&K(s)))
        return z
}

console.log=x=>O.textContent+=x+'\n'

// Test
console.log(f(9,12,4))
console.log(f(1,-1,-2))
console.log(f(-1,2,-1))
console.log(f(7,-316,924))
console.log(f(6,-35,-6))

Mathematica, 236 Bytes
I'm sure there's a way to shorten this further, but this was my first attempt at learning the language.
Golfed
s=Input[];f[x_]:=#3 x^2+#1 x+#2&@@s;t=Drop[Z1,1];r=Catch[Do[Print[StringForm["x=``? ``=``",y,f[x],f[y]]];If[f[y]==0,Throw[y]],{y,(Flatten[Outer[Divide,#1,#2]]&@@(Join[#,-#]&/@Divisors[#]&[t]))}]]StringForm["r1=``\nr2=``",r, #1/#2/r&@@t]

Ungolfed with comments
(*Get coefficients in list {B,C,A}*)
s=Input[];

(*Create the function*)
f[x_]:=#3 x^2+#1 x+#2&@@s;

(*Take C and A*)
t=Drop[Z1,1];

(*Get a list of all positive and negative divisors for C and A, then use those to get all possible permutations for R=S/T as given in the challenge*)
(*Print out each attempt at finding a root. If one is found, exit the loop and return it*)

r=Catch[Do[Print[StringForm["x=``? ``=``",y,f[x],f[y]]];If[f[y]==0,Throw[y]],{y,(Flatten[Outer[Divide,#1,#2]]&@@(Join[#,-#]&/@Divisors[#]&[t]))}]];

(*Print the roots using (c/a)/r1 *)
StringForm["r1=``\nr2= ``",r, #1/#2/r&@@t]

Coefficients must be entered in the (convenient) form {B,C,A}.


text:
Subsequence Substitution
Most languages come with a built-in to search a string for all occurrences of a given substring and replace those with another. I don't know of any language that generalises this concept to (not necessarily contiguous) subsequences. So that's your task in this challenge.
The input will consist of three strings A, B and C, where B and C are guaranteed to be of the same length. If B appears as a subsequence in A it should be replaced with C. Here is a simple example:
A: abcdefghijklmnopqrstuvwxyz
B: ghost
C: 12345

It would be processed like this:
abcdefghijklmnopqrstuvwxyz
      ||      |   ||
abcdef12ijklmn3pqr45uvwxyz

If there are several ways to find B as a subsequence, you should greedily replace the left-most one:
A: abcdeedcba
B: ada
C: BOB

Result:   BbcOeedcbB
and NOT:  BbcdeeOcbB

The same applies if B could be found in multiple disjoint places:
A: abcdeedcbaabcde
B: ed
C: 12

Result:   abcd1e2cbaabcde
and NOT:  abcd112cbaabc2e (or similar)

When B does not appear in A, you should output A unchanged.
Rules
As stated above, take three strings A, B and C as input and replace the left-most occurrence of B as a subsequence in A with C, if there is any.
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter.
You may take the three strings in any consistent order which you should specify in your answer. You may assume that B and C have the same length. All strings will only contain alphanumeric characters.
Standard code-golf rules apply.
Test Cases
Each test case is four lines: A, B, C followed by the result.
abcdefghijklmnopqrstuvwxyz
ghost
12345
abcdef12ijklmn3pqr45uvwxyz

abcdeedcba
ada
BOB
BbcOeedcbB

abcdeedcbaabcde
ed
12
abcd1e2cbaabcde

121
121
aBc
aBc

abcde
acb
123
abcde

ABC
ABCD
1234
ABC

012345678901234567890123456789
42
TT
0123T5678901T34567890123456789

edcbaedcbaedcbaedcba
abcde
12345
edcbaedcbaedcbaedcba

edcbaedcbaedcbaedcbaedcba
abcde
12345
edcb1edc2aed3bae4cba5dcba

daccdedca
ace
cra
dcrcdadca

aacbcbabcccaabcbabcaabbbbca
abaaaccbac
1223334444
aacbcbabcccaabcbabcaabbbbca

aacbcbabcccaabcbabcaabbbbcac
abaaaccbac
1223334444
1ac2cb2bccc33b3bab4aa4bbbc44

Leaderboard
The Stack Snippet at the bottom of this post generates leaderboards from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:
## [><>](http://esolangs.org/wiki/Fish), 121 bytes

/* Configuration */

var QUESTION_ID = 77719; // Obtain this from the url
// It will be like http://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "http://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "http://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}

<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Would a list of single character strings be alright for input / output?

@FryAmTheEggman Hm, the only consensus I can find is this which doesn't address lists of single-character strings as valid string representations. Might be worth making a meta post (especially because I think this also came up on xnor's latest challenge). I'm going to say no for now.

What about character arrays? This seems to imply they're allowed even if the language has a proper string type.

@Dennis Yeah, character arrays are fine, but singleton strings is like taking an array of integers as [[1], [2], [3]].

OK, thanks for clearing that up.

Jelly, 23 22 21 bytes
='T€ŒpfṢ€$ḢṬœp³ż⁵$³Ḋ?

Try it online! Note that the last two test cases will run out of memory.
Verification
$ head -n 5 test-cases
abcdefghijklmnopqrstuvwxyz
ghost
12345
abcdef12ijklmn3pqr45uvwxyz

$ cat subseq-short
while read s; do
        read p; read r; read o; echo $o; read
        timeout 1s jelly eun $1 "='T€ŒpfṢ€$ḢṬœp³ż⁵$³Ḋ?" "'$s'" "'$p'" "'$r'"
        (($?)) && echo '(killed)'
done < test-cases
$ ./subseq-short
abcdef12ijklmn3pqr45uvwxyz
abcdef12ijklmn3pqr45uvwxyz
BbcOeedcbB
BbcOeedcbB
abcd1e2cbaabcde
abcd1e2cbaabcde
aBc
aBc
abcde
abcde
ABC
ABC
0123T5678901T34567890123456789
0123T5678901T34567890123456789
edcbaedcbaedcbaedcba
edcbaedcbaedcbaedcba
edcb1edc2aed3bae4cba5dcba
edcb1edc2aed3bae4cba5dcba
dcrcdadca
dcrcdadca
aacbcbabcccaabcbabcaabbbbca
(killed)
1ac2cb2bccc33b3bab4aa4bbbc44
(killed)

How it works
='T€ŒpfṢ€$ḢṬœp³ż⁵$³Ḋ?  Main link. Arguments: string s, pattern p, replacement r

='                     Compare each character of s with each character of p.
                       This yields a 2D list. Each row corresponds to a char in p.
  T€                   Compute the truthy indices of each row, i.e., the indices
                       of all occurrences of that char in s.
   Œp                  Compute the Cartesian product of the lists of indices.
        $              Combine the two links to the left into a monadic chain:
      Ṣ€                 Sort each list of indices.
     f                   Filter, removing all non-sorted lists of indices.
         Ḣ             Head; take the first (sorted) list of indices.
          Ṭ            Truth; generate a list with 1's at those indices.
           œp³         Partition; split s at all 1's, removing those characters.
                  Ḋ?   If the partition has more than more than one element:
              ż⁵$        Zip the partition with r.
                 ³       Else, return s.

Python 2, 88 bytes
def f(a,b,c,o=""):
 for q in a:x=q==b[:1];o+=c[:x]or q;b=b[x:];c=c[x:]
 print[o,a][c>'']

A function that takes in the three strings and outputs the result to STDOUT. The function simply does one pass over the string, taking the appropriate char and updating b,c as we go.
For testing (after replacing the print with return):
S = """
<test cases here>
"""

for T in S.split("\n\n"):
    A,B,C,D = T.split()
    assert f(A,B,C) == D

Java 7, 141
I think there's some more I can do with this, but I've gotta run for now. It's just a simple iterate/replace, keeping an index in A and B.
char[]h(char[]a,char[]b,char[]c){char[]d=a.clone();int i=0,j=0,k=b.length;for(;i<a.length&j<k;i++)if(a[i]==b[j])d[i]=c[j++];return j==k?d:a;}

Whitespaced for your pleasure:
char[]h(char[]a,char[]b,char[]c){
    char[]d=a.clone();
    int i=0,j=0,k=b.length;
    for(;i<a.length&j<k;i++)
        if(a[i]==b[j])d[i]=c[j++];
    return j==k?d:a;
}

Whitespaced yeah, that's totally readable

Isn't it though? The main reason I add the multi-line indented version is to avoid horizontal scrolling, just so it can all be seen at once. Inline whitespace isn't as big a deal IMO ;)

[feature-request] even more whitespace

@AlexA. Here ya go!

@Geobits Save a byte at the end if you do j<k?a:d

Lua, 121 Bytes
Straightforward solution, gsub allows us to iterate exactly once on each character and to replace them in a new instance of the string.
It takes input via 3 command-line argument and output a string to STDOUT.
a,b,c=...d=a:gsub(".",function(s)if b:find(s)then b=b:sub(2)x=c:sub(1,1)c=c:sub(2)return x end end)print(b~=''and a or d)

Ungolfed
a,b,c=...               -- unpack the arguments into a, b and c
d=a:gsub(".",function(s)-- iterate over each character of the first argument
  if b:find(s)then      -- if the current character is in the set b
    b=b:sub(2)          -- remove it from b
    x=c:sub(1,1)        -- save the replacement character in x
    c=c:sub(2)          -- remove it from c
    return x            -- replace the current character with x
  end
end)
print(b~=''             -- if b is empty, we replaced all the character
      and a or d)       -- so output the result of gsub, else, output the first argument

Python 3, 127 bytes.
Saved 16 bytes thanks to Katenkyo.
Still working on this a bit, man was this nastier than I thought it would be.
f=lambda a,b,c:a.replace(b[0],c[0],1)[:a.index(b[0])+1]+f(a[a.index(b[0])+1:],b[1:],c[1:])if b and all(x in a for x in b)else a

Explanation:
Awww yeah, recursion.
Test cases:
assert f('abcdeedcba', 'ada', 'BOB') == 'BbcOeedcbB'
assert f('abcdeedcbaabcde', 'ed', '12') == 'abcd1e2cbaabcde'
assert f('012345678901234567890123456789', '42', 'TT') == '0123T5678901T34567890123456789'
assert f('ABC', 'ABCD', '1234') == 'ABC'

+1 for golfing 50 off, but keep going! This needs to beat my Java answer at the least ;)

@Geobits Yeah, I've never lost to Java before. This is my greatest shame.

I'm not really versed in python but all(x in a for x in b) also checks that elements in b and a appears in the same order, or only if they are here?

@Katenkyo Only that they're all there, but the order gets taken care of by the slicing when we recurse.

Ok, also, wouldn't return a.replace(b[0],c[0],1)[:l(b[0])+1]+f(a[l(b[0])+1:],b[1:],c[1:])if b and all(x in a for x in b)else a makes you save some bytes?

You could walk through each index one-by-one so you don't have to type out the replace and index function calls, like so: (c[0]+f(a[1:],b[1:],c[1:])if a[0]==b[0]else a[0]+f(a[1:],b,c))if b and all(x in a for x in b)else a

Venti is twenty... "tol" is large and "grande" is Spanish for large. Venti's the only one that doesn't mean large.

Python 3.5, 87 bytes
import re
lambda s,p,r:re.sub('(.*?)'.join(p),'\g<%d>'.join(r)%(*range(1,len(r)),),s,1)

repl.it to verify all test cases.
How it works

'(.*?)'.join(p) builds a search pattern that matches the subsequence to be replaced and anything between its elements.
Since the quantifiers are lazy, each (.*?) will match as few characters as possible.
For the pattern ghost, the constructed regex is g(.*?)h(.*?)o(.*?)s(.*?)t.
'\g<%d>'.join(r)%(*range(1,len(r)),) builds the replacement string, using string formatting.
Each \g<n> refers to the nth captured group, just like \n would.
For the replacement 12345, the constructed string is 1\g<1>2\g<2>3\g<3>4\g<4>5.
re.sub(...,...,s,1) performs at most one replacement in the string s.

Pyth, 27
.xuXG.*HC,hSI#.nM*FxRcQ1zwQ

Test Suite
The test suite omits the last two cases because they will run out of memory. The algorithm used here is to find all of the indices of each character in the second string in the first string, then find all possible orderings of those indices and take only the ones that are in sorted order. Then use the first one of these in sorted order as the list of indices in the first string to update with values from the third string.
I feel like there should be something shorter than .nM*F...

MATL, 33 bytes
y!=[]0b"@n:!<@*fX<h5Mt?}.]]?iw(}x

Try it online!
Explanation
y!      % Implicitly input first two strings. Duplicate the first and transpose
=       % Compare the two strings element-wise. Gives a 2D array with all combinations
[]      % Push empty array. Indices of matching elements will be appended to this
0       % Push a 0. This is the index of last character used up in first string
b       % Bubble up (rearrange elements in stack) to move 2D array to top
"       % For each column of that array (each char of the second string)
  @     %   Push current column
  n:!   %   Transform into column array of consecutive values starting from 1
  <     %   Compare with index of last character used up of first string
  @*    %   Push current column again. Multiply element-wise (logical AND)
  fX<   %   Find index of first matching character, or empty if there's none
  h     %   Append to array containing indices of matching elements
  5Mt   %   Push index of matching character again. Duplicate
  ?}    %   If it's empty
    .   %     Break loop
  ]     %   End if
]       % End for
        % The top of the stack now contains a copy of the index of last matching
        % character, or an empty array if there was no match
?       % If non-empty: all characters were matched
  i     %   Input third string
  w     %   Swap top two elements in stack
  (     %   Assign the characters of the third string to first string at found indices
}       % Else: the original string needs to be output
  x     %   Delete (partial) array of matching indices. Leave original string in stack
        % End if
        % Implicitly display (either modified string or original string)

JavaScript (ES6), 84 bytes
(a,b,c)=>[...b].every((q,i)=>r[p=a.indexOf(q,p)]=~p++&&c[i],p=0,r=[...a])?r.join``:a

Explanation / Test

var solution =

(a,b,c)=>
  [...b].every((q,i)=>
    r[p=a.indexOf(q,p)]=~p++&&c[i],
    p=0,
    r=[...a]
  )?r.join``
  :a

// Test
var testCases = `abcdefghijklmnopqrstuvwxyz
ghost
12345
abcdef12ijklmn3pqr45uvwxyz

abcdeedcba
ada
BOB
BbcOeedcbB

abcdeedcbaabcde
ed
12
abcd1e2cbaabcde

121
121
aBc
aBc

abcde
acb
123
abcde

ABC
ABCD
1234
ABC

012345678901234567890123456789
42
TT
0123T5678901T34567890123456789

edcbaedcbaedcbaedcba
abcde
12345
edcbaedcbaedcbaedcba

edcbaedcbaedcbaedcbaedcba
abcde
12345
edcb1edc2aed3bae4cba5dcba

daccdedca
ace
cra
dcrcdadca

aacbcbabcccaabcbabcaabbbbca
abaaaccbac
1223334444
aacbcbabcccaabcbabcaabbbbca

aacbcbabcccaabcbabcaabbbbcac
abaaaccbac
1223334444
1ac2cb2bccc33b3bab4aa4bbbc44`
.split`\n\n`.map(c=>c.split`\n`);
document.write("
"+testCases.map(c=>(r=solution(c[0],c[1],c[2]))+" : "+(r==c[3]?"PASS":"FAIL")).join`\n`);

JavaScript (ES6), 84 76 bytes
(a,b,c)=>a.replace(RegExp([...b].join`(.*?)`),c.replace(/\B/g,(_,i)=>'$'+i))

Because I was sure that this was a job for RegExp.
Edit: Saved 8 bytes thanks to @MartinBüttner♦.
A port of @KevinLau's Ruby answer took 82 bytes:
([...a],[...b],[...c])=>(d=a.map(e=>e==b[0]?c.shift(b.shift()):e),b[0]?a:d).join``

I also tried a recursive RegExp solution but that took 90 bytes:
f=(a,[b,...d],[c,...e])=>b?a.replace(RegExp(b+'(.*'+d.join`.*`+'.*)'),(_,s)=>c+f(s,d,e)):a

Julia, 89 70 bytes
f(s,a,b,i=0)=(o=join(["$a "[i+1]!=c?c:b[i+=1]for c=s]);i<endof(a)?s:o)

Uses an index i to iterate through the pattern/replacement strings as we go. -19 bytes thanks to @Dennis!

C, 98 bytes
char*f(i,o,s,r)char*i,*o,*s,*r;{char*I=i,*O=o;for(;*i;++i,++o)*o=*i==*s?++s,*r++:*i;return*s?I:O;}

/* Expanded code */
char *f(i, o, s, r)
    char *i, *o, *s, *r;
{
    char *I=i, *O=o;
    for (;  *i;  ++i,++o)
        *o = (*i==*s) ? (++s,*r++) : *i;
    return *s ? I : O;
}

Arguments are: input string, output buffer, search string, replacement.
After remembering the start of input and output, we walk the input, replacing and advancing the substitution whenever we hit one.  At the end, if we've run out of substitutions, return the output buffer, else the unmodified input.
/* Tests */
struct T
{
    const char *input;
    const char *search;
    const char *replace;
    const char *expected;
};

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int i;
    static const struct T test[] = {
        { "abcdefghijklmnopqrstuvwxyz",
          "ghost",
          "12345",
          "abcdef12ijklmn3pqr45uvwxyz"},
        { "abcdeedcba",
          "ada",
          "BOB",
          "BbcOeedcbB"},
        { "abcdeedcbaabcde",
          "ed",
          "12",
          "abcd1e2cbaabcde"},
        { "121",
          "121",
          "aBc",
          "aBc"},
        { "abcde",
          "acb",
          "123",
          "abcde"},
        { "ABC",
          "ABCD",
          "1234",
          "ABC"},
        { "012345678901234567890123456789",
          "42",
          "TT",
          "0123T5678901T34567890123456789"},
        { "edcbaedcbaedcbaedcba",
          "abcde",
          "12345",
          "edcbaedcbaedcbaedcba"},
        { "edcbaedcbaedcbaedcbaedcba",
          "abcde",
          "12345",
          "edcb1edc2aed3bae4cba5dcba"},
        { "daccdedca",
          "ace",
          "cra",
          "dcrcdadca"},
        { "aacbcbabcccaabcbabcaabbbbca",
          "abaaaccbac",
          "1223334444",
          "aacbcbabcccaabcbabcaabbbbca"},
        { "aacbcbabcccaabcbabcaabbbbcac",
          "abaaaccbac",
          "1223334444",
          "1ac2cb2bccc33b3bab4aa4bbbc44"
        }
    };

    for (i = 0;  i < (sizeof test) / (sizeof test[0]);  ++i) {
        const struct T *t = test+i;
        char *out = malloc(strlen(t->input)+1);
        char *result = f(t->input, out, t->search, t->replace);
        if (strcmp(t->expected, result))
            printf("Failed test %d; result = \"%s\"\n", i, result);
    }
    return EXIT_SUCCESS;
}

R, 76 bytes
function(a,b,c){s=substr;for(x in 1:nchar(b)){a=sub(s(b,x,x),s(c,x,x),a)};a}

uses sub to replace first match
Ungolfed
function(a,b,c){                    # function with 3 arguments as per description
  s=substr;                         # alias for substr (saves 1 byte)
   for(x in 1:nchar(b)){            # index 1 to number character in b
     a=sub(s(b,x,x),s(c,x,x),a)};   # replace first instance of b[x] in a
                                    # with c[x] and reassign to a
 a}                                 # return a

C++, 204 bytes

Golfed
#include<iostream>
#include<string>
int main(){std::string a, b, c;std::cin>>a>>b>>c;int t=0;for(int x=0;x<b.length();x++){t=a.find(b[x],t);if(t!=-1){a.replace(t,1,c.substr(x,1));}}std::cout<<a;return 0;}

Ungolfed
#include<iostream>
#include<string>

int main()
{
    std::string a, b, c;
    std::cin>>a>>b>>c;
    int t = 0;
    for (int x=0;x<b.length();x++) {
        t = a.find(b[x], t);
        if (t != -1) {
            a.replace(t,1,c.substr(x, 1));
        }
    }
    std::cout<<a;
    return 0;
}

I don't think you're using std quite enough to warrant using using namespace std;. Using std::cin, std::cout, and std::string will save 5 bytes since those seem to be the only uses of that namespace.

@KevinLau Thanks! You're very correct, I thought of that, but didn't actually count to realise it would save chars.

Oh! One more thing, since it's important. After reading over your code again I realized you are greedily replacing the left-most occurrence of each letter within b in a, but the later letters have to be after the earlier letters as well. (Look at test case 3 and compare with your output, I think you'll find that your code would output abc21ed... when the expected output is abcd1e2...!)

In ideone C++14 compiler input of "Adregffftd\nA23\nzac\n" above code 10 minutes ago, generate the output of "zdregffftd" instead of "Adregffftd"

Retina, 63 bytes
.+$
$&¶;$&
+`^(.)(.*¶)(.)([^;]+);(.*?)\1
$2$4$5$3;
A1`
;

G2=`.

Input is taken in order B, C, A, separated by linefeeds.
Try it online.

JavaScript (ES6), 100 95 bytes
(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

This is a valid JavaScript Lambda function. Outputs as function return. Takes in three arguments (a,b,c). Add f= at the beginning and invoke like f(arg1,arg2,arg3).

f=(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

console.log(f(prompt("Value for A"),prompt("Value for B"),prompt("Value for C")))

Welcome to PPCG! Unnamed functions are generally acceptable, so you don't need the f= unless your function is recursive, but it doesn't look like it is.

@MartinBüttner Thanks! :) Updated my answer.

Unfortunately, this will fail if a doesn't contain the pattern. I'm also not sure returning an array of strings is acceptable.

@Dennis I have updated my solution. I think its correct now. Sorry for such late reply and updation. (I just noticed your comment, hence the delay)

@MartinEnder While I was going through all my solutions, I found that this one was incorrect. But, I have corrected it now; and it's five bytes shorter (since I had left many golfable places untouched; I was a novice golfer at that time; not that I am great one now, though :p). Sorry for posting a wrong solution.

Haskell, 87 bytes
x@((a,b):c)#(d:e)|a==d,([],z)<-c#e=([],b:z)|0<1=(d:)<$>x#e
x#y=(x,y)
a!b=snd.(zip a b#)

I noticed the lack of a Haskell answer, and decided to fix that.
This defines a ternary function ! with argument order pattern-replacement-string.
Try it here.
Explanation
The auxiliary function # takes a list x of character pairs (pattern and replacement) and a string y.
If the "pattern" characters in x form a subsequence of y, it returns the empty list and y with each pattern character replaced by its counterpart.
Otherwise, it returns the pair (x,y).
The function ! zips the pattern and replacement strings into x, applies # to x and the third string, and returns the second component of the result.
x@((a,b):c)#(d:e)  -- First case of #: both arguments nonempty.
  |a==d,           -- If the pattern char matches the string's head,
   ([],z)<-c#e     -- and the pattern's tail is a subsequence of the string's tail,
  =([],b:z)        -- tack the replacement char to the recursion result.
  |0<1             -- Otherwise,
  =(d:)<$>x#e      -- recurse with the same pairs and tack string's head to result.
x#y=(x,y)          -- If either argument is empty, just pair them.

If the pattern is a subsequence of the string, the code runs in O(n) time, making one recursive pass through the string and greedily constructing the replacement in the process.
However, if the pattern is not a subsequence, it runs in O(2n) time in the worst case.
This is because at every position where the pattern and string have a matching character, the function calls itself to check whether the pattern is actually a subsequence, finds out it's not, and calls itself a second time to actually compute the result.

C (gcc), 67 62 61 59 bytes
f(s,a,b)char*s,*a,*b;{*s==*a?*s=*b++,a++:1;*a&&f(s+1,a,b);}

Try it online!

Octave, 97 bytes
function A=U(A,B,C)t=0;for s=B if p=find(A(t+1:end)==s,1) D(t=p+t)=~0;else return;end;end;A(D)=C;

Iterate over the subsequence to replace; find first occurrence of first character, find next character in remaining string, repeat. The one interesting bit of this is:
D(t=p+t)=~0

D(     )      %// D is a logical mask of characters to replace in the input string
  t=p+t       %// t is the current end of D
              %// p is the location of the character to replace
              %// update t and use as index to grow D
        =~0   %// make it so, number 1

Since ideone is still not accepting functions with names other than '', I'll just leave a sample run here. Inputs are only shown for the first few test cases for brevity. key is the expected output, ans is the function output.
A = abcdefghijklmnopqrstuvwxyz
B = ghost
C = 12345
key = abcdef12ijklmn3pqr45uvwxyz
ans = abcdef12ijklmn3pqr45uvwxyz
A = abcdeedcba
B = ada
C = BOB
key = BbcOeedcbB
ans = BbcOeedcbB
A = abcdeedcbaabcde
B = ed
C = 12
key = abcd1e2cbaabcde
ans = abcd1e2cbaabcde
key = aBc
ans = aBc
key = abcde
ans = abcde
key = ABC
ans = ABC
key = 0123T5678901T34567890123456789
ans = 0123T5678901T34567890123456789
key = edcbaedcbaedcbaedcba
ans = edcbaedcbaedcbaedcba
key = edcb1edc2aed3bae4cba5dcba
ans = edcb1edc2aed3bae4cba5dcba
key = dcrcdadca
ans = dcrcdadca
key = aacbcbabcccaabcbabcaabbbbca
ans = aacbcbabcccaabcbabcaabbbbca
key = 1ac2cb2bccc33b3bab4aa4bbbc44
ans = 1ac2cb2bccc33b3bab4aa4bbbc44

Those Octave assignments in unexpected places (D(t=...)) keep puzzling me :-)

@LuisMendo haha... it's almost like... a stack! :)

Ruby, 70 64 59 58 bytes
Anonymous function. Walk through the string a to build a new string with letters replaced in accordance to the next character in b and c, then if all characters in b are exhausted at the end, return the newly constructed string, otherwise return the original string.
@histocrat helped save 6 bytes via gsub.
Saved 1 byte thanks to @Cyoce.
->a,b,c{i=0;s=a.gsub(/./){$&==b[i]?c[~-i+=1]:$&};b[i]?a:s}

Try it online!

You can save a byte by replacing -1+i+=1 with ~-i+=1

Python 3, 123 Bytes
A different approach I wanted to share, which is a few bytes shorter. There are no rules against standard library/regex, right?
import re
j=''.join
m='(.*?)'
def f(A,B,C):
 *r,l=(re.findall(m+m.join(B)+'(.*)',A)or[[A]])[0]
 print(j(map(j,zip(r,C)))+l)

PS. This is my first golf. Let me know of any issues/improvements.

Pyth, 22 bytes
|eJ:Ej"(.*?)"+E\$3s.iJ

Verify all test cases in the Pyth Compiler.
Background
We build a regex from the pattern by appending a $ and placing (.*?) between all characters. This regex will match the subsequence to be replaced and anything between its elements, and anything up to the end of the string.
Since the quantifiers are lazy, each (.*?) will match as few characters as possible.
For the pattern ghost, the constructed regex is g(.*?)h(.*?)o(.*?)s(.*?)t(.*?)$.
If the pattern matches the input, the builtin r<str><regex>3 will return an array containing the prematch (everything before the subsequence), all captured groups (everything in between and after the subsequence), and the postmatch (the empty string).
If the pattern does not match, the builtin will return a singleton array containing the original input.
How it works
|eJ:Ej"(.*?)"+E\$3s.iJQ  (implicit) Store the first line of input in Q.

             +E\$        Read the third line of input (pattern) and append '$'.
     j"(.*?)"            Join the result, separating by "(.*?)".
    E                    Read the third line of input (string).
   :             3       Match the string against the regex, as detailed above.
  J                      Save the returned array in J.
 e                       Extract the last element of J. This is an empty string
                         for a successful match or the original string.
|                        Logical OR; replace an empty string with the following:
                   .iJQ    Interleave J and the replacement.
                  s        Flatten the resulting array of strings.

Jelly, 23 bytes
Ṭœpż⁵
0ẋai1
⁴='-;ç\ñ⁴P?

This is two bytes longer than my other Jelly answer, but it finishes instantly. Try it online!
Verification
$ head -n 5 test-cases
abcdefghijklmnopqrstuvwxyz
ghost
12345
abcdef12ijklmn3pqr45uvwxyz

$ cat subseq-fast
while read s; do
        read p; read r; read o; echo $o; read
        timeout 10s jelly eun $1 "Ṭœpż⁵¶0ẋai1¶⁴='-;ç\ñ⁴P?" "'$p'" "'$s'" "'$r'"
        (($?)) && echo '(killed)'
done < test-cases
$ ./subseq-fast
abcdef12ijklmn3pqr45uvwxyz
abcdef12ijklmn3pqr45uvwxyz
BbcOeedcbB
BbcOeedcbB
abcd1e2cbaabcde
abcd1e2cbaabcde
aBc
aBc
abcde
abcde
ABC
ABC
0123T5678901T34567890123456789
0123T5678901T34567890123456789
edcbaedcbaedcbaedcba
edcbaedcbaedcbaedcba
edcb1edc2aed3bae4cba5dcba
edcb1edc2aed3bae4cba5dcba
dcrcdadca
dcrcdadca
aacbcbabcccaabcbabcaabbbbca
aacbcbabcccaabcbabcaabbbbca
1ac2cb2bccc33b3bab4aa4bbbc44
1ac2cb2bccc33b3bab4aa4bbbc44

How it works
⁴='-;ç\ñ⁴P?  Main link. Arguments: pattern p, string s, replacement r

⁴='          Compare each character of s with each character of p.
             This yields a 2D list. Each row corresponds to a char in p.
   -;        Prepend -1 to the 2D list, yielding a ragged array.
     ç\      Cumulatively reduce the array by the second helper link.
         P?  If the product of the resulting list is non-zero:
       ñ       Call the first helper link with the list and s as arguments.
        ⁴      Else, return s.

Ṭœpż⁵        First helper link. Arguments: L (list of indices), r (replacement)

Ṭ            Truth; generate a list with 1's at those indices.
 œp          Partition; split s at all 1's, removing those characters.
   ż⁵        Zip the partition with r.

0ẋai1        Second helper link. Arguments: n (integer), B (list of Booleans)

0ẋ           Generate a list of n zeroes.
  a          Perform logical AND with B.
             This zeroes out the with n elements of B.
   i1        Compute the first index of 1.

Julia, 93 90 86 bytes
f(s,p,r)=(try s=join([match(Regex(join("^$p\$","(.*?)")),s).captures';[r...""]])end;s)

Having to test separately if the match was successful kinda destroys the score. A substitution would require casting to Base.SubstitutionString, which probably isn't worth it...
Test run
julia> f(s,p,r)=(try s=join([match(Regex(join("^$p\$","(.*?)")),s).captures';[r...""]])end;s)
f (generic function with 1 method)

julia> f("aacbcbabcccaabcbabcaabbbbca","abaaaccbac","1223334444")
"aacbcbabcccaabcbabcaabbbbca"

julia> f("aacbcbabcccaabcbabcaabbbbcac","abaaaccbac","1223334444")
"1ac2cb2bccc33b3bab4aa4bbbc44"

CJam, 29 bytes
l_ll.{2$#_3$<@+\)@>}s_2$,>@@?

Try it online! or verify all test cases.

Julia, 62 59 58 bytes
f(s,p,r)=(try s[[i=findnext(s,c,i+1)for c=p]'],i=r,0end;s)

I/O is in form of character arrays.
Verification
julia> f(s,p,r)=(try s[[i=findnext(s,c,i+1)for c=p]'],i=r,0end;s)
f (generic function with 2 methods)

julia> F(s,p,r)=join(f([s...],[p...],[r...])) # string/char array conversion
F (generic function with 1 method)

julia> F("aacbcbabcccaabcbabcaabbbbca","abaaaccbac","1223334444")
"aacbcbabcccaabcbabcaabbbbca"

julia> F("aacbcbabcccaabcbabcaabbbbcac","abaaaccbac","1223334444")
"1ac2cb2bccc33b3bab4aa4bbbc44"

Java 7, 102 bytes
void L(char[]s,char[]l,char[]r){for(int x=0,y=0;x<s.length&&y<l.length;x++)if(s[x]==l[y])s[x]=r[y++];}

Detailed try here
// String, Lookup, Replacement
void L(char[]s, char[]l, char[]r)
{
    for(int x=0, y=0; x < s.length && y < l.length; x++)
        if(s[x] == l[y])
            s[x] = r[y++];
}

PHP, 130 109 bytes
I´d still like it shorter; could save 3 bytes (""<) if B was guaranteed to not contain 0.
for($s=($a=$argv)[1];""<$c=$a[2][$i++];)if($p=strpos(_.$s,$c,$p+1))$s[$p-1]=$a[3][$k++];echo$k<$i-1?$a[1]:$s;

takes arguments from command line. Run with -r.
Replaces the characters when it finds them;
prints copy if all characters have been replaced; original else.

Perl, 80 + 1 = 81 bytes
Run with the -p flag
$a=join"(.*?)",split//,<>;$b.=$_." .\$".++$;."."for split//,<>;chop$b;s/$a/$b/ee

Try it online!
The code procedurally generates a search and replace regex command, which it then executes in the last bit of code.
The string ghost in the first example gets turned into the string g(.*?)h(.*?)o(.*?)s(.*?)t(.*?), which means a g followed by 0 or more characters, followed by an h followed by 0 or more characters, followed by etc.  The *? quantifier means that the search should be non-greedy and "gobble" as few characters as possible, instead of the default of matching as much as possible.
The string 12345 then gets turned into 1 .$1.2 .$2.3 .$3.4 .$4.5 .$5, which gets evaluated after the regex is performed.  Each of $1,$2,$3,$4,$5 is actually a backreference to a capture group (in parentheses) from the first string.

I suggest this code to save a few bytes : perl -pe 'eval"s/".<>=~s/.\K/(.*?)/gr."/".<>=~s/.\K/"\${".++$i."}"/gre."/"'. Came up with it by myself, but it's quite close to yours, so I won't post it, that would be two very close answers, but feel free to edit yours!

Just had a go at this because I saw it listed as a "related" question to a recent problem. Best I got was perl -E 'chomp(($f,$t,$s)=(<>));$f=join"(.*?)",split"",$f;@r=split"",$t;@t=shift@r;push@t,"\${",++$x,"}"for(@r);$t=join"",@t;say$s=~s/$f/$t/r;'

Clojure, 113 bytes
#(apply str((reduce(fn[[b c r]a](if(=(first b)a)[(rest b)(rest c)(conj r(first c))][b c(conj r a)]))[%2%3[]]%)2))

A basic reduce, not too happy about all those long first, rest and conj function calls. Hoping to see a better approach.

Perl 5, 100 bytes
sub{($x,$y,$z)=@_;$y[$n++]=$_ for(split//,$z);$o=$x;$/&=$x=~s/$_/$y[$m++]/ for(split//,$y);$"?$o:$x}

This probably can be made shorter, but it's bed time now.

PHP>=7.1, 102 Bytes Non Competing
for([,$t,$s,$r]=$argv;a&$c=$s[$i];$y.=$r[$i]."$".++$i)$x.="$c(.*?)";echo preg_replace("#$x#",$y,$t,1);

Online Version
replace [,$t,$s,$r] with list(,$t,$s,$r) to use it in former PHP versions +4 Bytes
Expanded
for([,$t,$s,$r]=$argv;a&$c=$s[$i];
$y.=$r[$i]."$".++$i) # make replacement in after loop
  $x.="$c(.*?)"; # make search regex
echo preg_replace("#$x#",$y,$t,1); # replace 1 Time and Output

Wasn't PHP 7.1 released in December 2016? If so, your answer should be "non competing" ;)

@Dada Done Yes it as released  in this time