# How to use Assuming and With together

(I am sorry for the ASCII form, I use the free WolframEngine which works in text mode.)

I have these assumptions vF0 > 0 && vR0 > 0 && bFx > 0 && rho > 0 && aRx > 0 && bRx > 0 && bFx > bRx && t > 0, this substitution (i.e. scope) bRis = 100 and this equation (1/2)*((- 1*aRx*(rho^2))+(-1*bRim*bRx*(rho^2))+(2*aRx*rho*t)+(2*bRim*bRx*rho*t)+(-1*bRim*bRx*(t^2))+(2*t*vR0))==bRis. All values are real. I want to find the equation for t. Without the assumptions and the scoping,

Solve[(1/2)*((-1*aRx*(rho^2))+(-1*bRim*bRx*(rho^2))+(2*aRx*rho*t)+(2*bRim*bRx*rho*t)+(-1*bRim*bRx*(t^2))+(2*t*vR0))==bRis, t]


produces two solutions:

t = (aRx rho + bRim bRx rho + vR0 +- Sqrt[-2 bRim bRis bRx + aRx  rho  + aRx bRim bRx rho  + 2 aRx rho vR0 +

2
2 bRim bRx rho vR0 + vR0 ]) / (bRim bRx)


I am not sure if both are correct, given the assumptions and the scope. This in turn, which lacks only the scope,

Assuming[vF0 > 0 && vR0 > 0 && bFx > 0 && rho > 0 && aRx > 0 && bRx > 0 && bFx > bRx && t > 0, Solve[(1/2)*((-1*aRx*(rho^2))+(-
1*bRim*bRx*(rho^2))+(2*aRx*rho*t)+(2*bRim*bRx*rho*t)+(-1*bRim*bRx*(t^2))+(2*t*vR0))==bRis, t]]


produces no solutions, which I would find surprising (increasing $$\rho$$ in the pair of solutions above should eventually assure that both the square root argument and $$t$$ are positive).

How to use at once assumptions (Assumptions?) and scope (With?) with Solve and limit the solution to the real domain?

assumptions =
vF0 > 0 && vR0 > 0 && bFx > 0 && rho > 0 && aRx > 0 && bRx > 0 &&
bFx > bRx && t > 0;
With[
{bRis = 100},
Assuming[
assumptions,
Solve[(1/
2)*((-1*aRx*(rho^2)) + (-1*bRim*bRx*(rho^2)) + (2*aRx*rho*
t) + (2*bRim*bRx*rho*t) + (-1*bRim*bRx*(t^2)) + (2*t*vR0)) ==
bRis, t, Reals]
]
]


Gives me

