Carl Love

Carl Love

28140 Reputation

25 Badges

13 years, 327 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

It looks like you're trying to supply more than one initialpoint to Optimization:-Minimize. It doesn't allow that. You may be better off using the DirectSearch optimization package (which you'd need to download from the Maple Applications Center). That package's commands allow for multiple initial points.

You can rerun Optimization:-Minimize pm times, once for each initialpoint.

There are some things confusing about your Question:

  1. The Minimize doesn't use getone; indeed, you don't give any purpose at all for getone.
  2. You use z several different ways. You have it as the objective function, the sequence of variables of the objective function, a randomly generated point, a list of randomly generated points.

You can simplify your random point generation like this:

Roll:= rand~([98.0..102., -1.0..5., .5..1.0, 0..evalf(2*Pi), 0..20.]):
['Roll()'$pm];

Do you want differentiation with respect to a particular variable, such as x, as provided by the diff command, or differentiation of an operator, as provided by the D command?

@maple fan There's no real root! If there were a real root, how would you decide if it was positive or negative? Maybe you just want to make it negative? Okay, then plot

plot(-abs((-2)^x), x= -sqrt(2)..-exp(-1));

So what's the real root of (-2)^(1/2)?

 

@acer Thank you for the corrections. I've never been able to get eval to work inside evalhf and now I have an example.

Still, is it ever actually worth it to create a Vector in evalhf code? Isn't it substantially more efficient to pass it in?

And is what I wrote true with respect to compiled code?

@charlesforgy 

I avoid any scenario that involves modifying the optimized code with a text editor. A substantial amount of modifying can be done with subs, and there's almost always some of that that I need to do after using codegen(..., tryhard).

Do you plan to call the resulting optimized procedure with evalhf?

Note that your entire procedure TestFunc can be replaced by 

Matrix((ii,jj), `*`);

@Adri van der Meer 

There is no need to use print in your procedure, and, indeed, it may make the procedure less useful.

@Markiyan Hirnyk 

Here's why the OP wants to separate the columns. Look closely at the Matrix in the original Question. It superficially appears to be eight columns. But the first two columns are actually one, each entry having two terms. The OP wants that to be visually obvious.

@Hamidreza 

I'm using Windows 8.1.

Your command works for me. Try doing a restart first; perhaps something has inadvertently been assigned to a or b.

@Mac Dude You wrote:

In Maple, you pick whether to use a common server for all worksheets or separate servers in the preferences.

Not true: There's a third choice in the Preferences: "Ask each time a new worksheet is created." If you make this choice, then you can select for each worksheet at the time of its creaton either a new server or one of the existing servers for the other open worksheets.

 

I find it a little hard to believe that your original Matrix is

A:=Matrix([[Matrix[[a,b],[c,d]]], [Matrix[[e,f],g,h]] ])

Are you sure that you have the parentheses and square brackets correct on that? Perhaps it's like this:

A:= Matrix([Matrix([[a,b],[c,d]]), Matrix([[e,f],[g,h]])]);

The original syntax that you gave is possible, but I find it unlikely.

If the message is as Tom Leslie suggests (which seems like a good guess except that the "1%" still has me baffled), then the solution is simple: just continue with your computation. Note that the message isn't an error, or even a warning. Maple has sucessfully computed the output and simply chooses (based on your interface settings) not to display it. And what's the point of looking at an output that can run on for hundreds of pages (I've seen one that was 4000+ pages---a single algebraic expression)? Just go on to the next step of your computation.

@tomleslie 

The cubic spline of y as a function of x isn't the inverse of the spline of x as a function of y, even with exact computation (which Maple is happy to do in this case). I'm not saying that you thought that it was. However, it may be desirable that getx and gety be inverses of each other. Consider these plots of the relative deviation from the true inverse:

plot(x-> (getx(gety(x)) - x)/x, (min..max)(xlist));
plot(y-> (gety(getx(y)) - y)/y, (min..max)(ylist));

To make them inverses, I'd use your gety and define

getx:= y-> fsolve(gety(x)=y);

If you now check the above two plots (which takes longer due to the slowness of fsolveing for every point), the relative deviations are all on the order of 10^(1-Digits) or less---what's expected for this type of numeric computation.

You may be more comfortable with this if you verify that gety is a strictly increasing, hence invertible, function. This plot shows that it is:

plot(D(gety), (min..max)(xlist))


@krismalo 

You may be more satisfied with getx as I defined it immediately above.

First 462 463 464 465 466 467 468 Last Page 464 of 711