acer

32622 Reputation

29 Badges

20 years, 44 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

I am seeing the following in Maple 2016.0.

Mac Dude, is it ok for you in Maple 2016.0 on your OS X?

restart;
UseHardwareFloats:=true:
fr = 1.64*10^6*E[k]^2*exp(-8.5/E[k]):
solve(fr = 1.64*10^6*E[k]^2*exp(-8.5/E[k]),E[k]);

                     4.250000000             4.250000000     
               -----------------------, ---------------------
                       /  5442.655602\          /5442.655602\
               LambertW|- -----------|  LambertW|-----------|
                       |      (1/2)  |          |    (1/2)  |
                       \    fr       /          \  fr       /

restart:
UseHardwareFloats:=true:
evalf(LambertW(3));

                             1.04990889496403983

restart;
UseHardwareFloats:=true:
evalf( BesselY(0, 2/3*x) );

                         BesselY(0., 0.6666666667 x)

kernelopts(version);
          Maple 2016.0, X86 64 LINUX, Feb 16 2016, Build ID 1113130

 

acer

@Kitonum If I may, I'll add another example if only to illustrate that it can be tricky (esp. for the new user) to come up with a satisfactory test to use if only sieving (all) results with select, say.

solve( x^3+3*x^2-1, useassumptions ) assuming real, positive;

                                                  1/2 1/3
                                        (-4 + 4 I 3   )              2
                                        ------------------ + ------------------ - 1
                                                2                       1/2 1/3
                                                             (-4 + 4 I 3   )

That result seems ok. Which is why this approach is useful to know about.

Establising that solution as being purely real (exactly) may be a challenge for some users. So for some examples it can be a challenge to find a strong enough predicate to use with select or selectremove. if trying to extract the purely real  and positive solutions from just this:

S:=solve( x^3+3*x^2-1 );

By "challenge" I mean that one can go astray.

restart:
K:=solve( x^3+3*x^2-1, useassumptions ) assuming real, positive:

simplify(combine(rationalize(K))): is(%,real);

                                                           false

simplify(convert(simplify(combine(rationalize(K))),expln)): is(%,real);

                                                            true

simplify(evalc(evala(simplify(convert(simplify(combine(rationalize(K))),expln)))));

                                               2 Pi             Pi         4 Pi
                                           cos(----) - 1 + cos(----) - cos(----)
                                                9               9           9

kernelopts(version);

                                 Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895

# Sure we might happen to obtain the following, more simply. What's key is that
# it *could* be harder. And we can go wrong. And Maple can go wrong.

simplify(evalc(K));

                                                            2 Pi
                                                      2 cos(----) - 1
                                                             9

Note: Maple 2016.0 might return FAIL instead of those `false` and `true` results. But the key thing to keep in mind is that we can always construct even more difficult and challenging examples.

We know that there is an inherent risk when using floating-point approximations as part of the sieving selection, due to round-off error and the possibility of misinterpreting small imaginary components (as either being mere artefact, or not).

For any stated approach we could find examples that present difficulties. So it is useful to be aware of the methods suggest by both Kitonum and Doug.

@Majmaj Apart from not handling distribution across sums, the rough prototype overload I showed would also need special handling to map over rtables (Vector,Matrix, Array) and other data-structures.

If you want exact handling of floats then perhaps you'd be better off using the convert command to first turn the floats into exact rationals. That might be done up front, on initial expressions containing subexpressions of type float, via the subsindets command. Just an idea.

@Honigmelone You may use applyrule across the elements of a Vector (or Matrix or Array) with the map2 command.

So, as an alternative to converting to and from list, and using your code above,

map2(applyrule,[rule,rule2],f_symbol);

What would you hope to see as the results for the following examples?

a:=.123456789:

1.0 * a;
1.00 * a;

0.10 * a;
0.100 * a;

acer

In such a numeric computation environment as you are envisioning what result would be produced for the calculation of 0.1 * 1/3 ? Note that the second multiplicand is the exact rational one-third.

How many decimal digits would you hope to see in the floating-point result of that, if it were not to simply use the current Digits value? To what would it dynamically adjust the working precision?

acer

@Markiyan Hirnyk 

1) It is nicer to get just the last result from those you obtained from solve. Your taking the last of the multiple solutions you obtained is very much only done "by hand". It is neater to add the n>0 assumption and get just the single, desired result.

2) actually what I showed works with the `abs` as well.

solve( {abs(1 - n^2/(n^2+31*n+228)) < eps}, n, useassumptions )
  assuming eps>0, eps<1, n>0;

                                               2                  1/2
                         -31 eps + 31 + (49 eps  - 1010 eps + 961)
                        {-------------------------------------------- < n}
                                            2 eps

 

@Markiyan Hirnyk  Perhaps that approach can work out, if modified somewhat. We can get rid of the `abs` since n^2/(n^2+31*n+228) is approaching 1 from below.

