# Scalar product is not distributive

5 messages
Open this post in threaded view
|

## Scalar product is not distributive

 echo([1]+[1,2] );echo([2]*([1]+[1,2]));echo([2]*[1] + [2]*[1,2]);// ECHO: [2] ??? // ECHO: 4 // ECHO: undefIs this intentional or a bug? _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Scalar product is not distributive

 Would you expect a 1D or a 2D value as sum of a 1D vector and a 2D vector? OpenSCAD silently returns a value procrusted to the lowest dimension. Matlab returns a 2D value and doesn't differentiate between [1] and 1. Is it, what you are opting for? echo([1]+[1,2] ); // [2] echo([1, 2, 3]+[1, 2]); //[1, 4] echo(1+[1,2] ); // undef -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Scalar product is not distributive

 I would expect undef as the sum. So, [2]*([1]+[1,2]) ==  [2]*[1]+[2]*[1,2]) == undefEm qua, 5 de dez de 2018 às 17:07, Parkinbot <[hidden email]> escreveu:Would you expect a 1D or a 2D value as sum of a 1D vector and a 2D vector? OpenSCAD silently returns a value procrusted to the lowest dimension. Matlab returns a 2D value and doesn't differentiate between [1] and 1. Is it, what you are opting for? echo([1]+[1,2] ); // [2] echo([1, 2, 3]+[1, 2]); //[1, 4] echo(1+[1,2] ); // undef -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org