acer

32313 Reputation

29 Badges

19 years, 313 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Sorry, Robert.

acer

Sorry, Robert.

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

First 546 547 548 549 550 551 552 Last Page 548 of 591