bugGNU Octave - Bugs: bug #64538, 1/x calculates wrong when mapped...

 
 

bug #64538: 1/x calculates wrong when mapped on an array of floats

Submitter:  None
Submitted:  Thu 10 Aug 2023 06:28:42 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid Assigned to:  None
Originator Name:  VB Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 8.2.0
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 10 Aug 2023 11:39:44 AM UTC, comment #2: 

Sent by the OP via private email:

> Yes that works, Thank you!
> Ja, das funktioniert, Danke😉


Closing as invalid.

Markus Mützel <mmuetzel>
Group administrator
Thu 10 Aug 2023 06:42:39 AM UTC, comment #1: 

The `/` is a matrix division operator (shorthand for `mrdivide`). For a matrix division to be possible the respective dimension of the two operands must match.

I don't know if I understood correctly which result you consider to be wrong. But maybe you intended to use an element-wise division? For that, you could use the `./` operator (shorthand for `rdivide`):

>> 1./[1.0,0.1]
ans =

    1   10

>> 1./[0.1,0.2,0.3]
ans =

   10.0000    5.0000    3.3333

>> 1./[0.1,0.2,0.3]'
ans =

   10.0000
    5.0000
    3.3333

>> 1.0./[0.1,0.2,0.3]'
ans =

   10.0000
    5.0000
    3.3333

>> 1.0./([0.1,0.2,0.3]')
ans =

   10.0000
    5.0000
    3.3333


Markus Mützel <mmuetzel>
Group administrator
Thu 10 Aug 2023 06:28:42 AM UTC, original submission:  


>> 1/[1.0,0.1]

error: operator /: nonconformant arguments (op1 is 1x1, op2 is 1x2)

>> 1/[0.1,0.2,0.3]

error: operator /: nonconformant arguments (op1 is 1x1, op2 is 1x3)

>> 1/[0.1,0.2,0.3]'

ans =

   0.7143   1.4286   2.1429

>> 1.0 /[0.1,0.2,0.3]'

ans =

   0.7143   1.4286   2.1429

>> 1.0 /([0.1,0.2,0.3]')

ans =

   0.7143   1.4286   2.1429

>>


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-08-10 mmuetzel StatusNeed Info Invalid
        Open/ClosedOpen Closed
    2023-08-10 mmuetzel StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code