Hi,
I have written a simple program that uses the isolate command to solve integrals of the following form. I want to
extend it to handle more complex expressions of different types and need to know how to tell how many temporary
variables were created by isolate. It could have a different expression it may be trying to isolate although in this
case it is hard coded but in general it would possibly not be diracdelta and instead be unit_step or something else. It
could appear in more than one place too. I can't see a way to tell the names and the count of the %tx variables
created. Can someone help, please? Also I really hope I don't have to do a kill(labels) in the program, is there a
better way? If I don't kill(labels) then the numbers are unpredictable and depend on how many commands were entered
prior to execution.
Thanks,
Rich
(%i1) g:integrate(diracdelta(x-4)*(x^2+x^3*a+x)^2/(x^4-7)*sin(x),x,3,45);
(eq1) integrate(((a*x^3+x^2+x)^2*diracdelta(x-4)*sin(x))/(x^4-7),x,3,45)
(%i2) f(h,x):=block(
kill(labels),
partswitch:true,
isolate(h,diracdelta),
t1:ev(%t1),t2:ev(%t2),
if freeof(diracdelta,t2) and -part(%t1,2) >= part(h,3) and -part(%t1,2) <= part(h,4)
then ev(t2,x=-part(%t1,2))
elseif freeof(diracdelta,t1) and -part(%t2,2) >= part(h,3) and -part(%t2,2) <= part(h,4)
then ev(t1,x=-part(%t2,2))
else 0
)$
(%i3) f(g,x);
(%t1) x-4
(%t2) ((a*x^3+x^2+x)^2*sin(x))/(x^4-7)
(eq2) (sin(4)*(64*a+20)^2)/249