ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 18 May 2020 19:24:11 +0200Substitutionhttps://ask.sagemath.org/question/51446/substitution/After some calculation I arrive to the following equation $\frac{D*p - D+ I}{D*(P-1)}$.
Whichever be the command I use I cannot put it as $\frac{D*(p - 1)+ I}{D*(P-1)}$ or as $1-\frac{I}{D*(P-1)}$ or $1-\frac{I}{D}\frac{1}{(P-1)}$.
This last equation is the one of interest since I would like to solve $1-\frac{I}{D}\frac{1}{(P-1)}==0$ according to $\frac{D}{I}$.
Is there a way to use `solve()` acording to $\frac{D}{I}$ ? I have tried to substitue `x` with a form of `substitute()`for it, but it was an echec. I understand that substitue a ratio of 2 variables for one is a little bit complex.Mon, 18 May 2020 15:10:50 +0200https://ask.sagemath.org/question/51446/substitution/Answer by tmonteil for <p>After some calculation I arrive to the following equation $\frac{D<em>p - D+ I}{D</em>(P-1)}$.</p>
<p>Whichever be the command I use I cannot put it as $\frac{D<em>(p - 1)+ I}{D</em>(P-1)}$ or as $1-\frac{I}{D*(P-1)}$ or $1-\frac{I}{D}\frac{1}{(P-1)}$.</p>
<p>This last equation is the one of interest since I would like to solve $1-\frac{I}{D}\frac{1}{(P-1)}==0$ according to $\frac{D}{I}$.</p>
<p>Is there a way to use <code>solve()</code> acording to $\frac{D}{I}$ ? I have tried to substitue <code>x</code> with a form of <code>substitute()</code>for it, but it was an echec. I understand that substitue a ratio of 2 variables for one is a little bit complex.</p>
https://ask.sagemath.org/question/51446/substitution/?answer=51448#post-id-51448You can add a new variable to model `D/I` and solve a system of equations :
sage: var('D,P,I,z')
sage: e = (D*P - D + I)/(D*(P - 1))
sage: e
(D*p - D + I)/(D*(P - 1))
sage: solve([e == 0, z == D/I], z, D)
[[z == -1/(P - 1), D == -I/(P - 1)]]Mon, 18 May 2020 19:09:30 +0200https://ask.sagemath.org/question/51446/substitution/?answer=51448#post-id-51448Comment by Cyrille for <p>You can add a new variable to model <code>D/I</code> and solve a system of equations :</p>
<pre><code>sage: var('D,P,I,z')
sage: e = (D*P - D + I)/(D*(P - 1))
sage: e
(D*p - D + I)/(D*(P - 1))
sage: solve([e == 0, z == D/I], z, D)
[[z == -1/(P - 1), D == -I/(P - 1)]]
</code></pre>
https://ask.sagemath.org/question/51446/substitution/?comment=51451#post-id-51451Thank tmonteil. When I read your solution I feel stupid. This is so simple.Mon, 18 May 2020 19:24:11 +0200https://ask.sagemath.org/question/51446/substitution/?comment=51451#post-id-51451