Robert Israel

6577 Reputation

21 Badges

18 years, 210 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are answers submitted by Robert Israel

The bug can be seen here:
> f := Sum(a[m]*sin(m*x),m=1..2);
  int(f^2, x);
1/4*Pi^(1/2)*Sum(Sum(a[m]^2/m*(2/Pi^(1/2)*x*m-1/Pi^(1/2)*sin(2*m*x)),m = 1 .. 2),m = 1 .. 2)
> normal(value(%));
a[1]^2*x-1/2*a[1]^2*sin(2*x)+a[2]^2*x-1/4*a[2]^2*sin(4*x) This is completely wrong. The correct answer:
> int(value(f)^2,x);
1/2*a[1]^2*x-1/4*a[1]^2*sin(2*x)+a[1]*a[2]*sin(x)-1/3*a[1]*a[2]*sin(3*x)+1/2*a[2]^2*x-1/8*a[2]^2*sin(4*x)
You can't use R(x) in the ODE, because that calls R with the symbolic variable x, which doesn't work. There are at least three possible solutions: 1) use a piecewise expression instead of a procedure 2) make your procedure return unevaluated if called with a symbolic argument 3) use the syntax dsolve(numeric, procopts, options) as described on the help page ?dsolve,numeric,IVP. However, I'm afraid your R(x) does not make sense. It isn't really a function of the current x value, since it uses and changes the global variables xLast and RLast. It also seems to be assuming that the differential equation will be solved by the Euler method, in which R(x(t)) would be evaluated at successive times t separated by a given step size. That's certainly not the case (unless you specify method = classical[foreuler]). I think you need to rewrite your differential equation so that it really is a differential equation (or maybe a system of differential equations for x and R).
The basic problem, I think, is that 0^n in Maple gives 0 if n is non-constant (although 0.^n does not, I think somewhere in sum it gets "simplified"). There have been complaints about this forever, but it's been around for so long and is so deeply embedded in Maple that I doubt it's going to get changed any time soon.
I think the question is asking you to find a line that is tangent to the curve at two different points. The straightforward way to do this is to write down the equations that say the line y = a*x+b is tangent to the curve y=f(x) at the two points x=x1 and x=x2, then solve these (four equations in four unknowns).
I'm confused by the question. As I understand it, Chebyshev and minimax approximation don't fit a curve to data: they take a function on an interval and give you a polynomial that approximates it.
Did you try using the hint? s[m] is supposed to be the partial sum Sum(1/((2*n-1)*(2*n+1)),n=1..m) What is s[0]? If s[k] is what it is supposed to be, what about s[k+1]?
You might try csum in my Maple Advisor Database, <http://www.math.ubc.ca/~israel/advisor>
Why don't you show us the code you tried, and we can tell you what you're doing wrong? That way you'll probably learn much more than if we just gave you a solution to the problem.
Muqing, your method of calculating a(n) was fine, assuming it was preceded by
> a(1):= 0.8:
I don't know why Joe wanted to rewrite a as a procedure. To plot it, you could use
> plot([seq]([n,a(n)],n=1..300), style=point);
The variables to be solved for should be a set {x,y}. But I think you want to solve a system of equations, not just one.
> solve({eq, implicitdiff(eq,y,x)=0},{y,x});
The result is rather nasty.
> A:= [allvalues(%)];
  A:= remove(t -> has(evalf(t),I), A);
  evalf(A);
[{x = .2468133195, y = -1.822588871}, {x = 2.767390976, y = -2.272974359}, {x = -.2142615902, y = 1.841151390}, {x = -3.847625641, y = -3.441316555}]
The error message is correct: you gave Maple one equation in two unknowns x and b, not a system of equations. To get a solution, you need another equation. If you want the place where they "touch each other", i.e. the curves y = o(x) and y = p(x) are tangent, then you want the derivatives to be equal as well.
> fsolve({p(x)=o(x), D(p)(x)=D(o)(x)},{x,b});
{b = 1.444667861, x = 2.718281828}
Unfortunately you didn't say exactly what you did to get that picture, and didn't even include the actual PostScript file. Here's what I would do to get something like this picture:
> P:= plot3d([3+2*cos(u),v,2*sin(u)],u=0..2*Pi,v=0..2*Pi,
   coords=cylindrical,scaling=constrained,colour=black,
   style=hidden,orientation=[0,70]): 
 plotsetup(ps,plotoutput="torus.ps", plotoptions =
   "portrait,noborder,height=2in,width=3in,leftmargin=0in,
   bottommargin=0in"); 
 P; plotsetup(default);
I've uploaded the results from doing this in Standard and Classic interfaces. Download 4541_standard.ps
View file details Download 4541_classic.ps
View file details I don't know what to do about those faint diagonal lines in Standard; it's a bug. Note also that Standard seems to have ignored the plotoptions string: it has put a border around the plot, and made the Bounding Box 20 118 575 673 which means the dimensions are (I think) 7.7 by 7.7 inches, with a bottom margin of about 1.6 inches. These are also bugs. The Classic result looks much like what you got in Maple V. Unfortunately Classic isn't available on the Mac. Can you use command-line Maple on the Mac? What does the result look like there?
The problem, I think, is that you've got too many boundary conditions. You have two dependent variables, and both are first order in x, so you should need only two boundary conditions to uniquely specify a solution, and you have four. It would work fine with, e.g.,
> cond :=  ro(x, 0) = 0, v(x, 0) = 0, ro(0, t) = 10,  v(40, t) = 20;
For your question on recurrence equations, perhaps you could use this:
> something:= proc(eq,v)
    local a, b, i, j;
    a:= map(op, indets(eq, specfunc(anything,v)));
    max(seq(seq(i-j, i=a), j = a));
  end proc;
Like most Maple commands, "plot" evaluates its arguments first. So
> plot(test(pressure,1), pressure = 1 .. 3);
starts by calling test(pressure,1), with "pressure" as a symbolic variable. Thus "Force" is not assigned a numeric value, it is assigned the symbolic value "pressure". There are several ways to avoid this problem. One is to plot a procedure rather than an expression:
> plot(rcurry(test,1), 1 .. 3);
First 121 122 123 124 125 126 127 Last Page 123 of 138