acer

32562 Reputation

29 Badges

20 years, 27 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

It's pretty straightforward to toggle on units support at the interative top-level. Note that the SI system is the default. In SI, the Newton (N) is the base unit for representing force. So output with that dimension comes out in terms on Unit(N).

In 1D Maple input, you can just type it in directly, as in the example below.

> with(Units[Standard]):
> 35*Unit(kN) + 7*Unit(MN);
                                  7035000 [N]

If you instead want kN to be the default base for output, so that the above comes back as 7035 [[kN]], then that too can be done with a customized system. To see an example of that, enter this Maple command to see a help-system page,

?Task,ChangeDefaultUnitInSystem

Alternatively, you can convert output like 7035000 [[N]] to 7035 [[kN]] using the context-menus. Select the output with the mouse, and when the context-menu pops up choose "Units" -> "Replace Units".

In 2D Math output, the Unit(N) object should get typeset as something that looks like [[N]]. To get that in 2D Math input, you can use the "Units (SI)" palette. Or use command-completion.

See the top menubar's "View" -> "Palettes" -> "Arrange Palettes" for a popup menu to configure which palettes show up in the left sidebar.

acer

It'd help if you posted all the Maple code, and your exact commands used to convert it. You can upload it here, as a worksheet.

acer

What you asked for was this,

(quote) but ideally what I would like to be able to do is

plot( Re(subs(deltaE=0.355,M=sqrt(5.4e5),Eig1(R^3))), R^3=1^(1/3)..10^(1/3));

(end quote)

That is, you asked to plot f(R^3) vs R^3, and that is just a question of labelling.

You didn't actually ask how to plot f(R) vs R^3. Is this what you would like?

Eig1 := R -> (1/9*(-27*deltaE^3*R^9-10*M^6+3*
  sqrt(-189*deltaE^4*R^12*M^4-147*deltaE^2*R^6*M^8
  -27*M^12+60*deltaE^3*R^9*M^6))^(1/3)
  -(-deltaE^2*R^6-7/9*M^4)/(-27*deltaE^3*R^9-
  10*M^6+3*sqrt(-189*deltaE^4*R^12*M^4
  -147*deltaE^2*R^6*M^8-27*M^12+60*deltaE^3*R^9*M^6))^(1/3)
  +2/3*deltaE*R^3+2/9*M^2)/R^3;

plot( Re(subs(deltaE=0.355,M=sqrt(5.4e5),Eig1(t^(1/3)))),
      t=1..10,labels=[R^3,'Eig1'(R)]);

acer

I too got the hypergeom form from Maple 12 (and 11.02, and 10.02). Which is a pity.

> In := Int(sqrt(t^5+6*t)*(5*t^4+6), t=0..1):

> value(In);
10  1/2
-- 6    hypergeom([-1/2, 11/8], [19/8], -1/6)
11
 
          1/2
     + 4 6    hypergeom([-1/2, 3/8], [11/8], -1/6)

The example (from a textbook it seems) is of course easy to do by hand. And it can be forced from Maple as well, by doing something as simple as the obvious change of variables.

> student[changevar](u=t^5+6*t,In,u);
                                    7
                                   /
                                  |    1/2
                                  |   u    du
                                  |
                                 /
                                   0

> value(%);
                                        1/2
                                    14 7
                                    -------
                                       3

Of course, as delta7 noted, the indefinite integration result could also be used. And for fun,

> sol := value(In);
       10  1/2
sol := -- 6    hypergeom([-1/2, 11/8], [19/8], -1/6)
       11
 
          1/2
     + 4 6    hypergeom([-1/2, 3/8], [11/8], -1/6)

> sol2 := value(simplify(combine(convert(convert(sol,MeijerG),Sum))));
                 54  1/2                       169    81
         sol2 := -- 6    hypergeom([-1/2, 3/8, ---], [--, 19/8], -1/6)
                 11                            88     88
 

Now, how can one get back to 13/3*sqrt(7) from that? Should we try to look them up? Better still if `int` could use a simpler method (such as easy substitutions) and get the simpler answer directly.

acer

I don't not have access to the Global Optimization Toolbox right this moment (weekend). I'll try to look, when I can. Not everyone here will have access to that add-on.

Remember that the discipline of global optimization is very difficult in general. It is an art. I have seen that toolbox work wonderfully and outperform other products.

I believe that the default method for the toolbox is branchandbound. Try changing it to multistart (or maybe even singlestart). Each method will work better than the rest for some different class of problems. For highly nonlinear functions, the multistart often does better.

No method works best for all global optimization problems. No optimizer (that I have seen) works better than all other on all problems.

Also, in global optimization the "best" solution is hard to prove, if one cannot do it analytically and has thus resorted to numerical optimizers. There might always be another (better) local minimum just over the next ridge. So it can often be a question of, "how long can you afford to wait, until you have to accept the curent best". In consequence of this you may wish to adjust the timelimit.

Try to keep Digits to at least 14 (which trunc(evalhf(Digits)) on Windows) so that Maple can evaluate objective and constraints better (in case of numerical instability of the problem).

If speed is an issue, try to ensure that objective and constraints are "evalhf'able".

Also, try setting infolevel[GlobalOptimization]:=1 or 2 to try and get an idea of how well it's doing.

You mentioned another product (scop) producing a better fit in 2 minutes. Did you have to compile the objective and constraints, when using that package?

