[Aimmath-commit] AIM/WEB-INF/maple/aim Functions.mpl,1.3,1.4
Brought to you by:
gustav_delius,
npstrick
From: <gr...@us...> - 2004-01-09 05:13:33
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv21663 Modified Files: Functions.mpl Log Message: Added some enhancements. There is now `aim/Functions/ID/HasAsymptote` and a facility for including one's own properties for a function in `aim/Functions/ID/CheckList`. - GG Index: Functions.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Functions.mpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Functions.mpl 25 Aug 2003 21:47:19 -0000 1.3 --- Functions.mpl 9 Jan 2004 05:13:30 -0000 1.4 *************** *** 172,175 **** --- 172,196 ---- `Package/Assign`( + `aim/Functions/ID/HasAsymptote`, + "If @f@ has an asymptote at @x = a@ but @g@ does not (or <em>vice-versa</em>) + then return an explanatory message; otherwise return the empty string. + ", + proc(f,g,a) + `aim/Functions/ID/Check`(f,g, + proc(h,a) + type(limit(h, x = a, left), infinity) or + type(limit(h, x = a, right), infinity) + end, + proc(A,B,a) + sprintf( + "The function $%s$ has an asymptote at + $x = %s$, but the function $%s$ does not.", + A,`aim/LaTeX`(a),B); + end, + a) + end + ): + + `Package/Assign`( `aim/Functions/ID/Positive`, "If @f@ is positive at @x = a@ but @g@ is not (or <em>vice-versa</em>) *************** *** 366,370 **** other arguments). The argument @msg@ accepts two string parameters @A@ and @B@ (assumed to be descriptions of functions), and returns ! a string explaining that @A@ has the required property aand @B@ does not (always that way around). If the @chk@ function uses extra arguments, then the @msg@ function should accept them as well. --- 387,391 ---- other arguments). The argument @msg@ accepts two string parameters @A@ and @B@ (assumed to be descriptions of functions), and returns ! a string explaining that @A@ has the required property and @B@ does not (always that way around). If the @chk@ function uses extra arguments, then the @msg@ function should accept them as well. *************** *** 406,423 **** procedure will first check whether @f@ and @g@ take the value @2@ at @x = 1@, then whether @f@ and @g@ are continuous at @x = 0@, then ! whether @f@ and @g@ are bounded above on <b>R</b>. The procedure ! returns a string explaining the first discrepancy that it encounters ! between @f@ and @g@, or the empty string if it finds no discrepancy. ", proc(f,g,chklist) ! local c,p,m; ! for c in chklist do ! p := eval(cat(`aim/Functions/ID/`,c[1])); ! m := p(f,g,op(c[2..-1])); ! if m <> "" then RETURN(m); fi; od; ! RETURN(""); end ): --- 427,474 ---- procedure will first check whether @f@ and @g@ take the value @2@ at @x = 1@, then whether @f@ and @g@ are continuous at @x = 0@, then ! whether @f@ and @g@ are bounded above on <b>R</b>. If the optional ! 4th argument @mkvector@ is included, it should be a list of partial ! marks, one for each test in @chklist@, that should sum to 1. ! The procedure returns a string explaining the first discrepancy that ! it encounters between @f@ and @g@, or the empty string if it finds ! no discrepancy. If the procedure is called with the optional argument ! @mkvector@, then a mark which is the sum of the values assigned to ! each test passed is also returned. To take account of one-off special ! properties that a function may be required to have, @chklist@ may also ! contain an entry @['My',chk,msg]@ where @chk@ and @msg@ are functions ! conforming to the criteria of #`aim/Functions/ID/Check`#, i.e. @chk@ ! takes a function as argument and returns a boolean, and @msg@ takes two ! arguments (strings that represent @f@ and @g@) and returns a string ! explaining a discrepancy between @f@ and @g@ (in relation to @chk@). ", proc(f,g,chklist) ! local c,p,m,msg,mk,i,mkvector; ! msg := ""; ! mk := NULL; ! ! if nargs > 3 then ! mkvector := args[4]; ! mk := 0; ! fi; ! ! for i to nops(chklist) do ! c := chklist[i]; ! if c[1] = 'My' then ! m := (rcurry(`aim/Functions/ID/Check`, c[2], c[3]))(f, g); ! else ! p := eval(cat(`aim/Functions/ID/`,c[1])); ! m := p(f,g,op(c[2..-1])); ! fi; ! if m <> "" and nargs = 3 then ! return m; ! elif m = "" then ! mk := mk + mkvector[i]; ! elif msg = "" then ! msg := m; ! fi; od; ! return msg, mk; end ): |