restart;

sol := solve( {1 - n^2/(n^2+31*n+228) < eps}, n, useassumptions )
         assuming eps>0, eps<1, n>0;

                                                      2                  1/2
                                -31 eps + 31 + (49 eps  - 1010 eps + 961)
                        sol := {-------------------------------------------- < n}
                                                   2 eps

eval(sol, eps=9*10.0^(-2));

                                            {320.6343580 < n}

eval( abs(1 - n^2/(n^2+31*n+228)), n=320.0);

                                              0.0901659736

eval( abs(1 - n^2/(n^2+31*n+228)), n=321.0);

                                               0.0899046105

[edit] I saw your followup only after I submitted this. I've given a looser restriction on positive epsilon, and the additional assumption n>0 gets only the single result from `solve` (ie. the one we want).

Have you tried the command kernelopts(numcpus=40) or used some other values? How does that affect the performance?

How much benefit (if any) do you see from your current use of Threads:-Seq over using just seq?

It sounds as if you might be expecting Maple to set numcpus (by default) according to the hyperthreading feature of your cores. That does not necessarily improve performance across applications, and success or detriment of that can vary with the particular chipset.

You haven't said much about the nature of the "complicated procedure". How expensive is each individual call to it? (If very expensive then perhaps a Grid package solution might help.) Do you know that the procedure is threadsafe? Is its computation symbolic or numeric?

acer

@Age Those single right-quotes are called uneval quotes. There is a help page with the topic uneval.

What you've called algebraic is usually referred to as an expression. You are figuring out that some commands like fsolve, plot, etc, accept the first argument in either opertor form or expression form.

This is a common stumbling block for new users, and you have done much better than most at figuring it out on your own.

Search for the colloquial term "premature evaluation" (alongside "Maple") for examples of others' difficulties with all this.

Why do you need to restart?

Is it because you want to undo the name bindings (to the package exports) of the earlier calls to with?

If so then instead of restart you could use unwith.

acer

Honigmelone, it's not entirely clear what your expectation and objections are here.

What parts in particular, if any, do you object to in the following. Please show your response explicitly.

restart;
assume(a(t),real);
getassumptions(a(t));
                                              {a(t~)::real}

assume(b(t),real);
getassumptions(a(t));
                                              {b(t~)::real}

restart;
alias(a=a(t),b=b(t)):
assume(a,real);
getassumptions(a);
                                              {a(t~)::real}

assume(b,real);
getassumptions(a);
                                              {b(t~)::real}

restart;
alias(a=a(t),b=b(t)):
assume(a,real);
getassumptions(a);
                                              {a(t~)::real}

additionally(b,real);
getassumptions(a);
                                        {a(t~)::real, b(t~)::real}

You seem to have saved your worksheet in Maple 18.00. Is that right?

acer

@vv I don't see why one would expect something different there.

restart;

alias(a=a(t)):

:-a(t)(t) - a(t);
                                                    0

a - :-a(t);
                                                    0

The thing you are trying to subtract is :-a(t)(t).

dismantle(a(t));

FUNCTION(3)
   FUNCTION(3)
      NAME(4): a
      EXPSEQ(2)
         NAME(4): t
   EXPSEQ(2)
      NAME(4): t

The behavior in question is in `assume`, and I don't see that `alias` has much to do with it (other than its use having obscured the details).

I'll note this too,

restart;
getassumptions(a(x))  assuming b()(x)::real;
                                              {b()(x)::real}

@gw_g It's not so much that "the author of the worksheet possibly could provide..." the ability to change paremeters and execute "...by his design". [emphasis mine]

Rather it relevant that achieving execution following changing of parameters is wholly intended to be done in the MaplePlayer via Embedded Components. That is what the Player is good for.

If you use the side panel in the Player and change its drop menu to "MathApps" and browse down (down arrow tip) you can find a variety of worksheets that provide various kinds of interactive computation.

The author of your .mws worksheets did not set up the worksheets to provide interactivity via Embedded Components. So the MaplePlayer is merely a viewer for such worksheets. And clearly the author of those worksheets which you possess had no intention of using Embedded Components since they were saved in the older .mws format which doesn't even support Embedded Components.

Complaining that the MaplePlayer does not provide any interactivity for worksheets that are not authored to provide interactivity via Embedded Components makes little sense, because Embedded Components is THE mechanism by which the Player offers interactivity and recomputation.

 

@terryma You are welcome.

Look at the long list of names that get printed when you execute with(MTM). All those names are then bound to various exports of the MTM package.

You can always call the original, global name using the colon-dash syntax, such as :-subs(...) for example, even if you have rebound the subs name by loading a package such as MTM.

You can also call the MTM export by using its long form name, such as MTM:-fourier(...) for example, even if you don't load the whole MTM package.

So, you can always force what you want, whether you load the package or not. The available syntax allows you to force things either way.

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