# Mapping and Interpolation

Does Mathematica have a mapping function like scipy or any of the multidimensional ones?

By this I mean something like mapping $[1,100]$ onto $[7,20]$ for example.

Looking at Interpolate I only see interpolation with regards to estimating a line given points.

To make it more clear I mean a simple example using a linear mapping would be $[0,512]$ onto $[0,10]$ would give 5 for a value of 256.

1. What would make the question more clear? An example would be reading in a sensor that gives values on $[0,256]$ and using those to operate say a servo which accepts values on $[0,10]$

2. in this scale that is exactly what I'm looking for! thanks. Is it possible to use mappings of other orders, ex. a normal distribution or a quadratic mapping? This being a linear mapping. –

• I don't understand what your asking for. Apr 10, 2012 at 1:13
• Do you mean splines? reference.wolfram.com/mathematica/guide/Splines.html Apr 10, 2012 at 1:55
• Are you looking for Rescale[256, {0,512}, {0,10}] (==> 5)? Apr 10, 2012 at 2:22
• @BrettChampion in this scale that is exactly what I'm looking for! thanks. Is it possible to use mappings of other orders, ex. a normal distribution or a quadratic mapping? This being a linear mapping. Apr 10, 2012 at 2:25
• The reason why your question was unclear is that you mention interpolation when you need a linear transformation (they're unrelated) and that originally you didn't say at all that you need a linear transformation. There are of course infinitely many (non-linear) mappings from interval $[a,b]$ to interval $[c,d]$. Apr 10, 2012 at 6:57

Your question isn't very clear, but I think you need the Rescale function, especially its 3 argument form:

Rescale[#, {1, 100}, {7, 20}] & /@ Range[1, 100, 5] // N
(* Out[1]= {7., 7.65657, 8.31313, 8.9697, 9.62626, 10.2828, 10.9394, 11.596, 12.2525, 12.9091,
13.5657, 14.2222, 14.8788, 15.5354, 16.1919, 16.8485, 17.5051, 18.1616, 18.8182, 19.4747}
*)

• what would make the question more clear? An example would be reading in a sensor that gives values on [0,256] and using those to operate say a servo which accepts values on [0,10]. Apr 10, 2012 at 2:23
• @EiyrioüvonKauyf Then Rescale is exactly what you want. You should also look into Clip to use along with this if you don't want to give out of bound values to your servo.
– rm -rf
Apr 10, 2012 at 2:59
• @R.M Rescale[] is what I thought about when reading the question, but I agree it wasn't evident. Author, you might want to edit your question adding the precisions you gave in the comments!
– CHM
Apr 10, 2012 at 3:29