0
$\begingroup$

Here's my code:

f[x_, y_] := x^2 y^4
Criticalpts = Reduce[{D[f[x, y], x] == 0, D[f[x, y], y] == 0}, {x, y}];
Print["Critical points are ", Criticalpts]
Discr = D[f[x, y], {x, 2}] D[f[x, y], {y, 2}] - (D[f[x, y], x, y])^2;
Print["Discriminant D(x,y) of f(x,y)= ", Discr]

The output of the above code is

Critical points are x==0||y==0
Discriminant D(x,y) of f(x,y)= -40 x^2 y^6

Fine till here. Now I want to calculate the value of the discriminant at critical points. (I know, for general case evalauating the value of D(x,y) at infinitely many points (x,y) is troublesome, but for this particular function I just want to replace x with 0 or y with 0 in -40x^2y^6 to get the output zero (similar to what I do when there is just one critical point), showing that Discriminant is zero at every critical point.)

I tried the following methods:

Evaluate[Discr /. {x -> 0 \[Or] y -> 0}]

Evaluate[Discr /. Or[x -> 0, y -> 0]]

Evaluate[Discr /. Criticalpts

Tried Solve, Simplify etc. Tried finding Critical pts with other methods so that I can get the value of D(x,y) at all the critical points directly, of course I wouldn't like to input x==0 or y==0 manually after seeing the output. A method which can evaluate D(x,y) at the critical points automatically by using an output of another command will be appreciated.

Note: I know I can first evaluate D(x,y) at all points on x-axis and then at all points on y-axis. Please suggest a better way to do the same.

Thank you!

$\endgroup$
1
  • $\begingroup$ In note, I meant I don't want to do this: Evaluate[Discr /. {{x -> 0}, {y -> 0}}] or anything similar to this. $\endgroup$ Sep 28, 2021 at 10:56

1 Answer 1

1
$\begingroup$

Too long for comment: If this is not what you want, let me know and I will delete my answer. At least this will help someone else provide you with the answer that you are looking for.

Reduce[D[f[x, y], x] == 0]

x == 0 || y == 0

Solve, if successful, will give you rules directly (this will become important later), but perhaps you want to stick with Reduce :

solx = Solve[D[f[x, y], x] == 0]

{{x -> 0}, {y -> 0}}

In order to change the OR output to rules:

rules = List @@ Rule @@@ Reduce[D[f[x, y], x] == 0]

{x -> 0, y -> 0}

Remember that for complicated Boolean expressions, this strategy will fall apart. To apply rules one after the other:

Discr /. # & /@ rules

{0, 0}

$\endgroup$
11
  • 3
    $\begingroup$ Use just Discr /. {ToRules@Criticalpts} . $\endgroup$
    – Artes
    Sep 28, 2021 at 12:53
  • $\begingroup$ I didn't know { } could do this. Thanks so much. I tried List@@ etc. Can you please post an answer, and I will delete this one. $\endgroup$
    – Syed
    Sep 28, 2021 at 12:59
  • $\begingroup$ @Syed In my comment, I wrote I don't want to do this: Evaluate[Discr /. {{x -> 0}, {y -> 0}}] because this returns {0,0}. Read my note. Thank you very much for your response. I appreciate. The output which I want is just 0. $\endgroup$ Sep 28, 2021 at 14:26
  • $\begingroup$ Aman, then you need to define your function not to output {x,y}, but instead whatever it is that you want. $\endgroup$ Sep 28, 2021 at 14:29
  • $\begingroup$ Also there's no need to delete this answer. This will help others to know that this is not what I am looking for :) $\endgroup$ Sep 28, 2021 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.