HP Forums

Full Version: another BUG [ .^ ]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
I can confirm this, happens in my prime too.
(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.
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}.
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.
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.
(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
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.
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).
Reference URL's