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!
{{x1,y1},{x2,y2}}
do you have in mind to get{{a*x1,b*y1},{a*x2,b*y2}}
? $\endgroup$ – Alexei Boulbitch Jan 13 '16 at 15:04Map[Times[#, {a, b}] &, {{x1, y1}, {x2, y2}}, {-2}]
? $\endgroup$ – 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! $\endgroup$ – Marc Koetse Jan 13 '16 at 15:27