Robert Israel

6542 Reputation

21 Badges

17 years, 172 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity

These are answers submitted by Robert Israel

Try the Student[Calculus1] package, in particular the IntTutor command. By the way, you should use exp(x) rather than e^x. Cheers, Robert
What inequal does is to make a big rectangle in the "feasible" colour, and then overlay that with polygons in the "excluded colour", one for each inequality. So what you see as "feasible" is whatever hasn't been covered by any of the "excluded" polygons. Showing two feasible regions would be difficult with this approach, except in special cases where tricks like those Thomas mentioned can be used. A better way might be to get the feasible regions as polygons. This can be done as follows: > PlotFeasibleRegion:= proc(S::{set(`<=`), list(`<=`)}, xr:: name = range, yr:: name = range) # S is a set or list of non-strict inequalities # xr and yr of the form x = a..b, y = c..d # where x and y are the axis variables # The usual plot options, such as colour=..., can be specified # after these local SS, pts, i, j, n, x, y, a, b, c, d, R; x:= lhs(xr); y:= lhs(yr); a:= op(1,rhs(xr)); b:= op(2,rhs(xr)); c:= op(1,rhs(yr)); d:= op(2,rhs(yr)); SS:= convert(S,set) union {x >= a, x <= b, y >= c, y <= d}; n:= nops(SS); pts:= {seq(seq(solve({convert(SS[i], equality), convert(SS[j], equality)}), j=i+1 .. n), i=1..n-1)}; pts:= select(type,pts,set(name=realcons)); pts:= select(p -> andmap(is,subs(p,SS)), pts); pts:= map(subs, pts, [x,y]); R:=indets(simplex[convexhull](pts,output=plot), specfunc(anything,POLYGONS)); if R = {} then return NULL end if; plots[polygonplot](op([1,1],R),args[4..-1]) end proc; So for example: plots[display]( PlotFeasibleRegion({x+y >= 1.5}, x=0..1, y=0..1, colour=red), PlotFeasibleRegion({x+y <= 0.5}, x=0..1, y=0..1, colour=blue), scaling=constrained); In doing it this way, where the two feasible regions overlap the first overwrites the second. But you could start with a PlotFeasibleRegion command for the union of the two sets of constraints, giving the intersection of the feasible regions, e.g.: ineqs1:= {x+y>=1, x+y <= 3, x - y >= -1, x - y <= 1}: ineqs2:= {x+y>=2, x+y <= 4, x - y >= 0, x - y <= 2}: plots[display]( PlotFeasibleRegion(ineqs1 union ineqs2, x=0..5,y=0..3,colour=red), PlotFeasibleRegion(ineqs1,x=0..5,y=0..3,colour=blue), PlotFeasibleRegion(ineqs2,x=0..5,y=0..3,colour=green), scaling=constrained);
Another thing you can do with this is listen to it. I'll have to increase the frequencies, of course, to make the lower frequencies audible. The fundamental will be 40 hertz, so the highest frequency is 3000. In a one-second recording we thus want to go up to x = 80*Pi. > pfun:= unapply(pAll,x); with(AudioTools): A:= Create(duration = 1.0); # for a one-second recording jmax:= op(2,ArrayDims(A)); for j from 1 to jmax do A[j]:= evalhf(pfun(j*80*Pi/jmax)) end do: Write("c:/mypath/pAll.wav"); # change the path as desired And then play the resulting .wav file with your favourite music player. Not that it's very musical...
You might try something like this: op(select(is,[solve(P,x)],positive)); This should work if "is" can determine which roots are positive. It might not work for a cubic with three real irrational roots, where the positive root is expressed as an expression involving i that is not obviously real. In such a case you might try op(select(t -> (simplify(fnormal(evalf(t)),zero) > 0), [solve(P,x)]));
Perhaps what Ognjen means is that the Maple code typically consists mostly of calls to other Maple procedures. To see the real code, you have to look at those other procedures. This can be done as well (unless those procedures are built-in or external). For example, if you look at the code for plot in Maple 10, what you see mainly checks the various options and eventually calls another procedure such as `plot/adaptive` to do the real work. You can then look at the code for that procedure: showstat(`plot/adaptive`); Note that for packages implemented as modules, you may need kernelopts(opaquemodules = false); so that you can see the code for procedures in the module that are not exported. One thing that rather seriously reduces the value of looking at Maple code, though, is the lack of comments. For anything that isn't completely straightforward, it can be very hard to figure out what's going on.
If x is the variable that must take values 6.00, 6.01 etc, probably the simplest way is for x from 6.0 to 8.0 by 0.01 do ... end do;
If I understand you correctly, what you're really trying to do is change the differential equation for B(t), to not let it increase past 400. So if the original DE is diff(B(t),t) = f(t,B(t),N(t),W(t)) you want something like diff(B(t),t) = piecewise( B(t) <= 0, max(0, f(t,B(t),N(t),W(t))), B(t) <400, f(t,B(t),N(t),W(t)), min(0, f(t,B(t),N(t),W(t)))) Cheers, Robert
Try this (Maple 11, Standard GUI): > plot(cos(x),x=0..2*Pi,xtickmarks=[seq(i/2*Pi=i/2*Pi,i=1..4)]); Cheers, Robert
First 136 137 138 Page 138 of 138