Problem 666. Vector Linear sum: (p1-m1)V1+(p2-m2)V2+...(pK-mk)Vk
Calculate the sum of a Vector times coefficients expressed as two strings.
Example:
Normal representation [ a b c ], [ p1 p2 p3 ], [ m1 m2 m3 ]
sum = a(p1-m1)+b(p2-m2)+c*(p3-m3)
sum=9a+4b-3c+2d-6e-8f would be for v=[a b c d e f]
Given v=[1 2 3 4 5 6]
pcoef='940200'
mcoef='003068'
sum= 9+8-9+8-30-48=-62
This initial solution proposed to minimize size was utilized by Tim.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers55
Suggested Problems
-
Return a list sorted by number of occurrences
2880 Solvers
-
Check if number exists in vector
13495 Solvers
-
Calculate the Hamming distance between two strings
338 Solvers
-
165 Solvers
-
Volume of a sphere given its surface area
153 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!