text:
Decode Faux Braille
⢣⠃⢎⠆⣇⡇⡯⡂⠈⡏⢰⢵⢐⡭⢸⠪⡀⢸⢐⡭⠀⢹⠁⢎⠆⢸⣱⢸⡃⢎⠰⡱⢸⣱⢸⡃⠈⡏⢸⡃⡱⡁⢹⠁⢸⡀⡇⡗⢅⢸⡃⠈⡏⢸⢼⢸⢐⡭

⣇⢸⡃⢹⠁⢹⠁⣟⢸⢕⢐⡭⠀⡮⡆⡯⡂⣟⠀⡯⠰⡱⢸⣸⢸⢕⠀⣏⡆⢎⠆⢹⠁⣪⠅⢸⢼⢸⠰⣩⢸⢼⠀⡮⡆⡗⢼⢸⣱⠀⢎⠆⡯⠀⢇⠇⡮⡆⡯⡂⡇⡮⡆⣟⡆⣇⢸⡃⠸⡰⡸⢸⢸⣱⠈⡏⢸⢼

⢎⠆⡗⢼⢸⡃⢸⡃⡗⠔⡇⡯⠂⢹⠁⢣⠃⠸⡸⢸⡃⡯⡂⢹⠁⡇⢎⢰⢵⢸⡀⢸⡀⡇⡗⢼⢸⡃⢐⡭⢸⡃⡯⠂⡮⡆⡯⡂⡮⡆⢹⠁⣟⢐⡭⠀⢎⢸⢼⢰⢵⢸⢕⢰⢵⠰⡁⢹⠁⣟⢸⢕⢐⡭

⡮⡆⢐⡭⢸⠕⢰⢵⠰⡁⣟⠀⡇⣪⠅⢈⣝⢸⡃⡯⡂⢎⠆⠸⡰⡸⢸⢸⣱⠈⡏⢸⢼

⣪⠅⢎⠆⢸⠈⡏⠀⣇⠰⡱⠰⡱⢸⠪⡀⣪⠅⢸⡀⡇⡗⢅⢸⡃⠸⡰⡸⠰⡱⢸⢕⢸⣱⢐⡭⠀⡮⡆⡯⡂⣟⠀⣪⠅⣟⢸⠕⢰⢵⢸⢕⢰⢵⠈⡏⢸⡃⣏⡆⢸⣳⠘⡜⠀⢹⠁⢇⢆⠇⢎⠆⢸⡀⡇⡗⢼⢸⡃⣪⠅

⡇⡗⢼⢸⠕⢸⣸⠈⡏⠀⡇⣪⠅⢰⢵⠀⣪⠅⢹⠁⡯⡂⡇⡗⢼⠰⣩⠀⢎⠰⡱⢸⠢⡇⢹⠁⡮⡆⡇⡗⢼⢸⢸⠢⡇⢎⡅⢸⠅⡮⡆⣇⡇⡱⡁⢸⣳⢸⢕⢰⢵⢸⢸⡀⣇⢸⡃⠰⡱⢸⠅

⢎⠆⡗⢼⢸⡀⢣⠃⢸⡃⡗⢼⠰⣩⢸⡀⡇⣪⠅⡧⡇⢸⣸⢸⠕⢸⠕⢸⡃⡯⡂⢎⢰⢵⢐⡭⢸⡃⢸⡀⣟⠈⡏⠈⡏⢸⡃⡯⡂⣪⠅⢰⢵⢸⠢⡇⣏⡆⢐⡭⢸⠕⢰⢵⠰⡁⣟⢐⡭

⡮⡆⣟⡆⢎⢸⣱⢸⡃⡯⠰⣩⢸⢼⢸⢀⠇⡗⢅⢸⡀⡗⠔⡇⡗⢼⠰⡱⢸⠕⠰⣩⡆⡯⡂⣪⠅⢹⠁⣇⡇⢇⠇⢇⢆⠇⡱⡁⢣⠃⣩⡃

⢎⠆⣇⡇⢹⠁⡯⠂⣇⡇⢹⠁⢸⠢⢺⢰⢵⠘⡜⠀⣟⡆⣟⠀⣇⡇⡯⠂⡯⠂⣟⢸⢕⠀⢎⠆⡯⡂⢸⡀⢎⠆⢇⢆⠇⣟⢸⢕⠰⡁⡮⡆⣪⠅⣟

⣪⠅⡧⡇⢎⠆⡯⡂⢹⠁⣟⢐⡭⠈⡏⠀⢇⢆⠇⡇⡗⢼⢐⡭

⡗⢼⠰⡱⠀⣇⠰⡱⠰⡱⢸⠕⢸⢼⠰⡱⢸⡀⣟⢐⡭

ASCII version of the above
⡯⡂⣟⢸⡀⡮⡆⢹⠁⣟⢸⣱
About Braille characters
A Braille character packs a 4 by 2 rectangle of dots, which can be viewed as a Boolean matrix.
The concatenation of all such matrices is a 4 by 2*n boolean matrix, where n is the length of the input string.
You should look for vertical lines without any dots in them, and use those as separators to split the big matrix into smaller matrices for each character.
Then, look for patterns to convert them to letters of the English alphabet or spaces. Note that after removing the separators (vertical empty lines), a space is a 4 by 0 matrix.
Below is a description of the alphabet in ASCII:
A   | B   | C  | D   | E  | F  | G   | H   | I | J  | K    | L  | M     | N    | O   | P   | Q    | R   | S   | T   | U   | V   | W     | X   | Y   | Z
----+-----+----+-----+----+----+-----+-----+---+----+------+----+-------+------+-----+-----+------+-----+-----+-----+-----+-----+-------+-----+-----+----
.#. | ##. | .# | ##. | ## | ## | .## | #.# | # | .# | #.#. | #. | #...# | #..# | .#. | ##. | .##. | ##. | .## | ### | #.# | #.# | #...# | #.# | #.# | ###
#.# | ### | #. | #.# | ## | #. | #.. | #.# | # | .# | ##.. | #. | ##.## | ##.# | #.# | #.# | #..# | #.# | #.. | .#. | #.# | #.# | #.#.# | .#. | #.# | ..#
### | #.# | #. | #.# | #. | ## | #.# | ### | # | .# | #.#. | #. | #.#.# | #.## | #.# | ##. | #.## | ##. | .## | .#. | #.# | #.# | #.#.# | .#. | .#. | .#.
#.# | ### | .# | ### | ## | #. | .## | #.# | # | #. | #..# | ## | #...# | #..# | .#. | #.. | .### | #.# | ##. | .#. | ### | .#. | .#.#. | #.# | .#. | ###

Specification

The input is a sequence of Unicode code points in the range U+2800..U+28FF represented as the usual string type in your language (e.g. char array, char pointer) in any popular encoding supported (UTF-8, UCS-2, etc).
Trailing spaces in the output are fine.

EDIT: apologies to those whose browsers misrender the dots, it's supposed to look like this (image):

your task is to decode text like this / letters are four dots high and of variable width / one empty vertical line separates characters / a space is zero width / so it looks like words are separated by two lines / input is a string containing faux braille of / only english uppercase letters and spaces / abcdefghijklmnopqrstuvwxyz / output may be upper or lowercase / shortest wins / no loopholes / related

Braille patterns

Python 3, 181 179 171 167 161 159 bytes
Input by UTF-16 little-endian bytes without BOM. First decompose into columns using bit shifts, split by empty column, then hash them into a lookup table.
-2 bytes thanks to ngn.
-5 bytes thanks to Mr. Xcoder.
lambda h,j=''.join:j(' ZAQV;JWP;MBOS;YRKCGXDF;ILHUENT'[int('0'+i,27)%544%135%32]for i in j(chr(64|i&7|i>>3&8)+chr(64|i>>3&7|i>>4&8)for i in h[::2]).split('@'))

Try it online!

python won't complain if you remove the space between 39 and if; it's even shorter if you replace if-else with the and-or trick

175 bytes by replacing i and int(i,27)%15472%39or 0 with int(i or'0')%15472%39 --- Try it online!

And 174 bytes by assigning ''.join to a variable  --- Try it online!

JavaScript (ES6),  148 146 143  142 bytes
Saved 1 byte thanks to @ngn
s=>[...s].map(c=>g((k=c.charCodeAt()/8)&8|k*8&7)&g(k&7|k/2&8),o=x='',g=n=>x=n?x*27+n:!(o+=' DZQGYWXNHJ.CSTIO.AFB.LPVE..KUMR'[x%854%89%35]))&&o

Try it online!

g((k=c.charCodeAt())&7|k/8&8)&g(k/8&7|k/16&8) -> g((k=c.charCodeAt()/8)&8|k*8&7)&g(k&7|k/2&8)

@ngn Thanks :) Merged with another pending optimization.

May I ask, how did you come up with the brilliant x%854%89%35? Did you try many different random moduli?

@ngn I've tried m0 < 1000, m1 < m0, m2 < m1 (actually with some other optimizations, but that's the idea). And for the factor by which x is multiplied: [4,6,8,9,10,11,12] and [15...31]. Currently trying some other approaches.

Python 3, 305 302 301 286 251 198 182 bytes
def f(s,A=''):
 for c in s:l=bin(ord(c))[-8:];A+='7'+l[5:]+l[1]+'7'+l[2:5]+l[0]
 print(''.join('K.L.SXC PRU.NYEOGZVJIW..HFBTAQDM'[int('7'+c,22)%141%109%35]for c in A.split('70000')))

Try it online!

302 (-3 bytes)

@Mr.Xcoder Thanks :)


text:
Minimal sparse rulers
A standard ruler of length n has distance marks at positions 0, 1, ..., n (in whichever units). A sparse ruler has a subset of those marks. A ruler can measure the distance k if it has marks at positions p and q with p−q=k.
The challenge
Given a positive integer n, output the minimum number of marks required in a sparse ruler of length n so that it can measure all distances 1, 2, ..., n.
This is OEIS A046693.
As an example, for input 6 the output is 4. Namely, a ruler with marks at 0, 1, 4, 6 works, as 1−0=1, 6−4=2, 4−1=3, 4−0=4, 6−1=5, and 6−0=6.
Additional rules

The algorithm should be valid for arbitrarily large n. However, it is acceptable if the program is limited by memory, time or data type restrictions.
Input/output can be taken/produced by any reasonable means.
Programs or functions are allowed, in any programming language. Standard loopholes are forbidden.
Shortest code in bytes wins.

Test cases
1   ->   2
2   ->   3
3   ->   3
4   ->   4
5   ->   4
6   ->   4
7   ->   5
8   ->   5
9   ->   5
10  ->   6
11  ->   6
12  ->   6
13  ->   6
14  ->   7
15  ->   7
16  ->   7
17  ->   7
18  ->   8
19  ->   8
20  ->   8
21  ->   8
22  ->   8
23  ->   8
24  ->   9
25  ->   9
26  ->   9
27  ->   9
28  ->   9
29  ->   9
30  ->  10
31  ->  10
32  ->  10

Related

Jelly, 14 bytes
ŒcIQL
‘ŒPÇÐṀḢL

A monadic link taking and returning non-negative integers.
Try it online! (first 15 values here - not efficient)
How?
Finds all the rulers one could make using marks 1 through to n+1 (the power-set of [1,n+1]) ordered by their marking-count, and keeps only those which create maximal measurable distances (the length of the set of differences between all ordered pairs of marks), then returns the length of the first (i.e. [one of] the shortest one[s]).
ŒcIQL - Link 1: number of measurable distances: list of numbers, ruler  e.g. [1,2,3,7]
Œc    - all pairs                                [[1,2],[1,3],[1,7],[2,3],[2,7],[3,7]]
  I   - incremental differences                                          [1,2,6,1,5,4]
   Q  - de-duplicate                                                       [1,2,6,5,4]
    L - length                                                                      5

‘ŒPÇÐṀḢL - Main link: number, n              e.g. 4
‘        - increment                              5
 ŒP      - power-set (implicit range of input)   [[],[1],[2],[3],[4],[5],[1,2],[1,3],[1,4],[1,5],[2,3],[2,4],[2,5],[3,4],[3,5],[4,5],[1,2,3],[1,2,4],[1,2,5],[1,3,4],[1,3,5],[1,4,5],[2,3,4],[2,3,5],[2,4,5],[3,4,5],[1,2,3,4],[1,2,3,5],[1,2,4,5],[1,3,4,5],[2,3,4,5],[1,2,3,4,5]]
    ÐṀ   - keep those maximal under:
   Ç     -   call the last link (1) as a monad   [[1,2,3,5],[1,2,4,5],[1,3,4,5],[1,2,3,4,5]]
      Ḣ  - head                                  [1,2,3,5]
       L - length                                 4

