Revision history [back]

Late binding and lazy symbolic thence numeric math

Being a newbie to Sage, after growing weary of wxMaxima, perhaps this is already supported but bear with me...

It seems the programming principle of "late binding" should apply, in particular, to systems in which numeric and symbolic math are seamlessly integrated.

For example, let's say I:

from scipy.constants import epsilon_0, c


...define an identity like:

mu_0*epsilon_0=1/c^2


...and then define a function, say, for the vector potential of a Hertzian dipole:

norm(x,y,z)=sqrt(x*x+y*y+z*z)
Idipole(t)=I0*cos(omega*t)
A(x,y,z,t)=[0,0,(1/(4*pi*epsilon_0*c^2)*L*Idipole(t-norm(x,y,z)/c)/norm(x,y,z))]


If (after defining other symbols) I then demand a numeric value, say, in a plot:

plot(A(0,0,z,0),z,1,4)


It should be able to, in service of this demand, lazily invoke an optimization by first solving for mu_0 thence symbolic simplification to:

A(x,y,z,t)=[0,0,(mu_0/(4*pi)*L*Idipole(t-norm(x,y,z)/c)/norm(x,y,z))]


...prior to substituting numeric values or other presumptive substitutions.

Is this kind of late binding with lazy symbolic thence numeric math supported by Sage?

Moreover,

Late binding and lazy symbolic thence numeric math

Being a newbie to Sage, after growing weary of wxMaxima, perhaps this is already supported but bear with me...

It seems the programming principle of "late binding" should apply, in particular, to systems in which numeric and symbolic math are seamlessly integrated.

For example, let's say I:

from scipy.constants import epsilon_0, c


...define an identity like:

mu_0*epsilon_0=1/c^2


...and then define a function, say, for the vector potential of a Hertzian dipole:

norm(x,y,z)=sqrt(x*x+y*y+z*z)
Idipole(t)=I0*cos(omega*t)
A(x,y,z,t)=[0,0,(1/(4*pi*epsilon_0*c^2)*L*Idipole(t-norm(x,y,z)/c)/norm(x,y,z))]


If (after defining other symbols) I then demand a numeric value, say, in a plot:

plot(A(0,0,z,0),z,1,4)


It should be able to, in service of this demand, lazily invoke an optimization by first solving for mu_0 thence symbolic simplification to:

A(x,y,z,t)=[0,0,(mu_0/(4*pi)*L*Idipole(t-norm(x,y,z)/c)/norm(x,y,z))]


...prior to substituting numeric values or other presumptive substitutions.

Is this kind of late binding with lazy symbolic thence numeric math supported by Sage?

Moreover,