Question: How to create a procedure that only uses x-points from a given set of coordinate data?

Say you have your data, a list of coordinates as,

d1 := [[3, 11], [4, 6], [5, 8]]

Where the goal here is to take the x-coordinate, subtract that by two, then add all the subtracted coordinates together, basically,

(3-2)+(4-2)+(5-2) = 6

 

I would like to write a procedure to do this, my template done to the best of my maple knowledge below:

f2 :=proc(dat::list)

for i from 1 to nops(dat) do 
val1:={{ PULL data[i,1]}}  
sub2 :=val1-2 

{{add sub2 to new 1 D array}}   

end do;  

{{sum array}}  
end proc

The '{{ }}' brackets indicate that I have no idea how to do that function. Basically, I need to pull each x-element, subtract it by 2, add to a new list, and sum the list.

 

I would be grateful for any help, thanks!

 

Please Wait...