Subject: Substituting values into differentiated function
From: Stavros Macrakis
Date: Wed, 15 Aug 2012 13:36:12 -0400
Comments in-line below.
On Wed, Aug 15, 2012 at 12:58 PM, Andrew Martin <mr.a.martin at gmail.com>wrote:
> Hi,
>
> I'm trying to reproduce the steps from this paper:
> http://www.doc.gold.ac.uk/~mas02mb/sdp/download/Myatt2004Convergence.pdf
>
> I can do the first few steps:
>
> 1) Define the function "g".
> g(c,a,b) := ((1-a)/a)*c+(1-b)*(1-(c/a));
>
> 2) Define the function "f".
> f(c,a,b) := a*(c+ g(c,a,b)*c);
>
> 3) Differentiate f with respect to c
> fWRTc(c,a,b) := diff(f(c,a,b),c);
>
> I'm not confident my syntax in step 3) is correct. If I type
> "fWRTc(0.1,0.8,0.1);" I get this error:
> > diff: second argument must be a variable; found 0.1
> > #0: fWRTc(c=0.1,a=0.8,b=0.1)"
>
> I think it's because it's substituting c=0.1 in diff(f(c,a,b),c) and
> so it's trying to differentiate with respect to 0.1.
>
Exactly right.
My problems are:
> 1) Displaying the result of diff(f(c,a,b),c) as a*(2-b) - 2*c*(a-b)
>
Getting a particular form of an expression can be difficult, especially
when the terms (as here) both involve the two variables a and b. Here's
one way
(%i9) diff(f(c,a,b),c);
(%o9) a*((1-b)*(1-c/a)+((1-a)/a-(1-b)/a)*c+((1-a)*c)/a+1)
(%i10) rat(%,c); <<< format as polynomial in c
(%o10)/R/ (2*b-2*a)*c-a*b+2*a
(%i11) substpart(factor(piece),%o10,[2,3]); <<< factor the sum of the
2nd and 3rd terms
(%o11) (2*b-2*a)*c-a*(b-2)
(%i12) map(factor,%);
(%o12) 2*(b-a)*c-a*(b-2)
> 2) The syntax for calculating a when c=0 and fWRTc(c,a,b) = 1.
>
Something like this:
(%i16) subst([c=0],%o12);
(%o16) -a*(b-2)
(%i17) %=1; <<< make an equation
(%o17) -a*(b-2)=1
(%i18) solve(%,a);
(%o18) [a=-1/(b-2)]
To calculate the value of the derivative at a certain value:
subst([c=.1,a=.8,b=.1],%o12);
Another way:
fWRTc(c0,a0,b0) := at(diff(f(c,a,b),c),[c=c0,a=a0,b=b0]);
fWRTc(.1,.8,.1);
In the linked paper they show that a = 1/(2-b) when df/dc = 1 and c = 0.
>
> Can you help me find the correct functions to display these results?
>
> Thank you,
>
> Andrew
>
> --
> Andrew Owen Martin
> PhD Cand. at Goldsmiths, University of London (ma901am)
> Investigating Enactivism with Sensory Substitution
> M: 07901 65 35 28
> http://aomartin.co.uk
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>