HP Forums
another BUG [ .^ ] - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: another BUG [ .^ ] (/thread-650.html)



another BUG [ .^ ] - churichuro - 02-11-2014 02:56 AM

Hello every world!, my first post
don´t talk English, so be kind.

the Problem:

in home
in HP PRIME do:

any matrix or vector like [ 2 6 4 ]
then try to do .^3

and I get this :
[ 6 18 12 ] <--- wrong!!!

I must have this answer: [ 8 216 64]

the .^ work like .* then is an error

please report this error, because is really ugly !

P.D. in CAS this work right. or in home with this form CAS([2 6 4].^3)


RE: another BUG [ .^ ] - eried - 02-11-2014 04:12 AM

I can confirm this, happens in my prime too.


RE: another BUG [ .^ ] - John P - 02-11-2014 12:18 PM

(02-11-2014 02:56 AM)churichuro Wrote:  Hello every world!, my first post
don´t talk English, so be kind.

the Problem:

in home
in HP PRIME do:

any matrix or vector like [ 2 6 4 ]
then try to do .^3

and I get this :
[ 6 18 12 ] <--- wrong!!!

I must have this answer: [ 8 216 64]

the .^ work like .* then is an error

please report this error, because is really ugly !

P.D. in CAS this work right. or in home with this form CAS([2 6 4].^3)

In CAS is OK but in HOME the result i wrong.


RE: another BUG [ .^ ] - Marcelo Vanti - 02-11-2014 01:05 PM

Sorry, but I don't understand. The correct shouldn't be {2 4 6} ^ 3? In this case, the home results in { 8 216 64}.


RE: another BUG [ .^ ] - Marcelo Vanti - 02-11-2014 01:19 PM

Sorry, I had missed the point in command "^ '. Indeed, this is new to me, and normally I would use lists for this type of operation.


RE: another BUG [ .^ ] - Helge Gabert - 02-11-2014 09:09 PM

This might be an alternative/workaround for the time being (Home view, but also in CAS):

[2 4 6].^[3 3 3] returns [8 64 216].

Element-by-element operation, kind of like HADAMARD on the HP 50G.


RE: another BUG [ .^ ] - churichuro - 02-11-2014 10:59 PM

(02-11-2014 09:09 PM)Helge Gabert Wrote:  This might be an alternative/workaround for the time being (Home view, but also in CAS):

[2 4 6].^[3 3 3] returns [8 64 216].

Element-by-element operation, kind of like HADAMARD on the HP 50G.

very interesting Helge, but this work only if you know the number of elements in the vector


RE: another BUG [ .^ ] - Helge Gabert - 02-12-2014 12:27 AM

Yes, but that is easy: just use SIZE() and then you know the length of the second vector to be filled with the constant.

Actually, I believe that element-by-element operations are the idea behind the ./ .+ .- .* .^ operators - - so that is how it appears to be designed.

What you attempted to do is a shortcut - - and I agree, it is a shortcut that makes sense and should also work in Home - - and it works in CAS, as we know!

Of course, you can always change your vector to a list and do this in Home: {2,4,6}^3 returns the correct answer.


RE: another BUG [ .^ ] - John P - 02-12-2014 05:47 PM

I have a problem with this element by element operations. OK, for matrix multiplication and power it makes sense. For vectors you have dot and cross products, but what is the meaning [1,2,3,4,5]^3 or {1,2,3,4,5}^3? It only makes sense if each element is raised to the 3rd power. IMHO [1,2,3,4,5]^3 should be the standard unless you do that on matrix then you need [[]].^(number).