# 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

You are not logged in

## Discussion

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>
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])

returns:
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⎦

Anonymous

## Attached Files

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

Attach Files:

Comment:

No files currently attached

## Dependencies

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?
This task has 0 encouragements so far.

Only project members can vote.