acer

Your angles1_s from the .m file is a sequence of 10 lists. It appears that you are trying to build a new sequence, by concatenating the contents of the 10 lists in angles1_s except for their last elements.

But you have a nested set of calls. The "problem" is that your inner `seq` call is walking all the elements of the inner lists simply to extract each element. I guess that it's just not efficient to do it like that.

Does this not do the same thing? (It's fast.)

seq(op(angles1_s[j][1..-2]),j=1..10):

Now, you mentioned that you will eventually want to do something more. Maybe that means acting on these values in some way, while you form the concatenated sequence. This should do that (replace x->x with your function of choice),

seq( op(map(x->x,angles1_s[j][1..-2])), j=1..10):

acer

A name such as x may not be used like that. Note the x[0] is not a name, as written, and may not be used as a procedure parameter. In Maple, x[0] refers to an element of a table, etc.

But maybe you are using x[0] only so that it gets nicely typeset as a subscripted thing, in the Standard GUI's 2D Math output (and input)? If that is so, then you may be able to change the x[0] table reference to what's called an atomic identifier (name). You can do this using the right-click context menus, under "2D Math". Or you could use the subliteral entry on the "Layout" palette (which you may need to add to your view, using the "View" topbar menu).

Earlier I wrote something wrong, about x\_0. Sorry, that doesn't get typeset as subscripted, except in my dreams.

Note aso that you can do things like y:=x->42+x[0] if you want a procedure that uses x[0]. But it then gets passed all of (table, rtable, Vector, etc) x as argument.

ps. searching this site for atomic identifier should show more forum threads with this same theme.

acer

plot( Re@subs(deltaE=0.355,M=sqrt(5.4e5),eval(Eig1)), 1..10);

plot( Re(subs(deltaE=0.355,M=sqrt(5.4e5),Eig1(R))), R=1..10);

plot( R->evalf[100](Re(subs(deltaE=0.355,M=sqrt(5.4e5),Eig1(R)))), 1000..1010);

And for fun,

> limit( Re(subs(deltaE=0.355,M=sqrt(5.4e5),eval(Eig1))(R)), R=infinity);
                                 0.3550000000

However,

> limit( Re(eval(Eig1)(R)), R=infinity);
                                                          2
       (1/3)           3 (1/3)           (2/3)      deltaE
-1/9 27      Re((deltaE )     ) - 1/27 27      Re(------------)
                                                         3 1/3
                                                  (deltaE )
 
     + 2/3 Re(deltaE)
 
> simplify(%) assuming deltaE>0;
                                       0

acer

Sorry, what do you want to make into a function?

Are you saying that you want a function which takes in a Matrix and returns the first element of the Vector of its eigenvalues?

e := m -> LinearAlgebra:-Eigenvalues(m)[1];
M := <<2,3>|<4,-1>>;
e(M);

Or are you after something else? Maybe you want a function for that eigenvalue in terms of indeterminates contained in a Matrix input?

e := m -> unapply(LinearAlgebra:-Eigenvalues(m)[1],op(indets(m)));
f := e(<<2,c>|<4,-1>>);
f(3);

Just a little more detail might help, thanks.

acer

How are you getting string output now, from commandline Maple? Are you hitting all your expressions with convert(...,string), or are you using sprintf(), or...?

acer

I'm not whether this sort of approach will serve your needs,

> p := proc(t::uneval,d)
> global ptable;
>   ptable[d]:=eval(t);
>   plotsetup('jpeg',plotoutput=d);
>   eval(t);
> end proc:

> p( plot(tan(x),x=-Pi/2..Pi/2), "t.jpg" );

> plotsetup('default');
> plots:-display(ptable["t.jpg"]);

If you have many such plots to produce, then you can automatically generate the filenames within Maple, using the cat() command. See here for an example.

The procedure p() above will generate the plot datastructure and both save it to a file as well as store it in a globally accessible table. Once done, the code above shows how to reset the plot device and then view such plots stored in that table, all within the same Maple session.

What might be harder is to set things up to that each plot is visually displayed at the same time as it gets saved to a file, instead of after control returns (to the top level?!).

Looking at this again, I suppose that the uneval on parameter t, and the two calls to eval(), are unnecessary. They just make Maple work twice as hard to generate the plot structure, once for each purpose. Better would be generating the plot structure just once (normal evaluation rules on procedure 'p' would suffice).

acer

Try using using the parse() command.

acer

You are using the older (and now deprecated) matrix & vector objects, which are based in the array structure and so have last name evaluation rules. See the ?last_name_eval help-page.

Switch to uppercase Matrix and Vector objects, and the LinearAlgebra package for dealing with them. Those objects do not have last name evaluation rules.

If you really do insist on using the older structures here, look also at the ?evalm help-page.

acer

In both Maple 11.02 and 12.00, plot(x^2,x=-1..1,legend=phi) worked for me in the Standard GUI.

In Maple 10, it seemed to work OK if I did this,

plot(x^2, x=-1..1, labelfont=[TIMES], font=[SYMBOL], legend = f);

Which version, and interface, are you using?

acer

Even if you get the calculator, at some point in your studies you might well wish to try Maple too. It's a great deal of power for the cost of the student version (much lower than full pricing, but with the same functionality).

Many books on Maple are listed here.

acer

First 313 314 315 316 317 318 319 Last Page 315 of 338