Wolfram Language (Mathematica), 65 bytes
Tr[1^#]&@@Cases[Subsets[n=0~Range~#],k_/;Union@@Abs[k-#&/@k]==n]&

Try it online!

Python 2, 129 128 126 bytes
thanks to totallyhuman for -1 byte
from itertools import*
r=range(1,input()+2)
[{a-b+1for a in l for b in l}>set(r)>exit(i)for i in r for l in combinations(r,i)]

Try it online!
output is via exit code

Pyth, 14 bytes
lh.Ml{-M^Z2ySh

Try it here!
Pyth, 21 19 bytes
hlMf!-SQmaFd.cT2ySh

Try it here!
How it works
I'll update this after golfing.

hSlMfqSQS{maFd.cT2ySh ~ Full program. Q = input.

                   Sh ~ The integer range [1, Q + 1].
                  y   ~ Powerset.
    f                 ~ Filter (uses a variable T).
              .cT2    ~ All two-element combinations of T.
          m           ~ Map.
           aFd        ~ Reduce by absolute difference.
        S{            ~ Deduplicate, sort.
     qSQ              ~ Is equal to the integer range [1, Q]?
  lM                  ~ Map with length.
hS                    ~ Minimum.

Thanks to isaacg for saving a byte for my second approach and inspiring me to golf 3 bytes off my current approach!

Since the powerset is ordered by length, the first S is unnecessary.

@isaacg Thanks! Your great answer (+1) also inspired me to save 3 bytes off my new approach, making it 14 bytes.

Mathematica, 84 bytes
#&@@(l=Length)/@Select[(S=Subsets)@Range[0,d=#],l@Union[Differences/@S[#,{2}]]==d&]&

Try it online!

Jelly, 17 bytes
‘ŒPµạþ`FQḊṫ³µÐfḢL

Try it online!
Saved 1 byte thanks to Jonathan Allan!

The power-set is sorted from shortest to longest so I think ḢL should be OK..

Husk, 20 18 bytes
λ▼mLfȯ≡⁰u´×≠tṖ⁰)…0

Thanks @H.PWiz for -2 bytes!
Try it online!
Explanation
λ               )…0  -- lambda with argument ⁰ as [0..N]
              Ṗ⁰     -- all subsets of [0..N]
             t       -- tail (remove empty subset)
    f(      )        -- filter by following function:
           ≠         --   absolute differences
         ´×          --   of all pairs drawn from itself
        u            --   remove duplicates
      ≡⁰             --   "equal" to [0..N]
  mL                 -- map length
 ▼                   -- minimum

oa- is the same as ≠

@H.PWiz it really only matters that their lengths are the same, because there can't be any differences outside the [0..N] range.

You could probably even use ≈.

Jelly, 17 bytes
_þ`ẎQṢw
‘ŒPçÐfRḢL

Try it online!
Borrowed a trick from Mr. Xcoder's answer for -1.
-1 thanks to Jonathan Allan.

The power-set is sorted from shortest to longest so I think ḢL should be OK..

Pyth, 15 bytes
lhf!-SQ-M^T2yUh

Test suite
How it works
lhf!-SQ-M^T2yUh
             Uh    [0, 1, ... n]
            y      Powerset - all possible rulers
  f                Filer rulers on
         ^T2       All pairs of marks, in both orders
       -M          Differences - (a)
     SQ            [1, ... n], the desired list of differences - (b)
    -              Remove (a) from (b)
   !               Check that there's nothing left.
 h                 The first remaining ruler (powerset is ordered by size)
l                  Length

Ruby, 98 bytes
->n{(w=*0..n).find{|x|w.combination(x+1).find{|y|y.product(y).map{|a,b|(b-a).abs}.uniq.size>n}}+1}

Try it online!

source: Stack Exchange

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

sort: votes


text:
Normalize a Vector
To normalize a vector is to scale it to a length of 1 (a unit vector), whilst keeping the direction consistent.
For example, if we wanted to normalize a vector with 3 components, u, we would first find its length:

|u| = sqrt(ux2 + uy2 + uz2)

...and then scale each component by this value to get a length 1 vector.

û = u ÷ |u|

The Challenge
Your task is to write a program or function which, given a non-empty list of signed integers, interprets it as a vector, and normalizes it. This should work for any number of dimensions, for example (test cases rounded to two decimal places):
[20]           -> [1]
[-5]           -> [-1]
[-3, 0]        -> [-1, 0]
[5.5, 6, -3.5] -> [0.62, 0.68, -0.40]
[3, 4, -5, -6] -> [0.32, 0.43, -0.54, -0.65]
[0, 0, 5, 0]   -> [0, 0, 1, 0]

Rules:

You can assume the input list will:

Have at least one non-zero element
Only contain numbers within your language's standard floating point range

Your output should be accurate to at least two decimal places. Returning "infinite precision" fractions / symbolic values is also allowed, if this is how your language internally stores the data.
Submissions should be either a full program which performs I/O, or a function. Function submissions can either return a new list, or modify the given list in place.
Builtin vector functions/classes are allowed. Additionally, if your language has a vector type which supports an arbitrary number of dimensions, you can take one of these as input.

This is a code-golf contest, so you should aim to achieve the shortest solution possible (in bytes).

Does it have to have at least two decimal places for every possible input (which is not possible for any standard type of floating point values) or only for the examples you provide? E.g. Steadybox's answer provides 2 decimal places of precision for all your test but he uses ints for the sum of squares which of course fails for almost all inputs (e.g. [0.1, 0.1]).

... now we just wait for a lang with built-in norm function mapped to one char...

It should be to at least 2dp for every possible input @Christoph

@FlipTack but that rules out basically all languages because floatings points have bigger exponents than mantissa which means they do not always have enough precision to have any decimal places.

Why don't the 6 in the 4th example and the -6 in the 5th respectively normalize to 1 and -1?

@Mast because the vector length, not largest component , needs to be scaled to 1.

05AB1E, 4 bytes
Code:
nOt/

Try it online!
Explanation
n     # Square each element of the input
 O    # Sum all elements
  t   # Take the square root of the sum
   /  # Divide each element by the square root of the sum

n0t what I expected /

JavaScript (ES6), 31 bytes
a=>a.map(n=>n/Math.hypot(...a))

Test cases

let f =

a=>a.map(n=>n/Math.hypot(...a))

console.log(JSON.stringify(f([20]          ))) // -> [1]
console.log(JSON.stringify(f([-5]          ))) // -> [-1]
console.log(JSON.stringify(f([-3, 0]       ))) // -> [-1, 0]
console.log(JSON.stringify(f([5.5, 6, -3.5]))) // -> [0.62, 0.68, -0.40]
console.log(JSON.stringify(f([3, 4, -5, -6]))) // -> [0.32, 0.43, -0.54, -0.65]
console.log(JSON.stringify(f([0, 0, 5, 0]  ))) // -> [0, 0, 1, 0]

Mathematica, 9 bytes
Normalize

Try it online!

Or #/Norm@#& for the same byte count.

J, 8 bytes
%+/&.:*:

Try it online!
6 bytes %|@j./ works if the vector is at least 2-dimensional.

Love the way of getting the magnitude.

@cole 1 byte longer: %1%:@#.*:

Could you please add an explanation for the uninitiated in J?

% (divide by) +/ (sum) &.: (under) *: (square). + sums two things. +/ sums a list of things. &.: modifies the preceding operation by applying the following operation first and its inverse afterwards. % normally takes two arguments, but (% f) is a function from x to x % (f x). Most operators automagically work on lists.

And by the same principles, the function that “normalizes” a vector by adding such a number to each component that they sum to zero is “- +/ % #”.

Jelly, 5 3 bytes
÷ÆḊ

Try it online!, or see the test suite
Saved 2 bytes thanks to miles!

3 bytes with ÷ÆḊ

@miles Huh, never knew about that builtin. Thanks

unfortunately that built-in gives +ve mod for scalars per TIO examplelike absolute value .. the problem requested keeping the sign

Octave, 13 bytes
@(x)x/norm(x)

Try it online!

C,  73  70 bytes
Thanks to @Christoph for saving a byte!
s,i;f(v,n)float*v;{for(s=0;i++<n;)s+=*v**v++;for(;--i;)*--v/=sqrt(s);}

Try it online!

+1. s=0,i=0 instead of s=i=0 saves one

I love the use of s[-i]but sadly *--v/=sqrt(s); is 1 byte shorter.

@xanoetux Thanks, but I need to initialize the variables inside the function, because functions need to be reusable. Besides, as global variables, s and i are automatically initialized to 0. (Turns out I don't need to initialize i in the function, because the function always leaves it at value 0)

@Christoph Thanks! I was initially printing the values from the function, so I needed v[-i] to get the values in correct order.

Python, 47 46 bytes
lambda v:[e/sum(e*e for e in v)**.5for e in v]

Try it online!

Julia, 9 bytes
normalize

Try it online!

CJam, 9 bytes
{_:mhzf/}

Try it online!
Explanation
_    e# Duplicate input.
:mh  e# Fold hypothenuse-length over the vector. This gives the norm, unless the vector
     e# has only one component, in which case it just gives that component.
z    e# Abs. For the case of a single negative vector component.
f/   e# Divide each vector component by the norm.

TI-Basic, 6 bytes
Ans/√(sum(Ans2
Run with {1,2,3}:prgmNAME, where {1,2,3} is the vector to be normalized.
Divides each element in the vector by the square root of the sum of the squares of its elements.

We got the same answer!

@kamoroso94 Whoops! Didn't see yours when I posted this. If you want to add the explanation from this to your answer I'll delete this.

Nah I'll just remove mine.  You put more effort into your answer :P

R, 23 bytes
function(v)v/(v%*%v)^.5

Try it online!
v%*%v computes the dot product of v with itself.
The function will issue a warning for length 2 or greater vectors.

Java (OpenJDK 8), 57 bytes
v->v.stream().map(x->x/v.stream().reduce(0d,Math::hypot))

Try it online!

APL (Dyalog), 13 12 10 bytes
1 byte saved thanks to @Adám
2 bytes saved thanks to @ngn
⊢÷.5*⍨+.×⍨

Try it online!
How?
⊢  ÷  .5*⍨  +.  ×⍨
u  ÷    √   Σ   u²

Train for less: ⊢÷.5*⍨(+/×⍨)

@Adám thanks alot! I've been trying for hours, couldn't get any train to work

We should do something about that, as it is really not so hard. When you have a monadic function (other than the rightmost one), begin a parenthesis to its left (or use a ∘ if it isn't derived). Other than that, just swap ⍺ and ⍵ for ⊣ and ⊢: {⍵÷.5*⍨+/×⍨⍵} → {⍵÷.5*⍨(+/(×⍨⍵))} → ⊢÷.5*⍨(+/(×⍨⊢)) → ⊢÷.5*⍨(+/(×⍨)) → ⊢÷.5*⍨(+/×⍨)

(+/×⍨) -> +.×⍨

MATL, 5 bytes
t2&|/

Try it online!
I'm not entirely sure this is the shortest way to do this. First, we duplicate the input, then select the second output type of | (which is either abs, norm or determinant). Finally, we divide the input by the norm.
Alternative for 7 bytes:
t2^sX^/

Haskell, 29 bytes
f x=map(/sqrt(sum$(^2)<$>x))x

Try it online!
Or for 1 byte more pointfree: map=<<flip(/).sqrt.sum.map(^2)

Funky, 42 bytes
a=>(d=a::map)(c=>c/d(b=>b^2)::reduce@+^.5)

Try it online!

C++ (gcc), 70 bytes
Input by std::valarray<float>. Overwrites the original vector.
#import<valarray>
int f(std::valarray<float>&a){a/=sqrt((a*a).sum());}

Try it online!

I am just lurking codegolf every now and then, but isn't this invalid C++, given "#import", which is a Microsoft specific extension?

@phresnel #import works at least with GCC, Clang and MinGW, too. But, yeah, it's not standard C++.

@phresnel I forgot to specify gcc. Fixed.

Ohm v2, 5 bytes
D²Σ¬/

Try it online!

Common Lisp, 69 bytes
(lambda(v)(mapcar(lambda(x)(/ x(sqrt(loop as y in v sum(* y y)))))v))

Try it online!

Vyxal, 4 bytes
²∑√/

Try it Online!
²    # Square each
 ∑   # Sum
  √  # Square root
   / # Divide by that

Husk, 8 7 bytes
´(Ṁ/√ṁ□

Try it online!

Ruby, 39 35 bytes
->v{v.map{|x|x/v.sum{|x|x*x}**0.5}}

-4 bytes thanks to G B.

Save some bytes by using sum{...} instead of map{...}.sum

C# (.NET Core), 51+64=115 bytes
v=>v.Select(d=>d/Math.Sqrt(v.Select(x=>x*x).Sum()))

Try it online!
+64 bytes for the using System;using System.Collections.Generic;using System.Linq;
C# (.NET Core), 94+13=107 bytes
v=>{var m=0d;foreach(var x in v)m+=x*x;for(int i=0;i<v.Length;)v[i++]/=Math.Sqrt(m);return v;}

Try it online!
+13 bytes for using System;
The non-Linq approach
DeGolfed
v=>{
    var m=0d;
    foreach (var x in v)
        m+=x*x;

    for (int i=0; i < v.Length;)
        v[i++] /= Math.Sqrt(m);

    return v;
}

Perl 5, 45 + 1 (-a) = 46 bytes
say$_/sqrt eval join'+',map"($_)**2",@F for@F

Try it online!

Pip, 10 bytes
9 bytes of code, +1 for -p flag.
g/RT$+g*g

Takes the vector as separate command-line arguments. Try it online!
How it works
      g*g  Arglist, multiplied by itself itemwise
    $+     Sum
  RT       Square root
g/         Divide arglist itemwise by that scalar
           Result is autoprinted (-p flag to format as list)

Pyth, 5 bytes
cR.aQ

Try it online: Test Suite
Explanation:
cR.aQQ   implicit Q at the end
c        divide
 R   Q   each element of the input
  .aQ    by the L2 norm of the input vector

Perl 6, 25 bytes
{$_ »/»sqrt sum $_»²}

Try it online!
$_, the list argument to the function, is divided elementwise (»/») by the square root of the sum of the squares of the elements (»²).

Coconut, 40 bytes
x->map((/)$(?,sum(map(t->t*t,x))**.5),x)

I have no idea what I'm doing...
Try it online!

Thunno D, \$ 5 \log_{256}(96) \approx \$ 4.12 bytes
2^St/

Attempt This Online!
Explanation
2^St/  # D flag duplicates the input
2^     # Square each
  S    # Sum this list
   t   # Push the square root
    /  # Divide the input by this number

Pyt, 5 bytes
Đ²Ʃ√/

Try it online!
Explanation
Đ²Ʃ√/     implicit input
Đ²        duplicate and square
  Ʃ       sum
   √      square root
    /     divide

APL NARS 12 Characters
f←{⍵÷√+/⍵*2}

You don't have to count f←  in your byte count, since you can use the dfns without it. By the way, is √ a single byte in NARS? I'm not familiar with it, so just asking

@Uriel Nars Apl in the few I know would write with Unicode so number of bytes should be 12x2

Add++, 38 bytes
L?!*,EL2@xa@pBcB`s0.5^VcALG$xVcGa@BcB/

Try it online!

Google Sheets, 65 bytes
=ArrayFormula(TextJoin(",",1,If(A:A="","",A:A/Sqrt(Sumsq(A:A)))))

The input list is in column A with one entry per cell. This is how spreadsheets would normally use lists. Unfortunately, this would normally result in a long list of ,0,0,0,0,0,.... at the end so we have to ignore those with the If Blank then Blank else Math logic.
If it was all in one cell, instead, the solution would be 95 bytes:
=ArrayFormula(TextJoin(",",1,If(Split(A1,",")="","",Split(A1,",")/Sqrt(Sumsq(Split(A1,","))))))

Japt, 6 bytes
®/Ux²q

Try it here

Explanation
Map over the input array (®), divide (/) the current element by the square root (q) of the sum (x) of the elements in the input (U) squared (²).

Swift 4, 44 bytes
{a in a.map{$0/sqrt(a.reduce(0){$0+$1*$1})}}

Recalculates the vector norm for every component, but at least it's terse!

Clojure, 47 bytes
#(for[i %](/ i(Math/sqrt(apply +(map * % %)))))

This version calculates the norm only once and should look a bit more obscure for non-clojurists (% is the input argument):
#(map / %(repeat(Math/sqrt(apply +(map * % %)))))

Excel VBA, 25 Bytes
Anonymous VBE immediate window function that takes a number vector input from range [1:1] and outputs the normalized vector to the same range
[1:1]=[1:1/SumSQ(1:1)^.5]

all_licenses: 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/


text:
What do I need to destroy the world?
The gravitational binding energy of a planet is the amount of energy required to separate every tiny piece of it so that no piece will orbit or collide with another piece. For a uniform sphere, Wikipedia gives this formula:
$$E = \frac{3GM^2}{5R}$$
Where G is the gravitational constant (6.672e-11 m3•kg-1•s-2), M is mass, and R is the radius.
I could make this challenge about merely calculating this in Joules (kg•m2•s-2), but… that would be boring. And besides, not everyone understands Joules.
So instead, let's convert it into the following units:

Kilotons of TNT (4.184 trillion Joules, shorthand kilotons)
Hiroshima nuclear weapons (62.76 trillion Joules, shorthand nukes)
Hostess™ Twinkies (560,000 Joules, shorthand twinkies)
Kilowatt-hours (exactly 3.6 million Joules, shorthand kWh)
Kilograms of mass-energy (1 kg mass-energy = 299,792,4582 Joules, shorthand kg)

So, take in the following input:

mass in kilograms
radius in meters
one of six distinct inputs representing the unit to use

And output the binding energy in the specified units. Append the shorthand unit to the end of the output.
Rules

The shorthand for Joules is J.
Arbitrary whitespace is allowed, as long as it doesn't split the shorthand unit or the number.
Scientific notation is allowed, in whatever format your language uses.
You only need 4 significant figures. Floating points are highly recommended.
Blah blah shortest answer in bytes.

Test Cases
Generated with this spreadsheet.
Mass (kg)   Radius (m)  J           kilotons    nukes       twinkies    kWh         kg
3.302E+23   2440000     1.789E+30   4.275E+17   2.850E+16   3.194E+24   4.969E+23   1.990E+13
4.869E+24   6052000     1.568E+32   3.748E+19   2.499E+18   2.800E+26   4.356E+25   1.745E+15
5.974E+24   6371000     2.242E+32   5.360E+19   3.573E+18   4.004E+26   6.229E+25   2.495E+15
6.419E+23   3390000     4.866E+30   1.163E+18   7.753E+16   8.689E+24   1.352E+24   5.414E+13
1.899E+27   69911000    2.065E+36   4.935E+23   3.290E+22   3.687E+30   5.736E+29   2.298E+19
5.685E+26   58232000    2.222E+35   5.310E+22   3.540E+21   3.968E+29   6.172E+28   2.472E+18
8.683E+25   25360000    1.190E+34   2.845E+21   1.896E+20   2.125E+28   3.306E+27   1.324E+17
1.024E+26   24620000    1.705E+34   4.075E+21   2.717E+20   3.045E+28   4.736E+27   1.897E+17
1.311E+22   1186000     5.801E+27   1.387E+15   9.244E+13   1.036E+22   1.611E+21   6.455E+10
1.989E+30   696300000   2.274E+41   5.436E+28   3.624E+27   4.062E+35   6.318E+34   2.531E+24
7.350E+22   1737000     1.245E+29   2.976E+16   1.984E+15   2.223E+23   3.458E+22   1.385E+12

Inspired by Powering the Death Star with Twinkies by Scott Manley.

what do you mean by "default to joules"? does that mean that the output unit will not always be given in the input?

also, I love how there's actually a name for the amount of energy needed to completely annihilate a thing :P

can we take the output unit as any of 6 distinct inputs? otherwise it's a cumbersome I/O format and those are discouraged

@HyperNeutrino sure, but you still need the shorthand in the output.

@StephenLeppik "one of six distinct inputs representing the unit to use" - can those distinct inputs be 4.184, 62.76, etc?

@ngn Sure, but you still need the shorthand.

05AB1E, 56 54 bytes
Takes input as unit, radius, mass
6n56•G*•x619+•Oć•4°z)•1¡‡•S°*"Wwigu"I1èkè*2498T>°P/*¹J

Try it online!
Saved 2 bytes thanks to Erik the outgolfer (base 255 encode 4184 and 6276).

JavaScript (ES6), 78 bytes
Takes input as 3 distinct variables (mass, radius, unit).
(m,r,u)=>m*m/r/[8987e9,56,6276e6,,4184e5,1e-4,360][parseInt(u,30)%7]/2498e11+u

Test cases
The following snippet runs all test cases in the provided spreadsheet.

let f=

(m,r,u)=>m*m/r/[8987e9,56,6276e6,,4184e5,1e-4,360][parseInt(u,30)%7]/2498e11+u

console.log(
  [
    '3.302e+23 2440000   1.789e+30 4.275e+17 2.850e+16 3.194e+24 4.969e+23 1.990e+13',
    '4.869e+24 6052000   1.568e+32 3.748e+19 2.499e+18 2.800e+26 4.356e+25 1.745e+15',
    '5.974e+24 6371000   2.242e+32 5.360e+19 3.573e+18 4.004e+26 6.229e+25 2.495e+15',
    '6.419e+23 3390000   4.866e+30 1.163e+18 7.753e+16 8.689e+24 1.352e+24 5.414e+13',
    '1.899e+27 69911000  2.065e+36 4.935e+23 3.290e+22 3.687e+30 5.736e+29 2.298e+19',
    '5.685e+26 58232000  2.222e+35 5.310e+22 3.540e+21 3.968e+29 6.172e+28 2.472e+18',
    '8.683e+25 25360000  1.190e+34 2.845e+21 1.896e+20 2.125e+28 3.306e+27 1.324e+17',
    '1.024e+26 24620000  1.705e+34 4.075e+21 2.717e+20 3.045e+28 4.736e+27 1.897e+17',
    '1.311e+22 1186000   5.801e+27 1.387e+15 9.244e+13 1.036e+22 1.611e+21 6.455e+10',
    '1.989e+30 696300000 2.274e+41 5.436e+28 3.624e+27 4.062e+35 6.318e+34 2.531e+24',
    '7.350e+22 1737000   1.245e+29 2.976e+16 1.984e+15 2.223e+23 3.458e+22 1.385e+12'
  ]
  .map((l, n) => {
    [m, r, ...res] = l.match(/\S+/g).map(Number);

    return 'Test case #' + -~n + ' -> ' + (
      ['J', 'kilotons', 'nukes', 'twinkies', 'kWh', 'kg']
      .every((u, i) => +(+f(m, r, u).split(u).join``).toExponential(3) === +res[i])
      ? 'OK' : 'FAIL'
    )
  })
)

How?
This is quite similar to @ColeraSu's C answer, with a JS-friendly hash function that works on the whole unit string.
Unit       | Parsed as (*) | Base-30 -> Dec. | mod 7
-----------+---------------+-----------------+------
"J"        | "j"           | 19              | 5        (*):
"kilotons" | "kilotons"    | 451052545318    | 4          Because we're parsing as Base-30,
"nukes"    | "n"           | 23              | 2          characters [u-z] (and anything
"twinkies" | "t"           | 29              | 1          after them) are simply ignored.
"kWh"      | "k"           | 20              | 6
"kg"       | "kg"          | 616             | 0

Jelly, 78 bytes
²×⁽LÐ÷ȷ14÷⁴÷5÷⁵ị“¤Fðẏẏż“?A⁺ẏẏż“¬ŀż“8Ƙż“¡uþ³⁾ẉṿÆ“¡’¤;⁵ị“ÞṠlT“¡ṁæ-“;ØḲ“ȧ¹“ṫD“}»¤

Try it online!
Stuff to do with strings isn't really Jelly's type of challenge...
-7 bytes thanks to user202729 (thanks for helping me not get beaten by JavaScript :D)

Yeah, now you're tied with JS and still not on top either.

@StephenLeppik At least I'm not getting beaten :D and shush 05AB1E is inherently better at string challenges :P

C, 113 bytes
Hash the second character, using the trailing '\0' of "J". Inline array in C is used.
Note we need to multiply the second M last, or it will overflow to inf.
f(m,r,c)float m,r;char*c;{printf("%e%s",m/r/(float[]){1e-4,360,6276e6,8987e9,56,4184e5}[c[1]%36%7]/2498e11*m,c);}

Try it online!

+1. Not sure if possible, but f(m,r,char*c)float m,r{…} would save some bytes. Also, the semicolon after printf is optional

@xanoetux Which compiler do you use? Both don't work on my machine though.

I'm using GCC. Untested, but I'm quite sure about the last semicolon. (will test later)

APL (Dyalog Unicode), 153 71 69 bytes
op←{⍺,⍨40032E¯15÷÷/8987E13 36E5 6276E10 56E4 4184E9 1['gWuw '⍳⊃1↓⍺]⍵⍺⍺⍵}

Try it online!
Thanks to @Adám for absolutely crushing my old answer into this one.
Thanks to @ngn for 2 bytes.
This 'function' is actually an operator called op.
All the values for the measurement units were transformed to scientific notation.
How it works:
{⍺,⍨40032E¯15÷÷/8987E13 36E5 6276E10 56E4 4184E9 1['gWuw '⍳⊃1↓⍺]⍵⍺⍺⍵}
                                                             1↓⍺         ⍝ take the measurement unit without the first letter (because it is ambiguous)
                                                            ⊃            ⍝ picks the first element returned by
                                                           ⍳             ⍝ Dyadic ⍳ota, which finds the index of
                                                  'gWuw '                ⍝ each of these characters
                                                 [             ]         ⍝ square brackets indicate the index
               8987E13 36E5 6276E10 56E4 4184E9 1                        ⍝ of the element of this vector (1-indexed) which will be used as the divisor for
            ÷/                                                  ⍵⍺⍺⍵     ⍝ dividing by the left operand (⍺⍺) and the right argument squared.
    40032E¯15÷                                                           ⍝ then divide this number by the result
 ⍺,⍨                                                                     ⍝ and append the measurement unit

Python 3, 112 106 108 101 Bytes
lambda m,r,u:str(40032e-19*m*m/r/{'':1e-4,'i':4184e5,'u':6276e6,'w':56,'W':360,'g':8987e9}[u[1:2]])+u

Pretty straight forward. Uses Python's e notation. Uses a dict that distinguishes unit based on the second letter and divides by the corrosponding value. u[1:2] is basically u[1], expect it returns '' instead of an error (which I only learned now). Then applies the formula with a few simplifications.
edit: down to 106 thanks to totallyhuman, back to 108 because of new nukes value and down to 101 thanks to Colera Su.
Try it online!

Excel (Office 365), 106 101 97 bytes
Assuming cell A1 is the mass, A2 is the radius, and B1 is the unit, written as the shorthand for the output.
=40032E-19*A1^2/(A2*SWITCH(MID(B1,2,1),"u",6276E6,"w",56,"W",360,"g",89876E8,"i",4184E5,1E-4))&B1

Excel, 130 bytes
Old-fashioned Excel doesn't have the SWITCH function, so you have
=40032E-15*A1^2/(A2*IF(B1="J",1,IF(B1="nukes",6276E10,IF(B1="twinkies",56E4,IF(B1="kWh",36E5,IF(B1="kg",299792E3^2,4184E9))))))&B1

You can save 2 bytes by substituting 299792E3^2 with 89876E12  (Still accurate enough for question requirements.)
Divide all values by 1000 saves another 2:
=40032E-19*A1^2/(A2*SWITCH(MID(B1,2,1),"u",6276E6,"w",56,"W",360,"g",89876E8,"i",4184E5,1E-4))&B1

Hey, just want to throw it out there that the Switch() function is available to desktop copies of Excel, and was introduced with Office 2016.

Ruby , 83 82 bytes
->m,r,u{"#{40032E-18*m*m/r/[36E2,56,8987E9,1E-3,4184E6,6276E7][u.sum*3%71%6]} "+u}

Uses a custom hash to index a LUT for the units (i * k mod m formula). The numbers were found using brute-force.

Excel, 94 bytes
Takes Mass from A1, Radius from B1, Unit in C1.
Look up on 2*Code(Unit) + Length(Unit) modulo 11.
=4.0032E-15*A1^2/B1/CHOOSE(MOD(2*CODE(C1)+LEN(C1),11),,4184E5,,,6276E6,1E-4,89876E8,360,56)

Jelly,  59  54 bytes
Saved 5 bytes thanks to @ChartZBelatedly
I just wanted to try another weird method to convert the units. But the rest of the code is probably badly golfed.
⁵OẒḄ%9ị56,4184ȷ5,8987ȷ9,360,0,6276ȷ6,ȷ-4
²÷÷2498ȷ11÷¢⁵

Try it online!
How?
We build a 'signature' of a unit string out of the primality of its ASCII codes. We interpret it as a binary value and apply a modulo to get the final index in the lookup table.
⁵OẒḄ%9ị[...]    - helper link to convert the unit to a hardcoded constant
⁵               - the 3rd input        e.g. "kilotons"
 O              - to ASCII codes       --> [107, 105, 108, 111, 116, 111, 110, 115]
  Ẓ             - is prime?            --> [1, 0, 0, 0, 0, 0, 0, 0]
   Ḅ            - binary -> decimal    --> 128
    %9          - modulo 9             --> 2
      ị[...]    - get value from table --> 418400000

²÷÷2498ȷ11÷¢⁵   - main link taking the mass, the radius and the unit
²               - square the mass
 ÷              - divide by the radius
  ÷2498ȷ11      - divide by 2498e11
          ÷¢    - divide by the unit constant, invoking the helper link as a nilad
            ⁵   - append the unit

The helper link gives the following indices for each unit:
unit     | ASCII codes                     | is prime?       | bin -> dec | mod 9
---------+---------------------------------+-----------------+------------+------
J        | 74                              | 0               |      0     |   0
kilotons | 107,105,108,111,116,111,110,115 | 1,0,0,0,0,0,0,0 |    128     |   2
nukes    | 110,117,107,101,115             | 0,0,1,1,0       |      6     |   6
twinkies | 116,119,105,110,107,105,101,115 | 0,0,0,0,1,0,1,0 |     10     |   1
kWh      | 107,87,104                      | 1,0,0           |      4     |   4
kg       | 107,103                         | 1,1             |      3     |   3

The [ and ] are unnecessary. Additionally, the ⁴ can be removed and the ÆP has a 1 byte alias: Ẓ. Finally, if the number on the left of ȷ is 1, it can be omitted. -5 bytes

@ChartZBelatedly Thank you!

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


text:
Eigenvalues of a Matrix
Given a square matrix, output the matrix's eigenvalues. Each eigenvalue should be repeated a number of times equal to its algebraic multiplicity.
The eigenvalues of a matrix A are scalar values λ such that, for some column vector v, A*v = λ*v. They are also the solutions to the characteristic polynomial of A: det(A - λ*I) = 0 (where I is the identity matrix with the same dimensions as A).
Outputs must be accurate to 3 significant digits. All inputs and outputs will be within the representable range of numerical values for your chosen language.
Builtins are acceptable, but you are encouraged to include solutions that do not use builtins.
Test Cases
In these test cases, I represents the imaginary unit. Complex numbers are written in the form a + b*I. All outputs have 3 significant digits of precision.
[[42.0]] -> [42.0]
[[1.0, 0.0], [0.0, 1.0]] -> [1.00, 1.00]
[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]] -> [16.1, -1.12, -1.24e-15]
[[1.2, 3.4, 5.6, 7.8], [6.3, 0.9, -5.4, -2.3], [-12.0, -9.7, 7.3, 5.9], [-2.5, 7.9, 5.3, 4.4]] -> [7.20 + 5.54*I, 7.20 - 5.54*I, -4.35, 3.75]
[[-3.22 - 9.07*I, 0.193 + 9.11*I, 5.59 + 1.33*I, -3.0 - 6.51*I, -3.73 - 6.42*I], [8.49 - 3.46*I, -1.12 + 6.39*I, -8.25 - 0.455*I, 9.37 - 6.43*I, -6.82 + 8.34*I], [-5.26 + 8.07*I, -6.68 + 3.72*I, -3.21 - 5.63*I, 9.31 + 3.86*I, 4.11 - 8.82*I], [-1.24 + 9.04*I, 8.87 - 0.0352*I, 8.35 + 4.5*I, -9.62 - 2.21*I, 1.76 - 5.72*I], [7.0 - 4.79*I, 9.3 - 2.31*I, -2.41 - 7.3*I, -7.77 - 6.85*I, -9.32 + 2.71*I]] -> [5.18 + 16.7*I, -24.9 - 2.01*I, -5.59 - 13.8*I, 0.0438 - 10.6*I, -1.26 + 1.82*I]
[[-30.6 - 73.3*I, 1.03 - 15.6*I, -83.4 + 72.5*I, 24.1 + 69.6*I, 52.3 + 2.68*I, 23.8 + 98.0*I, 96.8 + 49.7*I, -26.2 - 5.87*I, -52.4 + 98.2*I, 78.1 + 6.69*I], [-59.7 - 66.9*I, -26.3 + 65.0*I, 5.71 + 4.75*I, 91.9 + 82.5*I, -94.6 + 51.8*I, 61.7 + 82.3*I, 54.8 - 27.8*I, 45.7 + 59.2*I, -28.3 + 78.1*I, -59.9 - 54.5*I], [-36.0 + 22.9*I, -51.7 + 10.8*I, -46.6 - 88.0*I, -52.8 - 32.0*I, -75.7 - 23.4*I, 96.2 - 71.2*I, -15.3 - 32.7*I, 26.9 + 6.31*I, -59.2 + 25.8*I, -0.836 - 98.3*I], [-65.2 - 90.6*I, 65.6 - 24.1*I, 72.5 + 33.9*I, 1.47 - 93.8*I, -0.143 + 39.0*I, -3.71 - 30.1*I, 60.1 - 42.4*I, 55.6 + 5.65*I, 48.2 - 53.0*I, -3.9 - 33.0*I], [7.04 + 0.0326*I, -12.8 - 50.4*I, 70.1 - 30.3*I, 42.7 - 76.3*I, -3.24 - 64.1*I, 97.3 + 66.8*I, -11.0 + 16.5*I, -40.6 - 90.7*I, 71.5 - 26.2*I, 83.1 - 49.4*I], [-59.5 + 8.08*I, 74.6 + 29.1*I, -65.8 + 26.3*I, -76.7 - 83.2*I, 26.2 + 99.0*I, -54.8 + 33.3*I, 2.79 - 16.6*I, -85.2 - 3.64*I, 98.4 - 12.4*I, -27.6 - 62.3*I], [82.6 - 95.3*I, 55.8 - 73.6*I, -49.9 + 42.1*I, 53.4 + 16.5*I, 80.2 - 43.6*I, -43.3 - 3.9*I, -2.26 - 58.3*I, -19.9 + 98.1*I, 47.2 + 62.4*I, -63.3 - 54.0*I], [-88.7 + 57.7*I, 55.6 + 70.9*I, 84.1 - 52.8*I, 71.3 - 29.8*I, -3.74 - 19.6*I, 29.7 + 1.18*I, -70.6 - 10.5*I, 37.6 + 99.9*I, 87.0 + 19.0*I, -26.1 - 82.0*I], [69.5 - 47.1*I, 11.3 - 59.0*I, -84.3 - 35.1*I, -3.61 - 35.7*I, 88.0 + 88.1*I, -47.5 + 0.956*I, 14.1 + 89.8*I, 51.3 + 0.14*I, -78.5 - 66.5*I, 2.12 - 53.2*I], [0.599 - 71.2*I, 21.7 + 10.8*I, 19.9 - 97.1*I, 20.5 + 37.4*I, 24.7 + 40.6*I, -82.7 - 29.1*I, 77.9 + 12.5*I, 94.1 - 87.4*I, 78.6 - 89.6*I, 82.6 - 69.6*I]] -> [262. - 180.*I, 179. + 117.*I, 10.3 + 214.*I, 102. - 145.*I, -36.5 + 97.7*I, -82.2 + 89.8*I, -241. - 104.*I, -119. - 26.0*I, -140. - 218.*I, -56.0 - 160.*I]

Sandbox

Related. Related.

Related? Probably related? (depends on the approach)

Haskell, 576 554 532 507 bytes
No built-ins!
import Data.Complex
s=sum
l=length
m=magnitude
i=fromIntegral
(&)=zip
t=zipWith
(x!a)b=x*a+b
a#b=[[s$t(*)x y|y<-foldr(t(:))([]<$b)b]|x<-a]
f a|let c=[1..l a];g(u,d)k|m<-[t(+)a b|(a,b)<-a#u&[[s[d|x==y]|y<-c]|x<-c]]=(m,-s[s[b|(n,b)<-c&a,n==m]|(a,m)<-a#m&c]/i k)=snd<$>scanl g(0<$c<$c,1)c
p?x|let f=foldl1(x!);c=l p-1;n=i c;q p=init$t(*)p$i<$>[c,c-1..];o=f(q p)/f p;a|d<-sqrt$(n-1)*(n*(o^2-f(q$q p)/f p)-o^2)=n/last(o-d:[o+d|m(o-d)<m(o+d)])=last$p?(x-a):[x|m a<1e-9]
z[a,b]=[-b/a]
z p=p?0:z(init$scanl1(p?0!)p)

Try it online!
Many thanks @ØrjanJohansen for a total of -47 bytes!
Explanation
First this computes the characteristic polynomial with the Faddeev–LeVerrier algorithm which is the function f. Then the function z computes all roots of that polynomial by iterating g which implements Laguerre's Method for finding a root, once a root is found it is removed and g gets called again until the polynomial has degree 1 which is trivially solved by z[a,b]=[-b/a].
Ungolfed
I re-inlined the functions sum,length,magnitude, fromIntegral, zipWith and (&) as well as the little helper (!). The function faddeevLeVerrier corresponds to f, roots to z and g to laguerre respectively.
-- Transpose a matrix/list
transpose a = foldr (zipWith(:)) (replicate (length a) []) a

-- Straight forward implementation for matrix-matrix multiplication
(#) :: [[Complex Double]] -> [[Complex Double]] -> [[Complex Double]]
a # b = [[sum $ zipWith (*) x y | y <- transpose b]|x<-a]

-- Faddeev-LeVerrier algorithm
faddeevLeVerrier :: [[Complex Double]] -> [Complex Double]
faddeevLeVerrier a = snd <$> scanl go (zero,1) [1..n]
  where n = length a
        zero = replicate n (replicate n 0)
        trace m = sum [sum [b|(n,b)<-zip [1..n] a,n==m]|(m,a)<-zip [1..n] m]
        diag d = [[sum[d|x==y]|y<-[1..n]]|x<-[1..n]]
        add as bs = [[x+y | (x,y) <- zip a b] | (b,a) <- zip as bs]
        go (u,d) k = (m, -trace (a#m) / fromIntegral k)
          where m = add (diag d) (a#u)

-- Compute roots by succesively removing newly computed roots
roots :: [Complex Double] -> [Complex Double]
roots [a,b] = [-b/a]
roots   p   = root : roots (removeRoot p)
  where root = laguerre p 0
        removeRoot = init . scanl1 (\a b -> root*a + b)

-- Compute a root of a polynomial p with an initial guess x
laguerre :: [Complex Double] -> Complex Double -> Complex Double
laguerre p x = if magnitude a < 1e-9 then x else laguerre p new_x
  where evaluate = foldl1 (\a b -> x*a+b)
        order' = length p - 1
        order  = fromIntegral $ length p - 1
        derivative p = init $ zipWith (*) p $ map fromIntegral [order',order'-1..]
        g  = evaluate (derivative p) / evaluate p
        h  = (g ** 2 - evaluate (derivative (derivative p)) / evaluate p)
        d  = sqrt $ (order-1) * (order*h - g**2)
        ga = g - d
        gb = g + d
        s = if magnitude ga < magnitude gb then gb else ga
        a = order /s
        new_x = x - a

As the only submission that doesn't use builtins, this should be the highest-voted answer.

+1 for calculating something-related-to-determinant in time less than n!!

Thanks guys! @user202729: Initially I oversaw the ! and was really confused :D

Octave, 4 bytes
@eig

Try it online!
Only two bytes more than the MATL golfing language equivalent!
Defines an anonymous function handle to the eig built-in. Interestingly, the MATLAB design philosophy goes against many high-end languages, which like to use DescripteFunctionNamesTakingArguments(), whereas MATLAB and consequently Octave tend to get the shortest unambiguous function name possible. For example, to get a subset of eigenvalues (e.g., the smallest n in absolute magnitude), you use eigs.
As a bonus, here's a function (works in MATLAB, and in theory could work in Octave but their solve is not really up to the task) that doesn't use built-ins, but instead symbolically solves the eigenvalue problem, det(A-λI)=0, and converts it to numerical form using vpa
@(A)vpa(solve(det(A-sym('l')*eye(size(A)))))

MATL, 2 bytes
Yv

Try it online!
Explanation
I followed the usual advice in numerical linear algebra: instead of writing your own function, use a built-in that is specifically designed to avoid numerical instabilities.
Incidentally, it's shorter. ¯\_(ツ)_/¯

This begs the question, how long would it be without Yv?

@Sanchises I'm not sure. I'd probably go about it by finding the roots (ZQ) of the characteristic polynomial. But explicitly computing the coeffients of the polynomial may be a lot of work

Mathematica, 11 bytes
Eigenvalues

Try it online!

Yes, I expected a built-in answer before clicking "1 new answer to this question". Let's wait for some non-builtin answer... / Basically Mathematica solution is often

The shortest non-pure built-in I got is First@Eigensystem@#& (20  bytes)

I actually agree with user202729 here. While it is fun to joke about Mathematica having a builtin for everything, it is very annoying both as a challenge poster and answering to see a builtin answer equivalent to something you tried relatively hard to do. Golfing (IMO) is about attempting to find the shortest algorithm and implementation of said algorithm, but a builtin answer takes that away from the "sport".

@cairdcoinheringaahing We should really start putting xnor's proposal into practice.

R, 22 bytes
function(m)eigen(m)$va

Try it online!
Takes m as a matrix. Frustratingly, the eigen function in R returns an object of class eigen, which has two fields: values, the eigenvalues, and vectors, the eigenvectors.
However, more annoyingly, the optional argument only.values returns a list with two fields, values, containing the eigenvalues, and vectors, set to NULL, but since eigen(m,,T) is also 22 bytes, it's a wash.

Julia 0.6, 12 bytes
n->eig(n)[1]

Try it online!
Unfortunately, eig returns both the eigenvalues and eigenvectors, as a tuple, so we waste another 9 bytes to lambdify it and grab the first item.

or eigvals for 7 bytes

Python + numpy, 33 bytes
from numpy.linalg import*
eigvals

Pari/GP, 19 bytes
m->mateigen(m,1)[1]

Try it online!

Pari/GP, 24 bytes
It seems that someone downvoted every answer that uses a built-in. OK, if you don't like built-in:
m->polroots(matdet(x-m))

Try it online!


text:
Who will win a Rock, Paper, Scissors, Lizard, Spock game?
There are several questions regarding this game, even a king-of-the-hill contest here. But I think all those challenges and contests need a way to automatically determine the winner of a game. So:
Challenge
Given two inputs in the range ["rock", "paper", "scissors", "lizard", "spock"] representing the selections for player 1 and player 2, determine the winner of the match.
Rules
[Winner] [action]    [loser]
-----------------------------
scissors cut         paper
paper    covers      rock
rock     crushes     lizard
lizard   poisons     spock
spock    smashes     scissors
scissors decapitates lizard
lizard   eats        paper
paper    disproves   spock
spock    vaporizes   rock
rock     crushes     scissors

Restrictions

Input will be a pair of strings in the given range (no other strings can be used). You can use arrays of chars if you want, as long as they represent any of the mentioned values.
You can choose whether to use lowercase, uppercase ("ROCK") or camel case ("Rock") for the input strings, as long as the chosen case is the same for all inputs.
Output will be a trio of values that determine the winner, which can be anything you want as long as the answers are consistent. Example: 1 if the first input wins, 2 if the second input wins, 0 if there is a tie. Or maybe A if the first input wins, B if the second input wins, <empty string> if there is a tie.

Goal
This is code-golf, so may the shortest program/method/function/lambda for each language win!
Tests
[Input 1] [Input 2] [Output: 1/2/0]
-----------------------------------
 rock      paper     2
 rock      scissors  1
 lizard    spock     1
 spock     rock      1
 spock     paper     2
 rock      rock      0

This comes from the sandbox.

Very related.

I've closed it as a duplicate of the linked question because its just the same question with 2 new values and a slight variation on IO.

@WheatWizard sometimes a slight change in the input produces very different outputs. The questions may be quite similar but the two new values create more cases to consider, so the algorithms used here are different enough to make people think again (see the answers with the cake trick).

I agree, and voted to reopen.

@Charlie I don't feel the same way, its the same problem with a different dressing. Could I add another 2 values to make a new non-duplicate question?  It would certainly change the way answers are made but I don't think it would really make it substantially different.

"Paper disproves Spock" is my favorite.

Python 3, 68 50 48 bytes
EDIT: Thanks to 3 tricks from Neil, and 2 from Mr. Xcoder
Each input string has a distinct fourth character, so I'm using that to distinguish them. If you arrange the elements in the cycle (scissors, paper, rock, lizard, spock), then each element beats the element directly after it and the element 3 spots to the right, cyclically. So we subtract the inputs' positions in the cycle. If that number is 0, it's a tie. If it's 1 or 3, it's a win for the first player. In my original solution, the cycle difference would index into the string "210100" to distinguish the results of the game. Neil somehow figured out this can be accomplished without indexing by adding 7 and taking the modulus by 3. Edit: Originally I used the second character to identify the string, but if you use the fourth and reverse the cycle, you get cake. And we could all use more cake.
lambda x,y,z="cake".find:(7+z(y[3])-z(x[3]))%5%3

Try it online!
Older version:
lambda x,y,z="caoip".index:(7+z(y[1])-z(x[1]))%5%3

Try it online!
Original version:
b="caoip"
def r(x,y):return"210100"[(b.index(y[1])-b.index(x[1]))%5]

Try it online!

50 bytes: Try it online!

Welcome to PPCG!

49 bytes: Try it online! (switching .index to .find)

48 bytes: Try it online! (you do not need the p, "chaoi" suffices)

JavaScript (ES6), 56 bytes
Takes input in currying syntax (a)(b). Returns 0 if A wins, 1 if B wins, or false for a tie.
a=>b=>a!=b&&a>b^614>>((g=s=>parseInt(s,31)%9)(a)^g(b))&1

Demo

let f =

a=>b=>a!=b&&a>b^614>>((g=s=>parseInt(s,31)%9)(a)^g(b))&1

console.log('[Tie]');
console.log(f("paper"   )("paper"   ))

console.log('[A wins]');
console.log(f("scissors")("paper"   ))
console.log(f("paper"   )("rock"    ))
console.log(f("rock"    )("lizard"  ))
console.log(f("lizard"  )("spock"   ))
console.log(f("spock"   )("scissors"))
console.log(f("scissors")("lizard"  ))
console.log(f("lizard"  )("paper"   ))
console.log(f("paper"   )("spock"   ))
console.log(f("spock"   )("rock"    ))
console.log(f("rock"    )("scissors"))

console.log('[B wins]');
console.log(f("paper"   )("scissors"))
console.log(f("rock"    )("paper"   ))
console.log(f("lizard"  )("rock"    ))
console.log(f("spock"   )("lizard"  ))
console.log(f("scissors")("spock"   ))
console.log(f("lizard"  )("scissors"))
console.log(f("paper"   )("lizard"  ))
console.log(f("spock"   )("paper"   ))
console.log(f("rock"    )("spock"   ))
console.log(f("scissors")("rock"    ))

How?
We define the hash function H() as:
H = s => parseInt(s, 31) % 9

This gives:
s          | H(s)
-----------+-----
"rock"     |  2
"paper"    |  8
"scissors" |  1
"lizard"   |  3
"spock"    |  4

Given two inputs a and b, we consider the following statements:

do we have a > b? (in lexicographical order)
does b win the game?
what's the value of N = H(a) XOR H(b)?

From (1) and (2), we deduce whether the result of a > b should be inverted to get the correct winner and we store this flag in the N-th bit of a lookup bitmask.
a        | H(a) | b        | H(b) | N  | a > b | b wins | invert
---------+------+----------+------+----+-------+--------+-------
rock     |   2  | paper    |   8  | 10 | Yes   | Yes    | No
rock     |   2  | scissors |   1  |  3 | No    | No     | No
rock     |   2  | lizard   |   3  |  1 | Yes   | No     | Yes
rock     |   2  | spock    |   4  |  6 | No    | Yes    | Yes
paper    |   8  | rock     |   2  | 10 | No    | No     | No
paper    |   8  | scissors |   1  |  9 | No    | Yes    | Yes
paper    |   8  | lizard   |   3  | 11 | Yes   | Yes    | No
paper    |   8  | spock    |   4  | 12 | No    | No     | No
scissors |   1  | rock     |   2  |  3 | Yes   | Yes    | No
scissors |   1  | paper    |   8  |  9 | Yes   | No     | Yes
scissors |   1  | lizard   |   3  |  2 | Yes   | No     | Yes
scissors |   1  | spock    |   4  |  5 | No    | Yes    | Yes
lizard   |   3  | rock     |   2  |  1 | No    | Yes    | Yes
lizard   |   3  | paper    |   8  | 11 | No    | No     | No
lizard   |   3  | scissors |   1  |  2 | No    | Yes    | Yes
lizard   |   3  | spock    |   4  |  7 | No    | No     | No
spock    |   4  | rock     |   2  |  6 | Yes   | No     | Yes
spock    |   4  | paper    |   8  | 12 | Yes   | Yes    | No
spock    |   4  | scissors |   1  |  5 | Yes   | No     | Yes
spock    |   4  | lizard   |   3  |  7 | Yes   | Yes    | No

Hence the bits:
bit | value
----+-----------
 0  | 0 (unused)
 1  | 1
 2  | 1
 3  | 0
 4  | 0 (unused)
 5  | 1
 6  | 1
 7  | 0
 8  | 0 (unused)
 9  | 1
10  | 0
11  | 0
12  | 0

Reading this from bottom to top and ignoring leading zeros, this gives 1001100110, or 614 in decimal.

05AB1E, 16 bytes
ε'³²s3èk}Æ7+5%3%

Try it online!
or as a Test Suite
Explanation
Uses the very nice cake-trick from user507295
ε       }          # apply to each in the input pair
    s3è            # get the 4th letter
 '³²   k           # get its cake-index
         Æ         # reduce by subtraction
          7+       # add 7
            5%3%   # mod by 5 and then 3

JavaScript (ES6), 63 54 53 49 bytes

f=
(l,r,g=s=>"cake".search(s[3]))=>(7+g(r)-g(l))%5%3
<div onchange=o.textContent=`RLT`[f(a.selectedOptions[0].value,b.selectedOptions[0].value)]>L: <select id=a><option>Rock<option>Paper<option>Scissors<option>Lizard<option>Spock</select> R: <select id=b><option>Rock<option>Paper<option>Scissors<option>Lizard<option>Spock</select> Winner: T

Port of my golf to @WhatToDo's answer. Note: the snippet decodes the numeric result into something slightly less unreadable. Edit: Saved 1 byte thanks to @Arnauld. Saved 4 bytes thanks to @ovs.

@ovs Ugh, I didn't port my golf to WhatToDo's answer hard enough...

Ruby, 36 bytes
->a,b{(2+a.sum%88%6-b.sum%88%6)%5%3}

Returns 0 if 1st player wins, 1 if 2nd player wins, and 2 for a draw.
Based on user507295's answer but uses a mathematical formula to perform the hash. a.sum is the sum of all ASCII codes of the string a, mod 1<<16 and is intended as a rudimentary checksum. The hash was found using the following code:
1.upto(99){|j|p j,["scissors","paper","rock","lizard","spock"].map{|i|i.sum%j%6}}

This produced two values of j that gave a suitable hash for lowercase letters, namely 88 and 80, both of which gave the descending sequence [3,2,1,0,4] (or [4,3,2,1,0] if spock is cycled round to the beginning.)
As explained in other answers, a hash which gives a constant difference modulo 5 for consecutive elements in the above sequence is needed to make the (h[a]-h[b])%5formula work. Each element beats the element 1 or 3 places to the right and loses to the element 2 or 4 places to the right.
Try it online!

C, 53bytes
a="FÈ..J..ÁE";
z=*++y==*++x?0:a[*y&47>>1]>>*++x&7&1+1;

I've treated this problem as a state machine, of which there are 25 states as defined by the two, five state inputs.
By defining the results of the states within an an array of bits.  I look the results up within by using unique markers within the inputs.
As noted in other solutions, characters 2, 3 and 4 are unique between the possible inputs.  I have concentrated use on characters 2 and 3 which I use to select the appropriate bit within my answer array.
Within Character 2, bits 1 thru 4 clearly identify the input.  By masking these bits and shifting appropriately [that's the "*y&47>>1"], the input can be noted as 0, 1, 4, 7 or 8.  Hence my answer string has 9 characters.  (separated interesting bits)
character 2:
a 61   011 0000 1
c 63   011 0001 1
i 69   011 0100 1
p 70   011 1000 0
o 6f   011 0111 1

Within character 3, bits 0, 1 and 2 clearly identify the input.  By Masking these bits (shifting not required) [that's the "*x&7"], the input can be noted as 0, 1, 2, 3 or 7
.  (separated interesting bits)
character 3
p 70   01110 000
i 69   01101 001
z 7a   01111 010
o 6f   01101 111
c 63   01100 011

The answer string can then be calculated by simply filling in the bits for the appropriate characters.
0th char represents X=paper
1st char represents X=scissors
4th char represents X=Lizard
7th char represents X=Rock
8th char represents X=Spock

0th bit represents Y=Paper
1st bit represents Y=Scissors
2nd bit represents Y=Lizard
3rd bit represents Y=Rock
7th bit represents Y=Spock

So, set bit in char where Y wins
char  7654 3210   in hex    in ascii
0     0100 0110    46         F
1     1100 1000    c8         È
2     0100 0000    d/c        .
3     0100 0000    d/c        .
4     0100 1010    4a         J
5     0100 0000    d/c        .
6     0100 0000    d/c        .
7     1100 0001    c1         Á
8     0100 0101    45         E

Then the logic is simply: if second char is same then draw, otherwise, get ascii char based on y's second character and shift bits by x's third character and add one.  This makes the answers 0 for draw, 1 for x win and 2 for y win.

Welcome to PPCG! This is a great, well thought-out answer.

Clojure, 130 118 bytes
-12 bytes by getting rid of my weird usage of comp.
(fn[& m](let[[p q](map #(apply +(map int(take 2 %)))m)d(- p q)](cond(= d 0)0(#{5 -16 12 -14 13 1 4 -18 2 11}d)1 1 2)))

I thought I was being clever, but this ended up being naïve compared to some other answers, and much longer.
Takes the first 2 letters of each move string, gets the char codes, and sums them. It then subtracts the sums to get d. If d is 0, its a tie (0), if it's in the set of #{5 -16 12 -14 13 1 4 -18 2 11}, p1 wins (1), else, p2 wins (2).
(defn decide [& moves] ; Using varargs so I don't need to duplicate the steps.
  ; Pop the first 2 chars of each string, convert them to their ASCII code, and sum them.
  (let [[p1 p2] (map #(apply + (map int (take 2 %))) moves)
        d (- p1 p2)]

    (cond
      (= d 0) ; A tie
      0

      (#{5 -16 12 -14 13
         1 4 -18 2 11} d) ; P1 Wins
      1

      :else ; P2 Wins
      2)))

To get the "magic numbers" that define if P1 wins, I ran
(let [ms ["rock", "paper", "scissors", "lizard", "spock"]]
  (for [p1 ms
        p2 ms]

    ; Same as above
    (let [[p q] (map #(apply + (map int (take 2 %))) [p1 p2])
          d (- p q)]

      [p1 p2 d])))

Which generates a list of d values for each possible scenario:
(["rock" "rock" 0]
 ["rock" "paper" 16]
 ["rock" "scissors" 11]
 ["rock" "lizard" 12]
 ["rock" "spock" -2]
 ["paper" "rock" -16]
 ["paper" "paper" 0]
 ["paper" "scissors" -5]
 ["paper" "lizard" -4]
 ["paper" "spock" -18]
 ["scissors" "rock" -11]
 ["scissors" "paper" 5]
 ["scissors" "scissors" 0]
 ["scissors" "lizard" 1]
 ["scissors" "spock" -13]
 ["lizard" "rock" -12]
 ["lizard" "paper" 4]
 ["lizard" "scissors" -1]
 ["lizard" "lizard" 0]
 ["lizard" "spock" -14]
 ["spock" "rock" 2]
 ["spock" "paper" 18]
 ["spock" "scissors" 13]
 ["spock" "lizard" 14]
 ["spock" "spock" 0])

Then I compared the win chart against this output. Luckily there weren't any "collisions" other than 0.


text:
Find the smallest positive integer which ends in n, is divisible by n and whose digits sum to n
It's all in the title...
Take as input a positive integer n>=12 and... do what the title says.
Yes, this is on OEIS A187924.
Some test cases
12 -> 912
13 -> 11713
14 -> 6314
15 -> 915
16 -> 3616
17 -> 15317
18 -> 918
19 -> 17119
20 -> 9920
40 -> 1999840
100-> 99999999999100

This is code-golf. Shortest code in bytes wins!

Comments are not for extended discussion; this conversation has been moved to chat.

To close up a part of what was moved to chat: my edit to the OEIS proving that 11 is the only number without a solution was just approved.

Befunge, 81 bytes
&>00p0v<!%g0<
v%"d":_>1+:0^
>00g->#^_:0v
0g10g-#^_.@1>
>0p:55+/\:v>
^1+g01%+55_$^

Try it online!
Can handle up to n = 70 at least, after which some values will start overflowing the stack cell size on most implementations, and on those that don't, it'll take so long that it's not worth waiting to find out.
Given those constraints, we don't even bother trying to handle values of n greater than 99, which means we can more easily test if the value ends in n with by simply comparing the value modulo 100 with n.
Below is more detailed breakdown of the code.

 Read n from stdin and save in memory.
 Initialize the test value v to 0 and start the main loop, incrementing v up front.
 Test if v%n == 0, and if not return to the start of the main loop.
 Test if v%100 == n, and if not return to the start of the main loop.
 Sum the digits in v by repeatedly adding v modulo 10 and dividing v by 10.
 Test if the sum is equal to n, and if not return to the start of the main loop.
 Otherwise output v and exit.

JavaScript (ES6), 55 54 bytes

f=(s,p=0,a=p+s)=>a%s|eval([...a].join`+`)-s?f(s,p+1):a
<input type=number min=12 oninput=o.textContent=f(this.value)><pre id=o>

Takes input as a string. Needs a browser with tail recursion support for the larger results. Edit: Saved 1 byte thanks to @Arnauld.

eval([s,...a].join`-`)? would also work, though it's not any shorter...

@Arnauld No, I just forgot that I can do that with ||.

05AB1E, 14 bytes
[NI«ÐIÖsSOIQ*#

Try it online!
Explanation
Solutions requiring large prefixes will time out on TIO
[                # start a loop
 NI«             # append input to current iteration number
    Ð            # triplicate
     IÖ          # is the first copy evenly divisible by input?
       sSOIQ     # is the digit sum of the second copy equal to the input?
            *    # multiply
             #   # if true, break loop
                 # output the third copy

If feel as if 05AB1E is cheating, because it's so good.
The only way to beat this by a mile would be to make a programming 'compression' language that references past language. I submit ans = dic[1] lol

@Pathfinder: There are a couple of languages out there that can consistently beat 05AB1E, so we can still hope to see something even shorter :)

My attempt: ∞.Δ©IÅ¿®IÖ®SOIQP

Brachylog v2, 12 10 bytes
a₁.;A×?≜ẹ+

Try it online!
This is a function submission that takes input via . and produces output via ? (the opposite of the normal convention; all Brachylog functions have exactly two arguments, which can be input or output arguments, but the language doesn't enforce any particular argument usage). We don't normally consider conventions for argument usage to be relevant at PPCG.
Explanation
A previous version of this solution had a special case (Ḋ|, i.e. "return digits literally") for single digits, but the question apparently states that you don't have to check for that (thanks @DLosc for catching this), so I removed it. (The solution as written won't work on single digits as Brachylog won't consider 1 as a possibility for an unknown in a multiplication, to prevent infinite loops; its multiplications are arbitrary-arity.)
So this answer now goes for a pretty much direct translation of the specification. Starting with ? (the output / number we're trying to find; a Brachylog predicate always implicitly starts with ?) we use a₁. to assert that it has . (the input) as a suffix. Then ;A×? means that we can multiply (×) the result by something (;A) to produce ? (the output). Finally, ẹ+ sums (+) the digits (ẹ) of ?, and there's by default an implicit assertion at the end of every Brachylog program that the final result produces .. So in other words, this program is ". is a suffix of ?, . multiplied by something is ?, . is the digit sum of ?", which is very close to a literal translation of the original program.
The ≜ is necessary for the digit sum requirement to be enforced. I assume something about ẹ doesn't like unknowns, so the ≜ tells Brachylog to use a brute-force approach for that part of the program rather than algebra.

Alice, 35 bytes
/o
\i@/!w?+.?~\ & /-$K..?\ L z $ /K

Try it online!
Explanation
This program has a really nice mix and interaction between Cardinal (integer-processing) and Ordinal (string-processing) mode.
The usual framework for challenges with decimal I/O which operate largely in Cardinal mode:
/o
\i@/...

And the actual program:
!     Store the input N on the tape.
      We'll use an implicit zero on top of the stack as our iterator variable X,
      which searches for the first valid result.
w     Store the current IP position on the return address stack. This marks
      the beginning of the main search loop. We can avoid the divisibility
      test by going up in increments of N. To check the other two
      conditions, we'll use individual conditional loop ends that skip to
      the next iteration. Only if both checks pass and all loop ends are
      skipped will the search terminate.

  ?+    Increment the iterator X by N.
  .     Duplicate X.
  ?~    Put a copy of N underneath.
  \     Switch to Ordinal mode.
  &     Implicitly convert X to a string, then fold the next command over its
        characters, i.e. its digits. Here, "fold" means that each character
        is pushed to the stack in turn, followed by one execution of that
        next command.
  /     Switch back to Cardinal mode (this is not a command).
  -     Fold subtraction over the digits. This implicitly converts each
        digit back to its numerical value and subtracts it from N. If the
        digit sum of X is equal to N, this will result in 0.
  $K    Jump back to the w if the digit sum of X isn't N.
  ..    Duplicate X twice.
  ?     Get a copy of N.
  \     Switch to Ordinal mode.
  L     Shortest common superstring. Implicitly converts X and N to strings
        and gives the shortest string that starts with X and ends with N.
        This will be equal to X iff X already ends with N. Call this Y.
  z     Drop. If X contains Y, this deletes everything up to and including
        Y from X. This can only happen if they are equal, i.e. if X ended
        with N. Otherwise X remains unchanged.
  $     Skip the next command if the string is empty, i.e. if X ended with N.
  /     Switch back to Cardinal mode.
  K     Jump back to w if X didn't end with N.

Haskell, 72 bytes
f n=[x|x<-[n,n+lcm n(10^length(show n))..],sum[read[j]|j<-show x]==n]!!0

Try it online!
Note that the found number minus n must be a multiple of both n and 10^length(n).
Inspired by Laikoni and totallyhuman

Welcome to the site!

Change lcm n(10^length(show n)) to lcm(10^length(show n))n for 1 byte

Java (OpenJDK 8), 136 110 103 92 bytes
-26 thanks to JollyJoker
-7 again thanks to JollyJoker
-11 thanks to Oliver Grégoire
a->{for(int i=a;!(""+a).endsWith(""+i)|i!=(""+a).chars().map(x->x-48).sum();a+=i);return a;}

Try it online!
Gotta love Java! It could well be that I am using an inefficient approach, but not having a built in checksum function and the double conversion to String to check for the end of the number costs bytes...
Ungolfed:
  a->{                                                       //input n (as integer)
      for (int i = a;                                        //initiate loop
           !("" + a).endsWith("" + i)                        //check if the calculated number ends with the input
           | i != ("" + a).chars().map(x -> x - 48).sum();   //check if the checksum is equal to the input
           a += i)                                           //for every iteration, increase i by the input to save checking for divisibility
        ;                                                    //empty loop body, as everything is calculated in the header
    return a;                                                //return number
}

(""+i).endsWith(""+a) should work.

@JollyJoker brilliant, thanks for making me feel stupid :P

Heh. n/=10 instead of n=n/10 too. Also, i+=a in the for loop so you can skip the divisibility check.

@JollyJoker wow, I did it for the sum but not for the division... Thank you, I'll add it shortly

98 bytes

@OlivierGrégoire Did this before seeing yours, might be possible to combine some tricks. a->{for(int n,s=0,i=a;s!=i|!(""+a).endsWith(""+i);a+=i)for(n=a,s=0;n>0;s+=n%10,n/=10);return a;}; (97 bytes)

Yes, I was about to suggest the same without switching i and a

@JollyJoker your solution gives me 3912 for input = 12, don't know why. But Oliver yours is working. Btw: I always included the semicolon in the bytecount, but it makes sense to exclude it, as it is part of the boilerplate and not of the lambda definition

92 bytes, using the API, shorter than calculating yourself. Also, the semicolon is not part of the bytecount because a valid lambda can be given as method argument, for instance and then you don't need that semicolon.

@OlivierGrégoire Nice! The (""+a).chars().map(x->x-48) part for getting an IntStream of digits might be handy in the future.

@LucaH Well, since it's no longer the shortest, I have a good excuse to skip the debugging :)

@OlivierGrégoire I don't think I understand exactly how the checksum part works, but thank you. If one of you two wants to post this as their own submission, I would be happy to revert the changes, as I've got the feeling you did more for the answer than I did... I am just a student with a bit of programming lessons and am still learning a lot, so well...

@JollyJoker You are right :P Just wanted you to know

@LucaH What the "checksum" does is convert the number to a string ((""+a)), stream each character as integers (.chars()), convert the ASCII character (48-57) to their numerical value (0-9) by subtracting 48 from each value (.map(x->x-48)), then sum all those numbers (.sum()). Also, 100 will never work because 99999999999100 is way greater than Integer.MAX_VALUE.

@OlivierGrégoire thanks a lot for the explanation, I didn't get the stream part. Pretty clever!

@LucaH Don't worry about taking credit for others' improvements. This is the way it mostly goes in code golf; people suggest improvements until it has nothing in common with the original.

@JollyJoker Ok, thank you!

Mathematica, 72 bytes
(t=#;While[Mod[t,10^IntegerLength@#]!=#||Tr@IntegerDigits@t!=#,t+=#];t)&

-18 bytes from @MartinEnder
Try it online!
Here is another version from Martin Ender
This approach can go up to n=40 (41 exceeds the default iteration limit)
Mathematica, 65 bytes
#//.t_/;Mod[t,10^IntegerLength@#]!=#||Tr@IntegerDigits@t!=#:>t+#&

Try it online!

Husk, 20 19 17 bytes
ḟȯ=⁰Σdfȯ€d⁰ṫdm*⁰N

Thanks @Zgarb for -2 bytes!
Try it online!

17 bytes by splitting the condition into two.

C (gcc) 71 69 bytes , fails on 100
I tried with long and %1000 but times out
-2 bytes thanks to steadybox
s,i,j;f(n){for(j=0;s^n|j%100!=n;)for(s=0,i=j+=n;i;i/=10)s+=i%10;j=j;}

Try it online

Learned a new trick today with that j*=1 == return j trick.  Nice code.

https://stackoverflow.com/questions/2598084/function-with-missing-return-value-behavior-at-runtime  (last math is returned.)

@MichaelDorgan assembly of j=j and j*=1

@Steadybox thank you, i will do that

Python 2, 74 bytes
This solution assumes that n <= sys.maxint.
n=x=input()
while sum(map(int,str(x)))-n*str(x).endswith(`n`):x+=n
print x

Try it online!

Replace str(x) with x in back-ticks two times to save 6 bytes (how do you escape back-ticks inside back-ticks?).

@ChasBrown ``` backslash tick inside backticks.

@ChasBrown no, as for long integers that would add an L which could mess up the algorithm.

C# (.NET Core), 90 84 83 + 18 = 101 bytes
using System.Linq;
n=>{for(int i=n;!(""+n).EndsWith(""+i)|n%i>0|(""+n).Sum(c=>c-48)!=i;n++);return n;}

Try it online!

6 bytes saved thanks to Emigna and my uncanny ability to write (""+n) in some places and n.ToString() in others.

n=>{for(int i=n;n%100!=i|n%i>0|(""+n).Sum(c=>c-'0')!=i;n++);return n;} saves 20 bytes.

@Emigna why n%100? What if n>100?

Oh yeah, ignore that part. That was from testing with 2-digit input. The mod would have to be 10^len(input). Probably not worth it then.

Ohm v2, 16 bytes
£^›u³↔ξ³¥s}Σ³E*‽

Try it online!

JavaScript REPL (ES5), 60 59 bytes
for(n=prompt(i=0);eval([].join.call(t=++i+n,'+'))-n|t%n;);t

@totallyhuman  Fixed

In console it outputs without alert() so I guess

Thunno 2, 12 bytes
ƘS=n$Ḋn$ø>&&

Try it online!
Explanation
ƘS=n$Ḋn$ø>&&  # Implicit input
Ƙ             # First positive integer where:
 S=           #  Digit sum equals input
   n$      &  #   AND
     Ḋ        #  Divisible by input
      n$  &   #   AND
        ø>    #  Ends with input
              # Implicit output

Ruby, 65 63 54 53 bytes
->n{a=n;a+=n until/#{n}$/=~a.to_s&&a.digits.sum==n;a}

Try it online!

Julia, 70 bytes
f(x)=(n=x;while(sum(digits(n))!=x||x!=n%(10^length("$x")));n+=x;end;n)

¬x=(n=x;while sum(digits(n))!=x||!endswith("$n","$x");n+=x;end;n)
You can save 5 bytes with this. Try it online!

Pip, 18 bytes
T!y%a&$+y=aY++i.ay

Algorithm inspired by Emigna's answer. Try it online!
How it works
                    a is 1st cmdline arg, i is 0, y is "" (implicit)
T                   Loop until
 !y%a&              y%a is 0 and
      $+y=a         sum of y is a:
            ++i      Increment i
           Y   .a    and yank (i concat a) into y
                 y  After the loop exits, autoprint y

Scala, 120 bytes
def a(n:Int)={val b=math.pow(10,math.ceil(math.log10(n))).##;var c=b+n;while(c%n!=0||(0/:c.toString)(_+_-'0')!=n)c+=b;c}

This works until n = 70, after which integers overflow. For one extra character, the Int can change to a Long and allow values for n > 100 to be computed.
Here is the slightly longer ungolfed version:
def golfSourceLong(n: Long): Long = {
  val delta = math.pow(10, math.ceil(math.log10(n))).toInt
  var current = delta + n
  while (current % n != 0 || current.toString.foldLeft(0)(_ + _ - '0') != n) {
    current += delta
  }
  current
}

Python 2, 70 bytes
f=lambda n,x=0:x*(x%n<sum(map(int,`x`))==n==x%10**len(`n`))or f(n,x+n)

Try it online!

Stax, 16 bytes
è}╘⌐ƒw┴L≤⌂IÑ═eαü

Run and debug it

Haskell, 75 bytes
f n=[x|x<-[0,n..],sum[read[d]|d<-show x]==n,mod x(10^length(show n))==n]!!0

Try it online!
Explanation:
f n=[x|                                      ]!!0 -- Given input n, take the first x
       x<-[0,n..],                                -- which is a multiple of n,
                  sum[read[d]|d<-show x]==n,      -- has a digital sum of n
                  mod x(10^length(show n))==n     -- and ends in n.

I wonder whether the "ends in n" part can be shortened. I also tried show n`elem`scanr(:)""(show x), but it's longer.

Haskell, 75 bytes
f n=[i|i<-[n,n+10^length(show$n)..],i`mod`n<1,sum[read[j]|j<-show$i]==n]!!0

Try it online!

Pyth,  22  21 bytes
fq2-/,%T^;l`QsjT;Q%TQ

Try it here!

Perl 5, 46 44 + 1 ( -p ) = 45 bytes
2 bytes saved thanks to Xcali, couldn't find better
($\=++$t.$_)%$_|$_-eval$\=~s//+/gr.0&&redo}{

first answer
$\=++$x.$_;eval$\=~s//+/gr."-$_"|$\%$_&&redo}{

Try it online

Managed to save a couple bytes: Try it online!

PowerShell, 84 bytes
for($n=$i=$args[0];$i%$n-or$i-notmatch"$n$"-or([char[]]"$i"-join'+'|iex)-$n){$i++}$i

Try it online!
Simple construction but lengthy commands. Times out on TIO for n=100, but if we explicitly set i to be close, it outputs correctly.
This is just a simple for loop that keeps going so long as any one of the conditions is true. The three conditions are 1) $i%$n, i.e., we have a remainder; 2) $i-notmatch"$n$", i.e., it doesn't regex match the last couple of digits; and 3) ([char[]]"$i"-join'+'|iex)-$n, i.e., the digits summed together is not equal to $n (here checked by simple subtraction, since nonzero values are truthy). Inside the loop we're simply incrementing $i.
Thus, if we don't have a remainder, the regex matches, and the numbers are equal, all three conditions are $false and we exit the loop. As a result, we just can leave $i on the pipeline, and output is implicit.

PHP, 73+1 bytes
while(array_sum(str_split($i+=$n=$argn))-$n|$i%10**strlen($n)-$n);echo$i;

Run as pipe with -R.
loops $i through multiples of <input> until sum_of_digits-<input> and tail_of_i-$n are falsy;
then prints i.

m4, 210 bytes
define(d,define)d(i,ifelse)d(s,`i($1,,0,`eval(substr($1,0,1)+s(substr($1,1)))')')d(k,`r($1,eval($2+1))')d(r,`i(s($2),$1,i(regexp($2,$1$),-1,`k($1,$2)',i(eval($2%$1),0,$2,`k($1,$2)')),`k($1,$2)')')d(f,`r($1,1)')

Defines a macro f which computes the answer. It's a bit slow—unusably so—but I promise it works.
I thought m4 would be nice because it treats integers as strings by default, but this is pretty bad.

R, 115 bytes
function(n,d=nchar(n):1){while(sum(D<-F%/%10^((k=nchar(F)):1-1)%%10)-n|any(D[k-d+1]-n%/%10^(d-1)%%10)|F%%n)F=F+n
F}

Try it online!
Terrible R function. Increments F (starts at 0) by n until a value is found that satisfies the required properties, which it then returns. The use of any on a double expression sends out a warning for each iteration of the loop, but does not affect the correctness.
Times out on TIO for large enough inputs (n=55 or higher) but should correctly compute the solution given enough time/space.

Jelly, 22 21 bytes
DS=³a³ḍaDṫ³DLC¤Ḍ=³ø1#

Try it online!
Edit: compressed to a single line
Explanation
DS=³a³ḍaDṫ³DLC¤Ḍ=³ø1#
                  ø1#  Evaluate the condition before this and increment a counter until it is met then output the counter
D                      Digits of incremented variable as a list
 S                     Sum
  =³                   Equals argument of program?
    a                  Logical and
     ³ḍ                Does arg divide incremented variable?
       a               Logical and
        Dṫ     Ḍ       Last n digits of inc. var. where n is number of digits in program input
          ³DLC         1 - (number of digits of program input)
              ¤        Book ends above nilad
                =³     Equals program input?

This took me many hours to write because I'm learning Jelly but now that I'm done I'm so satisfied. For a long time I didn't realize I needed the ¤ and I just couldn't get it to work. Looking at [this][1] well explained code helped me seal the deal. Lots of other Jelly answers in PPCG guided me too.

I'm afraid the [this][1] link is broken.

Javascript, 224 bytes

function getNumber(x){if(x<12){return!1};const sumDigits=(x)=>x.toString().split('').map(Number).reduce((a,b)=>a+b,0);for(let i=2;i<9999;i++){if((x*i-x)%(Math.pow(10,x.toString().length))==0&&sumDigits(x*i)==x){return x*i}}}

Un-golf:

function getNumber(x){
 if (x<12) {return false};
 const sumDigits = (x) => x.toString().split('').map(Number).reduce((a,b)=>a+b, 0);
 for (let i=2; i<9999; i++){
  if((x*i-x)%(Math.pow(10, x.toString().length))==0 && sumDigits(x*i)==x){
   return x*i;
}
}
}

Usage:
 1. getNumber(12)
 2. getNumber(13)
 3. ....

I don't know much about Javascript golfing, but I'm pretty sure you should shorten the names getNumber or sumDigits.

Thank you so much, I am not go to win here, just want to get into this challenge :smile:

J, 37 33 bytes
+^:(((=1#."."0)*:(e.".\.))":)^:_~

Try it online!
                                ~    A = N
+^:                          ^:_     while(...)A+=N; return A
   (                      ":)        A to string
   (((    "."0)          )  )        digits of A
   ((( 1#.    )          )  )        sum
   (((=       )          )  )        equals N
   ((            (e.".\.))  )        N is one of the suffixes of A-string
   ((          *:        )  )        not AND

Prepending the iteration counter is ~5 times faster but 5 bytes longer:
(]+[((=1#.,.&.":)<:|),~&.":)^:_&1,&":]

Try it online!
Incrementing by 100, 27 bytes:
(]+100*(=1#.,.&.":)<:|)^:_~

Try it online!

Vyxal, 89 bitsv2, 11.125 bytes
Þ∞vp:Ṡ?=*ꜝ‡?Ḋc

Try it Online!
Explained
Þ∞vp:Ṡ?=*ꜝ‡?Ḋc
Þ∞vp            # Append the input to each and every positive integer.
    :Ṡ          # and push a copy of that with each number summed
      ?=        # does each copy equal the input
        *ꜝ      # Multiply the two lists and keep only truthy items
          ‡?Ḋc  # Find the first of that where the number is divisible by the input.

Created with the help of Luminespire.


text:
Compute the result of an equation, but with selectable operator precedence
Forget BIDMAS! Write a program that takes an equation and an operator precedence order, and prints the result.
Example input format:
1.2+3.4*5.6/7.8-9.0 */+-

Rules & guidelines:

The only operators that are defined are addition (+), subtraction (-), multiplication (*), and division (/). No parentheses, no exponentiation.
Associativity is always left-to-right. For example, 10/4/2 is to be interpreted as (10/4)/2 with a result of 1.25, rather than 10/(4/2).
The input format is as follows:

An equation, followed by a space, followed by the operator precedence specification (or two string arguments, one for the equation and the other for the precedence).
The equation comprises base-10 decimal numbers separated by operators, with no spaces. Integer values do not have to contain a period character, i.e. both 5 and 5.0 are to be accepted values.
For simplicity, negative numbers may not be included in the input, e.g. 6/3 is valid but 6/-3 is not. Input also may not contain a leading or trailing operator, so -6/3 isn't considered valid, nor is 6-3+.
The precedence specification string is always 4 characters long and always contains the characters +, -, /, and * once each. Precedence is read as left-to-right, e.g. */+- specifies multiplication with the highest precedence, division next, then addition, and finally subtraction. EDIT: It is acceptable to take the precedence string in reverse order (lowest to highest) as long as you specify this in your answer.

Input is a string to be taken via command line arguments, STDIN, or the default input format in programming languages that do not support these input methods.
You are free to assume that the given input will be in the correct format.
Output is via STDOUT or your language's normal output method.
The printed result should be in base-10 decimal.
Results must be computed to at least 4 decimal points of accuracy when compared to a correct implementation that uses double precision (64-bit) floating point arithmetic. This degree of freedom is designed to allow for the use of fixed-point arithmetic in languages that have no floating-point support.
Divide by zero, overflow, and underflow are undefined behaviour. Your code is free to assume that no inputs will be given that will trigger these cases.
You may not call out to any external services (e.g. Wolfram Alpha)
You may not call out to any programs whose primary function is to solve these types of problems.

Test cases:

6.3*7.8 followed by any operator precedence specification prints 49.14
2.2*3.3+9.9/8.8-1.1 */+- is parsed as ((2.2*3.3)+(9.9/8.8))-1.1 and should print 7.285
2.2*3.3+9.9/8.8-1.1 +*/- is parsed as ((2.2*(3.3+9.9))/8.8)-1.1 and should print 2.2
10/2+5-1 +-/* is parsed as 10/((2+5)-1) and the printed result should be 1.6666666...
2147480/90+10*5 +/-* is parsed as (2147480/(90+10))*5 and the printed result should be 107374
3*55-5/8/4+1 -/+* is parsed as 3*((((55-5)/8)/4)+1) should print 7.6875
An input containing one thousand instances of the number 1.015 separated by multiplier operators (i.e. the expanded multiplicative form of 1.015^1000), followed by any operated precedence specification, should print a number within 0.0001 of 2924436.8604.

Code golf, so shortest code wins.

"BIDMAS" is "PEMDAS" in the US because why wouldn't it be?

It's also taught as "BODMAS" in some UK schools (Brackets Orders).

Related.

Also related.

The fact that you can't have two operators have the same precedence (like */ and +- in normal math) saddens me :( oh well :P

Can I take the operator precedence in reverse order?

Can I take 5 arguments to a function as the expression and then the 4 operators in their order of precedence?

@HyperNeutrino Input is a string in the specified format only.

@Polynomial cough

@NieDzejkob In this case I think the input format is flexible enough, and HyperNeutrino's request to allow 5 arguments to a function as the expression removes a lot of the parsing work that makes this challenge interesting. Operator precedence in reverse order is acceptable, though, now that I think about it more.

@Polynomial I also think that five arguments is too much, but allowing two strings, one for the formula and one for the operators, seems reasonable. Splitting at white space is probably not the interesting part of parsing.

@Laikoni Also acceptable. Edited to reflect.

Can intermediate results be negative? For example, is something like 5-8+4 -+/* (= -3+4 = 1) a possible input to the program?

@Polynomial The parsing of I/O is NOT the interesting part of challenges.

@JonathanS. Yes

The parsing work does not make the challenge interesting. The parsing methods should be completely answerer-defined IMO. It's the actual challenge, not the I/O, that makes the challenge interesting.

I think your profile picture perfectly relates how most of us feel about the I/O :P   (no offense meant, just a jest)

JavaScript (ES6), 94 bytes
Not particularly short, but fun. Adding parentheses all over the place...
s=>([e,o]=s.split` `,[...o].map(x=>e=e.split(x).join((a+=')')+x+(b+='(')),a=b=''),eval(b+e+a))

Test cases

let f =

s=>([e,o]=s.split` `,[...o].map(x=>e=e.split(x).join((a+=')')+x+(b+='(')),a=b=''),eval(b+e+a))

console.log(f("6.3*7.8 +-*/"))              // 49.14
console.log(f("2.2*3.3+9.9/8.8-1.1 */+-"))  // 7.285
console.log(f("2.2*3.3+9.9/8.8-1.1 +*/-"))  // 2.2
console.log(f("10/2+5-1 +-/*"))             // 1.6666
console.log(f("2147480/90+10*5 +/-*"))      // 107374
console.log(f("3*55-5/8/4+1 -/+*"))         // 7.6875

Historical note
A similar method was used in early FORTRAN compilers. Here is a link from archive.org to a relevant article written by Donald E. Knuth in a 1962 book called Computers and automation.
Examples
Let's consider the expression 2.2*3.3+9.9/8.8-1.1.
With operator precedence */+-, it will expand to:
((((2.2)*(3.3)))+(((9.9))/((8.8))))-((((1.1))))

With operator precedence +*/-, it will now expand to:
((((2.2))*((3.3)+(9.9)))/(((8.8))))-((((1.1))))

Removing all redundant parentheses, we get:
((2.2*3.3)+(9.9/8.8))-1.1 = 7.285

and:
((2.2*(3.3+9.9))/8.8)-1.1 = 2.2

JavaScript (ES6), 174 133 bytes
Saved 41 bytes thanks to Arnauld.
i=>([e,o]=i.split` `,e=e.split(/([+*/-])/),[...o].map(x=>{while(~(b=e.indexOf(x)))e.splice(--b,3,eval(e.slice(b,b+3).join``))}),e[0])

First golf! This is probably terribly unoptimized.
Ungolfed:
f = input => {
    [equation, output] = input.split(" ");
    equation = equation.split(/([+*/-])/);
    [...output].map(x => {
        while (~(b = equation.indexOf(x))) {
            equation.splice(--b, 3, eval(equation.slice(b, b + 3).join("")));
        }
    });
    return equation[0];
};

This splits the input equation into tokens of numbers and operators, then iterates through operators in the specified order and collapses pairs of numbers using eval() until there's only one left.
JavaScript rounding error trash means that test case 3 results in 2.1999... instead of 2.2. I'm not sure if that disqualifies this answer, but oh well.
Test cases:

f=i=>([e,o]=i.split` `,e=e.split(/([+*/-])/),[...o].map(x=>{while(~(b=e.indexOf(x)))e.splice(--b,3,eval(e.slice(b,b+3).join``))}),e[0])

console.log(f("6.3*7.8 +-/*"));
console.log(f("2.2*3.3+9.9/8.8-1.1 */+-"));
console.log(f("2.2*3.3+9.9/8.8-1.1 +*/-"));
console.log(f("10/2+5-1 +-/*"));
console.log(f("2147480/90+10*5 +/-*"));
console.log(f("3*55-5/8/4+1 -/+*"));
console.log(f((new Array(1000)).fill("1.015").join("*") + " +-*/"));

Welcome to PPCG! Some quick wins: Use map instead of forEach. Use destructuring assignment [e,o]=i.split and then use e and o instead of a[0] and a[1].

Welcome to PPCG, nice first solution.

You may also replace e.replace(/[+\-*/]/g," $& ").split\ ` withe.split(/([+*/-])/)` (splitting while capturing the separators).

@Arnauld Ooh, that's neat. Why does putting the character set in a capture group retain the separators?

Quoting the specification: If separator is a regular expression that contains capturing parentheses, then each time separator is matched the results (including any undefined results) of the capturing parentheses are spliced into the output array.

JavaScript (ES6), 59 bytes
f=(s,[o,...a])=>eval(o?s.split(o).map(e=>f(e,a)).join(o):s)

Port of my golf of @HyperNeutrino's Python answer. Takes lowest precedence first.

...wow, so much cleaner than my lousy attempt...

that's amazing...

@edc65 Oops, fixed!

Python 3, 77 bytes
f=lambda a,b:eval(b and b[0].join(str(f(A,b[1:]))for A in a.split(b[0]))or a)

Try it online!
-23 bytes thanks to Neil (takes operator precedence in reverse)
-1 byte thanks to Mr. Xcoder

78 bytes: Try it online!

77 bytes

@edc65 pointed out in a comment on my answer that I forgot to make it clear that my golf takes the precedence string in reverse.

@Neil Ah yes, I didn't notice, thanks. I'll edit my answer to reflect that.

Proton, 87 bytes
x=>y=>eval((f=b=>a=>b?"(#{e.join(map(f(b[to-1]),a.split(e=b[-1])))})":a)(y)(x)).evalf()

Try it online!
+19 bytes to accommodate for the unnecessarily restrictive output format. seriously? the restriction is actually making the answers less accurate because now instead of precise fractional output it's giving inaccurate IEEE floating points... think about it...

Your "try it online" sample is outputting the result as a fraction rather than a decimal.

@Polynomial Does that really matter? If so, I can change it, but that's a feature of the language; making me change it would be considered cumbersome I/O format which is highly discouraged but up to you.

I think normally it'd be a cumbersome I/O format in a different problem space, but in this case the question is specifically asking you to solve the numerical result of a formula, and outputting a different formula (which is what a fraction ultimately is) isn't really achieving that. Otherwise one could arguably just print the input for any case ^[0-9\.]+/[0-9\.]+$.

@Polynomial I disagree, a fraction is a numeric format, like a decimal expansion. A special case avoiding any work for the very special case a/b would be worthles for all others

@Polynomial I believe that according to the meta post here that fractions are normally considered valid numeric output.

@Potato44 In the general case, yes, but since this challenge is explicitly about evaluating such expressions in the first place I do not agree that is an appropriate output format. If the decimal-only restriction takes the enjoyment out of the challenge for you, then I suggest just skipping this one.

@Polynomial I do believe it takes the enjoyment out of this challenge for this answer because now the Proton golfing tricks which were designed specifically to beat Python no longer work. -1 from me for now.

Jelly, 21 bytes
ṣ⁹ḊṪ¤ñ€⁹Ṗ¤j⁹ḊṪ¤ŒVµ¹⁹?

Try it online!
Explanation
ṣ⁹ḊṪ¤ñ€⁹Ṗ¤j⁹ḊṪ¤ŒVµ¹⁹?  Main Link
                    ?  Ternary:
                   ⁹   If the right argument is truthy:
ṣ                      Split it by
  ḊṪ                   The last element of
 ⁹  ¤                  The right argument
      €                For each element
     ñ                 Call the next link as a dyad (wraps around so this calls the current link as a dyad)
       ⁹Ṗ¤             With right argument as `right_argument[:-1]`
          j            Join with
            ḊṪ         The last element of
           ⁹  ¤        The right argument
               ŒV      Evaluate as Python code
                 µ     Start a new monadic chain. If the right argument is falsy:
                  ¹    Identity: Return the left argument unmodified

Is this 21 bytes or 21 UTF-8 characters? Is Jelly one of those languages with a custom codepage to reduce things down to an 8-bit space?

@Polynomial Jelly is one of those languages.

Perl 5, 64 + 1 (-p) = 65 bytes
s/ .*//;for$i(map"\\$_",$&=~/./g){s/[\d.]*$i[0-9.]*/$&/ee&&redo}

Try it online!

0-9  can be replaced with \d, however seems it's missing a loop to handle multiple instance of an operator for example 3*55-5/8/4+1 -/+*

You're right.  It was only handling the first instance of each operator.

\Q$i\E to avoid map"\\$_"

JavaScript (ES6), 96 bytes
f=(o,s)=>o?f(o.slice(s!=(s=s.replace(eval(['/','\\'+o[0],'/'].join`(\\d+\\.?\\d*)`),eval))),s):s

A non-recursive attempt was first made for this technique, but it came up at 101:
(s,o)=>[...o].map(x=>[...s].map(_=>s=s.replace(eval(['/','\\'+x,'/'].join`(\\d+\\.?\\d*)`),eval)))&&s

Clojure, 167 bytes
(defn f [i O](eval(read-string(or(first(filter some?(for[o O](let[[x y](clojure.string/split i(re-pattern(str \\ o))2)](when y(str" ("o\ (f x O)\ (f y O)")"))))))i))))

Whoa, long function names strike again! Operation precedence O is taken in "reverse" order.

C (gcc) , 276 bytes
A,B,u,i,j,k;double g(){double a,b,f[1000];char o[999],p[5];for(i=k=0;o[i++]^32&&scanf("%lf%c",&f[i],&o[i]););for(gets(p);k<4;k++)for(A=B=0;B<i;A=B){for(;!f[B++]&&i/B;);if(A&&o[--A]==p[k])u=p[k],a=f[A],b=f[--B],f[B]=u^42?u^43?u^45?a/b:a-b:a+b:a*b,f[A]=0,o[A]=o[B++];}a=f[i-1];}

Try it online
Slightly longer solution using NAN