4
$\begingroup$
Clear[id, kn, vt, vdd, vo];
id = kn*(vi - vt)^2/2;
vo = vdd - id*rd;
Solve[D[vo, vi] == -1, vi]

Output:

{{vi->(1+kn rd vt)/(kn rd)}}

I want to simplify the result with vx=1/(kn*rd). It should be vx+vt. So how to replace with kn*rd with 1/vx?

I try:

Simplify[vi /. Solve[D[vo, vi] == -1, vi][[1]], kn rd == 1/vx]

The result is:

1/(kn rd) + vt

Not vx+vt.

The version is 12.0.0.0.

$\endgroup$
5
  • $\begingroup$ Just type Simplify[vi /. Solve[D[vo, vi] == -1, vi][[1]], {kn rd == vx}] gives vt+1/vx (not as you said vx+vt $\endgroup$
    – Nasser
    Sep 13, 2022 at 3:54
  • $\begingroup$ What $Version of Mathematica are you using? $\endgroup$
    – Syed
    Sep 13, 2022 at 3:56
  • $\begingroup$ @Nasser The condition is vx=1/(kn*rd),different from kn rd == vx. $\endgroup$
    – cvgmt
    Sep 13, 2022 at 4:31
  • $\begingroup$ @cvgmt They wrote So how to replace with kn*rd with vx ? And that is what I used. I did not use the code they had. But what they wrote before it. May be that was a typo then. $\endgroup$
    – Nasser
    Sep 13, 2022 at 4:34
  • $\begingroup$ @cvgmt It's a typo. I edited it. $\endgroup$
    – Tokubara
    Sep 13, 2022 at 14:25

3 Answers 3

7
$\begingroup$

Using Eliminate:

ToRules@Reverse@Eliminate[{vx == 1/(kn*rd), D[vo, vi] == -1}, {kn, rd}]
(*{vi -> vt + vx}*)
$\endgroup$
1
  • 1
    $\begingroup$ Or maybe Solve[Eliminate[{vx == 1/(kn*rd), D[vo, vi] == -1}, {kn, rd}] , vi]. $\endgroup$
    – Tokubara
    Sep 13, 2022 at 14:21
5
$\begingroup$

Also does give the result 1/(kn rd) + vt instead of vx+vt in Win 11, 13.1 version.

Maybe use another way.

Clear[id, kn, vt, vdd, vo];
id = kn*(vi - vt)^2/2;
vo = vdd - id*rd;
Reduce[{D[vo, vi] == -1, vx == 1/(kn*rd)}, {vi}]
% // Last

rd vx != 0 && kn == 1/(rd vx) && vi == vt + vx.

vi == vt + vx

Or

Solve[{D[vo, vi] == -1, vx == 1/(kn*rd)}, {vi}, {rd}]

{{vi -> vt + vx}}

$\endgroup$
3
$\begingroup$

There are already some excellent answers, but I don't see why not using a replacement rule

id = kn*(vi - vt)^2/2;
vo = vdd - id*rd;
Solve[D[vo, vi] == -1, vi]

and then

Simplify[vi /. Solve[D[vo, vi] == -1, vi]] /. 1/(kn rd) :> vx // First

vt + vx

$\endgroup$
2
  • $\begingroup$ Simplify[vi /. Solve[D[vo, vi] == -1, vi]] /. 1/(kn rd) :> vx // First does work, but Simplify[vi /. Solve[D[vo, vi] == -1, vi]] /. (kn rd) :> 1/vx // First doesn't, the result is 1/(kn rd)+vt. $\endgroup$
    – Tokubara
    Sep 13, 2022 at 14:18
  • $\begingroup$ @Tokubara hi, thanks for your comment. you can try the alternative First@Simplify[vi /. Solve[D[vo, vi] == -1, vi]] /. kn :> 1/(rd vx) which works, right? $\endgroup$
    – bmf
    Sep 13, 2022 at 15:44

Your Answer

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

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