acer

32385 Reputation

29 Badges

19 years, 335 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Posting the same question in eight or so different forums here on mapleprimes may not endear you.

I posted two examples as a reply in another forum.

acer

Ok, so now there is no internal limit hit on the number of parameters that you pass, which is good. I did not know of a limit on the number of (integer?) parameters in so-called "wrapperless" external calling. Interesting.

The runtime exception that you see now might be something completely different, caused perhaps by any number of things, eg. not passing integers by reference when the C code expects it, calling convention issues (cdecl), something wrong in th code, etc, etc.

I've had generally good experiences with define_external and using the WRAPPER options to produce a C wrapper. I don't think that it's all broken.

But of course runtime exceptions can be hard to diagnose (especially from a distance). If you used the WRAPPER option then there should be a file named something like mwrap_myproc.c on you machine. That might help your diagnosis.

acer

Ok, so now there is no internal limit hit on the number of parameters that you pass, which is good. I did not know of a limit on the number of (integer?) parameters in so-called "wrapperless" external calling. Interesting.

The runtime exception that you see now might be something completely different, caused perhaps by any number of things, eg. not passing integers by reference when the C code expects it, calling convention issues (cdecl), something wrong in th code, etc, etc.

I've had generally good experiences with define_external and using the WRAPPER options to produce a C wrapper. I don't think that it's all broken.

But of course runtime exceptions can be hard to diagnose (especially from a distance). If you used the WRAPPER option then there should be a file named something like mwrap_myproc.c on you machine. That might help your diagnosis.

acer

I thought that Maximize/Minimize passed options through (here, to NLPSolve).

acer

The value x=0.68 returned from Optimization:-Maximize(y,x=0..1) is a local optimum. The graph of y, plot(y, x=0..1), shows that.

y := 3*cos(4*Pi*x-1.3)+5*cos(2*Pi*x+0.5);
plot(y, x=0..1);
Optimization:-Maximize(y,x=0..1,method=branchandbound);
plot(y, x=0..0.1);

acer

These two examples below work for me in Maple 8,

plot(surd(x,3),x=-2..2,thickness=3);
with(plots):
a:=1:
implicitplot(surd(x^2,3)+surd(y^2,3)=a^(2/3),x=-a..a,y=-a..a);

acer

These two examples below work for me in Maple 8,

plot(surd(x,3),x=-2..2,thickness=3);
with(plots):
a:=1:
implicitplot(surd(x^2,3)+surd(y^2,3)=a^(2/3),x=-a..a,y=-a..a);

acer

If you read the help-page root, you'll see that it  returns the "principal root", defined by the formula root(x,n) = exp(1/n * ln(x)). The help-page ?^ also summarizes this. In your example, x^(1/3) acts like root(x,3). For example,

> (-1.0)^(1/3);
                         0.5000000001 + 0.8660254037 I
 
> root(-1.0,3);
                         0.5000000001 + 0.8660254037 I

The complex values don't show up on your graph, as they are not numeric (real).

On the other hand, surd returns -(-x)^(1/n) for x<0 when n is an odd integer. See its help-page. So for your plot, try,

plot(surd(x,3),x=-2..2,thickness=3);

Reading the help-pages is generally a good idea.

acer

If you read the help-page root, you'll see that it  returns the "principal root", defined by the formula root(x,n) = exp(1/n * ln(x)). The help-page ?^ also summarizes this. In your example, x^(1/3) acts like root(x,3). For example,

> (-1.0)^(1/3);
                         0.5000000001 + 0.8660254037 I
 
> root(-1.0,3);
                         0.5000000001 + 0.8660254037 I

The complex values don't show up on your graph, as they are not numeric (real).

On the other hand, surd returns -(-x)^(1/n) for x<0 when n is an odd integer. See its help-page. So for your plot, try,

plot(surd(x,3),x=-2..2,thickness=3);

Reading the help-pages is generally a good idea.

acer

They say that imitation is the sincerest form of flattery. This, from 2 months later, is close.

acer

It might not be at all related to this problem reported above (with a busy CPU while Maple's GUI is sitting idle) but a pair of news items recently reminded me of this thread.

One is mention of apparent special use of some OSX API by applications. The slashdot commentary is more balanced.

The other is mention down at the end of a blog entry by Wolfram's Director of Software Technology about work with Apple. Who knows what it means.

acer

Could you apply the freeze by hand, instead of letting frontend do it?

> z := a*f(x)+b*g(y)+c*x+d*y:
> thaw( value( subs( f(x)=freeze(f(x)), Diff(z,f(x)) ) ) );
                                       a

> thaw( value( subs( theta(t)=freeze(theta(t)),
>                    Diff(cos(theta(t)),theta(t)) ) ) );
                                -sin(theta(t))

acer

Could you apply the freeze by hand, instead of letting frontend do it?

> z := a*f(x)+b*g(y)+c*x+d*y:
> thaw( value( subs( f(x)=freeze(f(x)), Diff(z,f(x)) ) ) );
                                       a

> thaw( value( subs( theta(t)=freeze(theta(t)),
>                    Diff(cos(theta(t)),theta(t)) ) ) );
                                -sin(theta(t))

acer

I realized that an obvious improvement would be to generate each try's initial point inside a complex hyperbox specified by the user.

As originally written, each initial point is taken from the hyperbox [-1.0-1.0*I..1.0+1.0*I]'^n or [-1.0..1.0]^n. That's going to be weak in general, as the set of points in the box might be distinct from the set which converge to some roots.

In a related way, it would be an improvement to allow the user to supply the bound of those boxes, in order to also be able to search only for roots lying inside it.

So an additonal optional parameter, a list of Maple ranges, could specify the box used for both those purposes. For each dimension, the ends of the range could specify the lower-left and upper-right (possibly complex) corners.

Picking a finite box well, when not specified in the arguments, will be tricky.

acer

The question of how the Array will eventually get used it important here.

Do you want to shift the costs to element assignment time, or access time? Do you want to pay efficiency costs in access/assignment time or in storage? Do you expect most or few entries to get accessed/assigned at some point?

I believe that rtable indexing-functions are flexible enough (sometimes with ingenuity required) to control those aspects and to choose where to put the cost.

acer

First 547 548 549 550 551 552 553 Last Page 549 of 592