# Multiplying a table with constants

I have a table with coordinates {{x1,y1},{x2,y2}} that I want to multiply with a separate constant for x and one for y so: {{a,b},{a,b}}. (basically I rasterize a set of lines and then calculate the lines back) I have tried most of the suggestions that I found here on this forum and in the Documentation Center, but I cannot seem to find a correct and elegant solution. In (test) code:

edge = 5
vxstep = 0.01
voffsetbottom = 10
vspace = 5
vystep = 0.0705
vlength = 100
vnumcell = 6
myList = Table[{
{Round[vedge/vxstep], Round[(voffsetbottom + ii*vspace)/vystep]},
{Round[(vlength - vedge)/vxstep], Round[(voffsetbottom +ii*vspace)/vystep]}
}, {ii, 1, vnumcell}];
myList // TableForm
myList *= {{vxstep, vystep},{vxstep,vystep}} (*this is what I'd like, but does not work*)


Does anyone have suggestions how to make this multiplication work? Thanks!

• First you should post your code in Mathematica notations to simplify our work to help you.I suggest that you take a tour and have a look at the rules. Second, it is not quite clear what do you want to obtain. Starting with {{x1,y1},{x2,y2}} do you have in mind to get {{a*x1,b*y1},{a*x2,b*y2}}? – Alexei Boulbitch Jan 13 '16 at 15:04
• Map[Times[#, {a, b}] &, {{x1, y1}, {x2, y2}}, {-2}]? – Algohi Jan 13 '16 at 15:23
• {{a*x1,b*y1},{a*x2,b*y2}} is indeed wat I want to achieve. By te way, the code above is mathematica code, Except for the last line it runs perfectly. I'll give your suggestion a try! – Marc Koetse Jan 13 '16 at 15:27

myList = Map[# {vxstep, vystep} &, myList, {2}]

• Its actually a tad faster to map at the top level: Map[# {{vxstep, vystep}, {vxstep, vystep}} &, myList, 1] – george2079 Jan 13 '16 at 17:01
myList := Map[# {vxstep, vystep} &, myList, {2}]`