1
$\begingroup$

I want to calculate the partial derivatives of the function $A(x,y)$. For example, I want to use Maple to calculate $\frac{\partial^2}{\partial x\partial y}\left(K\cdot x\cdot A(x,y) \right)$ where $K$ is some constant. Here the function $A(x,y)$ is not defined explicitly and so I expect to see terms like $\frac{\partial^2}{\partial x\partial y}A(x,y)$ in the answer.

I used the following Maple code to calculate

D[1,1] (K * x * A) (x,y) assuming K::constants

However, Maple will treat $x$ in $K \cdot x \cdot A$ also as a function. How should I tell Maple that $x$ is a variable that I want to take derivative with?

$\endgroup$
1
  • 1
    $\begingroup$ D takes operator as an argument, diff takes expression as an argument. I guess you could use either D[1,2]((x,y)->K * x * A(x,y))(x,y) or diff(K * x * A(x,y),[x,y]) $\endgroup$
    – Sil
    Jan 2, 2023 at 23:19

1 Answer 1

1
$\begingroup$

Judging by the partial result you're expecting $$ \frac{\partial^2}{\partial x\partial y}A(x,y), $$ I'm assuming you're looking to make use of $D[1,2]$ (refering to the first and second variable). We can define $f$ as $$f:=(x,y)\to K\cdot x\cdot A(x,y).$$ From here you get the desired output $$D[1,2](f)(x,y) = K\cdot \frac{\partial}{\partial y}A(x,y) + K\cdot x\cdot \frac{\partial^2}{\partial x\partial y}A(x,y).$$ You can at any point convert to partials with $\mathrm{convert}(\%,\mathrm{diff})$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .