Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Storing the positive solution only of a quadratic in a variable

Hi everyone, I am quite new to Sagemath, and I have the following problem:

DPi_R_D_R_AI = (Pistar_R_D - Pistar_R_AI).simplify_full()

Is a quadratic function of c (or, a parabola).

I need to find the positive roots only, and I know that the only positive root is the one with the "+" sign (it is a parametric function), and I need to store this root in a variable.

Problem: when I try

c_prof = solve(DPi_R_D_R_AI == 0,c)[0].rhs()

Sagemath only displays the negative root! I tried to have a look at this post, but I don't have a "number" I can exploit: c>= means nothing for Sagemath...

How should I approach this?

Thanks for the attention,

Matteo

Storing the positive solution only of a quadratic in a variable

Hi everyone, I am quite new to Sagemath, and I have the following problem:

DPi_R_D_R_AI = (Pistar_R_D - Pistar_R_AI).simplify_full()

Is a quadratic function of c (or, a parabola).

I need to find the positive roots only, and I know that the only positive root is the one with the "+" sign (it is a parametric function), and I need to store this root in a variable.

Problem: when I try

c_prof = solve(DPi_R_D_R_AI == 0,c)[0].rhs()

Sagemath only displays the negative root! I tried to have a look at this post, but I don't have a "number" I can exploit: c>= c>=0 means nothing for Sagemath...

How should I approach this?

Thanks for the attention,

Matteo