{{t -> ConditionalExpression[(aRx rho + bRim bRx rho + vR0)/(
bRim bRx) -
Sqrt[-200 bRim bRx + aRx^2 rho^2 + aRx bRim bRx rho^2 +
2 aRx rho vR0 + 2 bRim bRx rho vR0 + vR0^2]/(
bRx Abs[bRim]), (bFx >
bRx && (-aRx^2 rho^2 - 2 aRx rho vR0 - vR0^2)/(-200 bRx +
aRx bRx rho^2 + 2 bRx rho vR0) < bRim < (-200 - aRx rho^2)/(
bRx rho^2) && 100/vR0 < rho < 200/vR0) || (bFx > bRx &&
aRx > (200 - 2 rho vR0)/rho^2 && bRim > 0 &&
rho < 100/vR0) || (bFx > bRx && aRx > (200 - 2 rho vR0)/rho^2 &&
rho < 100/
vR0 && (-aRx^2 rho^2 - 2 aRx rho vR0 - vR0^2)/(-200 bRx +
aRx bRx rho^2 + 2 bRx rho vR0) < bRim < (-200 - aRx rho^2)/(
bRx rho^2)) || (bFx > bRx && bRim > 0 &&
rho > 200/vR0) || (bFx > bRx && bRim > 0 &&
100/vR0 < rho < 200/vR0) || (bFx > bRx && rho < 100/vR0 &&
aRx < (200 - 2 rho vR0)/rho^2 &&
0 < bRim < (-aRx^2 rho^2 - 2 aRx rho vR0 - vR0^2)/(-200 bRx +
aRx bRx rho^2 + 2 bRx rho vR0)) || (bFx > bRx &&
rho < 100/vR0 && aRx < (200 - 2 rho vR0)/rho^2 &&
bRim < (-200 - aRx rho^2)/(bRx rho^2))]}, {t ->
ConditionalExpression[(aRx rho + bRim bRx rho + vR0)/(bRim bRx) +
Sqrt[-200 bRim bRx + aRx^2 rho^2 + aRx bRim bRx rho^2 +
2 aRx rho vR0 + 2 bRim bRx rho vR0 + vR0^2]/(
bRx Abs[bRim]), (bFx > bRx &&
rho > 200/vR0 && (-200 - aRx rho^2)/(bRx rho^2) < bRim <
0) || (bFx > bRx && (-200 - aRx rho^2)/(bRx rho^2) < bRim <
0 && 100/vR0 < rho < 200/vR0) || (bFx >
bRx && (-aRx^2 rho^2 - 2 aRx rho vR0 - vR0^2)/(-200 bRx +
aRx bRx rho^2 + 2 bRx rho vR0) < bRim < (-200 - aRx rho^2)/(
bRx rho^2) && 100/vR0 < rho < 200/vR0) || (bFx > bRx &&
aRx > (200 - 2 rho vR0)/rho^2 && bRim > 0 &&
rho < 100/vR0) || (bFx > bRx && aRx > (200 - 2 rho vR0)/rho^2 &&
rho < 100/vR0 && (-200 - aRx rho^2)/(bRx rho^2) < bRim <
0) || (bFx > bRx && aRx > (200 - 2 rho vR0)/rho^2 &&
rho < 100/
vR0 && (-aRx^2 rho^2 - 2 aRx rho vR0 - vR0^2)/(-200 bRx +
aRx bRx rho^2 + 2 bRx rho vR0) < bRim < (-200 - aRx rho^2)/(
bRx rho^2)) || (bFx > bRx && bRim > 0 &&
rho > 200/vR0) || (bFx > bRx && bRim > 0 &&
100/vR0 < rho < 200/vR0) || (bFx > bRx && rho < 100/vR0 &&
aRx < (200 - 2 rho vR0)/rho^2 &&
0 < bRim < (-aRx^2 rho^2 - 2 aRx rho vR0 - vR0^2)/(-200 bRx +
aRx bRx rho^2 + 2 bRx rho vR0)) || (bFx > bRx &&
rho < 100/vR0 &&
aRx < (200 - 2 rho vR0)/rho^2 && (-200 - aRx rho^2)/(
bRx rho^2) < bRim < 0) || (bFx > bRx && rho < 100/vR0 &&
aRx < (200 - 2 rho vR0)/rho^2 &&
bRim < (-200 - aRx rho^2)/(bRx rho^2))]


• I added to the question the two solutions obtained without the assumptions and the scope. I would guess (only guess) that adding the assumptions and scope would remove one of these two, and not produce something much more complex. Oct 27, 2022 at 14:10
• Is there meant to be a restriction on bRim ? Oct 27, 2022 at 14:24
• I analysed the solution in your answer and it is in fact the same thing, only that there are some long conditions on the sign in front of the square root. I will try to add some additional assumptions to see if these conditions can be avoided. Oct 27, 2022 at 14:34
• It can be assumed for simplicity that 0 < bRim < 1. Oct 27, 2022 at 14:35
• Also, max time can be limited t<=((bRx^-1)*((bRit*bRx)+(-1*bRim*bRit*bRx)+(aRx*rho)+(bRx*rho)+vR0)) Oct 27, 2022 at 14:39