2
$\begingroup$

I have a list of equations. Some of them are algebraic equations like 2x == y / (y+1), others contains derivatives in them(e.x. df/dx == 0). Note they are not differential equations. As they can be simplified from other algebraic equations before taking the (partial) derivative. After taking the partial derivative, they will all be algebraic equations themselves. For example, I have the following three equations:

x^2 + y = 8
z = 9x + 4y
dz/dx = 0

After replacing y with 8 - x^2. dz/dx is 9-8x. Letting 9-8x equals to 0 we get x = 9/8, hence the solution.

My question is how to do this in Mathematica? In reality, I have dozens of equations like that, it's possible to solve manually, but I need to learn this skill to solve using software, if it's possible.

$\endgroup$

1 Answer 1

1
$\begingroup$

One possibility is to use Dt on your equations:

eq1 = x^2 + y == 0;
eq2 = z == 9 x + 4 y;

Solve[
    {
    eq1, Dt[eq1, x],
    eq2, Dt[eq2, x],
    Dt[z,x]==0
    },
    {x,y,z,Dt[y,x],Dt[z,x]}
]

{{x -> 9/8, y -> -(81/64), z -> 81/16, Dt[y, x] -> -(9/4), Dt[z, x] -> 0}}

$\endgroup$
3
  • $\begingroup$ Thanks! Can you elaborate a little bit? What are eq1 and eq2? Where are the other equations(z = 9x + 4y, etc)? $\endgroup$
    – luanjunyi
    Feb 14, 2018 at 20:42
  • $\begingroup$ @luanjunyi eq1 = x^2 + y == 8; eq2 = z == 9 x + 4 y;. That's just saving the equations to be solved for to variables so that they can be referenced more easily. $\endgroup$
    – eyorble
    Feb 14, 2018 at 20:53
  • $\begingroup$ @luanjunyi Sorry, I forgot to copy some of the code. Should be clearer now. $\endgroup$
    – Carl Woll
    Feb 14, 2018 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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