bugGNU Octave - Bugs: bug #54934, [octave forge] (symbolic) jacobian...


bug #54934: [octave forge] (symbolic) jacobian with second argument omitted

Submitted by:  None
Submitted on:  Thu 01 Nov 2018 05:16:02 PM UTC  
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Need Info Assigned to:  None
Originator Name:  abuelo Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  dev
Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 02 Nov 2018 05:39:41 AM UTC, comment #2: 

> Does Matlab's 'jacobian' do something different in this case?

Unlikely, unless they special case for polar somehow.  `symvar` follows them pretty closely.

Colin Macdonald <cbm>
Thu 01 Nov 2018 07:07:47 PM UTC, comment #1: 

You haven't given jacobian a second argument to tell it what to take the derivative with respect to. In this case, the function calls 'symvar' on your input.

Since the input is simply an array of variables, symvar is a permutation of those same variables:

>> symvar ([r, phi, theta])
ans = (sym) [φ  r  θ]  (1×3 matrix)
>> symvar ([r, theta, phi])
ans = (sym) [φ  r  θ]  (1×3 matrix)

So the jacobian is taken with respect to [phi, r, theta], at least on my system with SymPy 1.3:

>> jacobian ([r, theta, phi], [phi, r, theta])
ans = (sym 3×3 matrix)

  ⎡0  1  0⎤
  ⎢       ⎥
  ⎢0  0  1⎥
  ⎢       ⎥
  ⎣1  0  0⎦

Does Matlab's 'jacobian' do something different in this case?

Mike Miller <mtmiller>
Project Administrator
Thu 01 Nov 2018 05:16:02 PM UTC, original submission:  

I am using
Symbolic pkg v2.7.1: Python communication link active, SymPy v1.3.

    syms x y z r theta phi
    x = r * cos(theta) * sin(phi)
    y = r * sin(theta) * sin(phi)
    z = r * cos(phi)
    jacobian([r theta phi])

ans = (sym 3×3 matrix)

  ⎡0  1  0⎤
  ⎢       ⎥
  ⎢0  0  1⎥
  ⎢       ⎥
  ⎣1  0  0⎦

¿should it not return?

  ⎡1  0  0⎤
  ⎢       ⎥
  ⎢0  1  0⎥
  ⎢       ⎥
  ⎣0  0  1⎦



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

Attach Files:

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 cbm (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-01 mtmiller Summary[octave forge] (symbolic) jacobian => [octave forge] (symbolic) jacobian with second argument omitted
    2018-11-01 mtmiller CategoryOctave Function => Octave Forge Package
        StatusNone => Need Info
        Release4.2.2 => dev
        SummaryUsing jacobian => [octave forge] (symbolic) jacobian

    Back to the top

    Powered by Savane 3.5