Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Quick Question

...Did you intend I_L and i_L to be distinct? did you intend D and d to be distinct? how about v_C and V_C? In Sage, the capitalization matter, and these would be treated as distinct.

Solution

Assuming that you wanted them to be distinct, the following will work:

var("D I_L Ron d i_L V_g v_g V_C n v_C")

f = -DI_LRon - I_LRond - DRoni_L - Rondi_L + DV_g + V_gd + Dv_g + dv_g + DV_C/n + V_Cd/n + Dv_C/n + dv_C/n - V_C/n - v_C/n

print "Before:"

print f

print "After:"

print f(i_L=0, d=0, v_g=0, v_C=0)

Output

Before:

-DI_LRon - I_LRond - DRoni_L - Rondi_L + DV_g + V_gd + Dv_g + dv_g + DV_C/n + V_Cd/n + Dv_C/n + dv_C/n - V_C/n - v_C/n

After:

-DI_LRon + DV_g + DV_C/n - V_C/n