bb_anna

10 Reputation

One Badge

0 years, 51 days

MaplePrimes Activity


These are questions asked by bb_anna

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!

 

When I first open my worksheet, my PolynomalInterpolation code looks and works fine,

However, when I press enter, it only displays the command text,

Why is this happening? How can I fix it?

Page 1 of 1