Robert Israel

6447 Reputation

21 Badges

15 years, 137 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

@sara_ph : Nobody is kidding anybody.  I was (and am still) not sure what you wanted Maple to do.  Do you mean something like this?
This will produce a numerical approximation of the integral for any values of the parameters.

> B:= unapply(Student[Calculus1][ApproximateInt](f(r,z,teta), teta=0 .. 0.78, method=simpson, partition=100), r, z):

Then:

> B(2,3);

 

@sara_ph : Nobody is kidding anybody.  I was (and am still) not sure what you wanted Maple to do.  Do you mean something like this?
This will produce a numerical approximation of the integral for any values of the parameters.

> B:= unapply(Student[Calculus1][ApproximateInt](f(r,z,teta), teta=0 .. 0.78, method=simpson, partition=100), r, z):

Then:

> B(2,3);

 

@trlewis : rather than rely on Maple to choose the interval for the vertical axis, you can do it yourself.  For example,

> plot(1/x, x = 0 .. 3, y = 0 .. 6);

@Markiyan Hirnyk : OK, good example: two completely separate ways to model the same physical phenomenon, one with MapleSim components and the other with a PDE.  In principle every MapleSim model can be described using a system of differential equations.  That doesn't mean that it will be, or that it should be.  

@Markiyan Hirnyk : OK, good example: two completely separate ways to model the same physical phenomenon, one with MapleSim components and the other with a PDE.  In principle every MapleSim model can be described using a system of differential equations.  That doesn't mean that it will be, or that it should be.  

@pagan : It says it's a MapleSim application.  So no, it's not Maple.  Maple and MapleSim are different, and there is likely to be no Maple "equivalent". 

@pagan : It says it's a MapleSim application.  So no, it's not Maple.  Maple and MapleSim are different, and there is likely to be no Maple "equivalent". 

It would be a better idea to make your procedure work no matter what global variables have been assigned values.  This is what local variables are for.  Just make x, xx etc local variables of your procedure. If you really need to use global variables, use some names that the users are unlikely to have used.

@tieuvodanh : By periodicity of sin, when X is uniform on an interval of length 2*Pi the distribution of Y = a*sin(X+theta)  doesn't depend on theta.  We may for simplicity take theta=0.  I'll also assume a>0.  Now -a <= Y <= a always.  If 0 <= y <= a, a*sin(x) <= y for -Pi <= x <= arcsin(y/a) or Pi - arcsin(y/a) <= x <= Pi.  If -a <= y <= 0, a*sin(x) <= y for
-Pi - arcsin(y/a) <= x <= arcsin(y/a). 

> cdf:= piecewise(y<=-a,0,y<=a, (Pi + 2*arcsin(y/a))/(2*Pi), 1);

> pdf:= diff(cdf, y);

@tieuvodanh : By periodicity of sin, when X is uniform on an interval of length 2*Pi the distribution of Y = a*sin(X+theta)  doesn't depend on theta.  We may for simplicity take theta=0.  I'll also assume a>0.  Now -a <= Y <= a always.  If 0 <= y <= a, a*sin(x) <= y for -Pi <= x <= arcsin(y/a) or Pi - arcsin(y/a) <= x <= Pi.  If -a <= y <= 0, a*sin(x) <= y for
-Pi - arcsin(y/a) <= x <= arcsin(y/a). 

> cdf:= piecewise(y<=-a,0,y<=a, (Pi + 2*arcsin(y/a))/(2*Pi), 1);

> pdf:= diff(cdf, y);

Since you re-opened this, I thought I'd take the opportunity to show how in Maple 15 the plottools:-getdata command removes the need to specify the view window.

> a:=plot(x^3-4*x,x=-3..3):
R:= plottools:-getdata(a)[2]:
b:= plottools:-rectangle(map2(op,1,R),map2(op,2,R),colour=black):
plots:-display(b,a,axis=[colour=green]);


Since you re-opened this, I thought I'd take the opportunity to show how in Maple 15 the plottools:-getdata command removes the need to specify the view window.

> a:=plot(x^3-4*x,x=-3..3):
R:= plottools:-getdata(a)[2]:
b:= plottools:-rectangle(map2(op,1,R),map2(op,2,R),colour=black):
plots:-display(b,a,axis=[colour=green]);


@Carlos Mallen : Evidently VariationalCalculus:-Convex works by taking the Hessian and calling IsDefinite.  So it's not going to be any better than doing that yourself.

One thing you can try, if the Hessian is a complicated function of several variables, is substituting random numerical values of those variables.  IsDefinite should work on the
results (although you might have to be careful about roundoff error).  If you find values for which the Hessian is not positive semidefinite, that settles the matter; if you try lots of values and always get a positive semidefinite Hessian, that may be taken as evidence (though of course not a proof) that it really is convex.

@Carlos Mallen : Evidently VariationalCalculus:-Convex works by taking the Hessian and calling IsDefinite.  So it's not going to be any better than doing that yourself.

One thing you can try, if the Hessian is a complicated function of several variables, is substituting random numerical values of those variables.  IsDefinite should work on the
results (although you might have to be careful about roundoff error).  If you find values for which the Hessian is not positive semidefinite, that settles the matter; if you try lots of values and always get a positive semidefinite Hessian, that may be taken as evidence (though of course not a proof) that it really is convex.

Yes, it would be very handy to have an "unstep" command.  Unfortunately, computers are not time-reversible: there's no way to go back to a previous state, unless you explicitly store that previous state (and storing every state automatically on the chance that you might want to go back there would eat up huge amounts of memory).  What you might be able to do, after seeing where stoperror takes you, is look at the code, set a convenient breakpoint some distance before that location, and then start again.  But it is tricky, especially in a case where the same piece of code is executed successfully 999 times and then produces an error the 1000'th time.

1 2 3 4 5 6 7 Last Page 2 of 187