remove dependencies inside function?



I thought that maybe the function diff1 could be simplified to something like

  (%i1) diff1(e,y,x) := funmake(nounify('diff),[y,x]) = -diff(e,x)/diff(e,y)$

And that seems work:

  (%i2) diff1(x^4+x*y+y^5,y,x);
  (%o2) 'diff(y,x,1)=(-y-4*x^3)/(5*y^4+x)

But if y depends on x--oops:

  (%i3) depends(y,x)$

  (%i4) diff1(x^4+x*y+y^5,y,x);
  (%o4) 'diff(y,x,1)=(-5*y^4*('diff(y,x,1))-x*('diff(y,x,1))-y-4*x^3)/(5*y^4+x)

I suppose there are ways around this...The context mechanism doesn't help--dependencies aren't facts.
I don't know of a way to tell diff to ignore dependencies.

--Barton
________________________________
From: maxima-bounces at math.utexas.edu [maxima-bounces at math.utexas.edu] on behalf of Stavros Macrakis [macrakis at alum.mit.edu]
Sent: Tuesday, October 02, 2012 15:59
To: Edwin Woollett
Cc: maxima mailing list; ivo.welch at gmail.com
Subject: Re: [Maxima] remove dependencies inside function?

Per documentation, 'remove' quotes its arguments, thus perhaps making it slightly easier to use interactively,  and definitely making it annoying to use programmatically.

The workaround:

       apply('remove, [ ydep , 'dependency ] )



On Tue, Oct 2, 2012 at 4:51 PM, Edwin Woollett <woollett at charter.net<mailto:woollett at charter.net>> wrote:
I am trying to define diff1(expr, u,z) with a block
function which declares inside the function that u
depends on z, and after the needed work, tries to remove
that dependency, also inside the block.

The function definition is applied to the example
submitted to the list by Ivo Welch in the thread:
[1] enter (in console) ; [2] implicit functions
using the depends method of Jaime Villate.

remove does not work with the following def:
(using xmaxima and ver. 5.28.0)
----------------------------------

(%i1) display2d:false$

(%i2) dependencies;
(%o2) []

(%i3) diff1(expr,ydep,xindep) :=
block([dexpr],
  depends(ydep,xindep),
  dexpr : diff(expr,xindep),
  remove (ydep, dependency),
  solve (dexpr, diff (ydep,xindep)))$

(%i4) diff1(y+log(y)+x,y,x);

(%o4) ['diff(y,x,1) = -y/(y+1)]

(%i5) dependencies;

(%o5) [y(x)]

(%i6) remove (y, dependency);
(%o6) done

(%i7) dependencies;
(%o7) []
-----------------------------

Ted Woollett


_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu<mailto:Maxima at math.utexas.edu>
http://www.math.utexas.edu/mailman/listinfo/maxima