acer

32353 Reputation

29 Badges

19 years, 331 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

RealDomain:-solve is calling :-solve under `assuming` here, like so:

`assuming`([solve( exp(I*x) = -1,
                  x, AllSolutions )],
           ['real']);

That generates an error after `assuming` calls `assuming/names` which looks for special case names (upon which to not place assumptions) by querying the table entry `assuming/keywords`[solve]. Unfortunately that table only has information about the lowercase keyword parameters. Ie, (reformatting the output for legibility here),

eval(`assuming/keywords`[solve]);

   () -> `if`(nargs < 2, {},
              indets([args[2 .. -1]], 'name')
                intersect
              '{:-maxsols, :-tryhard, :-allsolutions, :-explicit,
                :-useassumptions, :-conditionalsolutions,
                :-dropmultiplicity}')

Since camelcase AllSolutions is not known to that mechanism, `assuming` places the `real` assumption on it, after which the parameter-processing for the :-solve command fails to recognize it as a keyword option. So it gets passed in as just another assumed name, and is processed as an extra argument. When variable `x` is also passed then AllSolutions~ is interpreted as an invalid argument and an error is emitted. And when argument `x` is not supplied then :-solve considers the assumed name AllSolutions~ to be the main solving-variable and returns NULL.

When lowercase allsolutions is passed to RealDomain:-solve, on the other hand, it gets special treatment under the `assuming` call and gets passed as-is onto :-solve, and is correctly processed as a valid keyword option.

So, a bug in `assuming`, I think. I am not sure whether it would be "better" for `assuming` to get an augmented `assuming/keywords` table, or whether the lookup mechanism could (sometimes?) be made to query robustly the parameter-specification of the target procedure (ie. op(1,eval(:-solve) or a ToInert form).

It may be that RealDomain:-solve has not been taught to properly handle the capitalized keyword AllSolutions, and so it treats it as a solving variable.

That might explain the NULL return. Ie. if RealDomain:-solve placed an assumption (of having the property real, say) on the name AllSolutions before passing arguments to top-level :-solve then the latter might not recognize it as being the special keyword option name.

restart;
RealDomain:-solve(exp(I*x) = -1, foo); # NULL

restart;
RealDomain:-solve(exp(I*x) = -1, AllSolutions); # NULL

restart;
RealDomain:-solve(exp(I*x) = -1, allsolutions); # weakness
                               Pi

Note that it did seem to handle the lowercase keyword option allsolutions as valid (even if it was not very effective). Here is another hint that particular kind of mix-up might be occuring:

restart;
RealDomain:-solve(exp(I*x) = -1, x, AllSolutions);
Error, (in assuming) when calling 'solve'. Received: 'invalid input:
 too many and/or wrong type of arguments passed to solve; first unused
 argument is AllSolutions'

I notice that these below do better for this particular example;

restart;
RealDomain:-solve( evalc( exp(I*x) = -1 ), x, allsolutions);
                         2 Pi _Z1 + Pi

restart;
RealDomain:-solve( {Re,Im}( exp(I*x) = -1 ), x, allsolutions);
                      {x = 2 Pi _Z1 + Pi}

It might be that RealDomain:-solve could be strengthened by careful application of such additional approaches.

Hmm. I just tried the following sequence or operations on a Windows 7 Pro machine at work, using 64bit Maple 2016.1 and it went well in the sense that I got a working .help database at the end.

1) Downloaded the .zip file and unpacked the three files .hdb, .lib, .ind.

2) Created a folder in Windows 7 corresponding to what the following 1D Maple notation command returns.

cat(kernelopts(':-homedir'),"/maple/toolbox/Advisor/");

3) Copied those three files to that new folder.

4) Closed all Maple GUI sessions, and relaunched 2016.1 Standard GUI. (I then saw the expected Warning about .hdb format being deprecated. And libname included that new folder.).

5) Issued this 1D Maple notation command (which produced one Warning about being unable to guess the preview of one sheet).

HelpTools:-Database:-ConvertAll(
     cat(kernelopts(':-homedir'),
         "/maple/toolbox/Advisor/"));

6) Closed all Maple GUI sessions, and relaunched 2016.1 Standard GUI.

7) Issued commands ?advisor  or ?crop etc, which displayed the right pages, with working links.

 

@Christopher2222 First you need to get the GUI to see your augmented libname upon (completely fresh) launch. I think that you need to sort that out first (and so far you haven't indicated otherwise).

If it then sees .hdb files it's supposed to emit a message about .hdb -> .help migration. It has properly done so in the past, for me.

@Christopher2222 I suggested putting a maple initialization file maple.ini (which augments libname, in order to have Maple find the three files) in the location returned by kernelopts(':-homedir'). I did not suggest putting simply placing the three files there.

@Christopher2222 Have you tried putting an initialization file "maple.ini" in the (MS-Windows) location returned by this command:

kernelopts(':-homedir');

@Christopher2222 The Standard GUI (since Maple 13 or so...) doesn't re-scan `libname` locations to update the Help path, when `libname` is altered in a open, running worksheet. Rather, it scans the locations when it launches, and that happens after it runs an initialization file (if present). So appending to `libname` in a valid personal initialization file ought to work.

But here's something else you could try. Put those three files in the location that this command returns. You may have to use an appropriate path separator (for adjusting the output, but not this input command which ought to work cross-platform).

cat(kernelopts(':-homedir'),"/maple/toolbox/Advisor/lib");
Then close the GUI entirely, including all open worksheets, and then relaunch that Maple version's GUI.

@leiniu The ordinate is x and the abscissa is r1 (I think).

I suppose that you could also use the following Maple command to see "axes".

plot([[0,0]], background=Bif,
     view=[-1.5 .. 5, -0.5 .. 4], axes=box );

Is this also interesting:

Bif2:=Bifurcation( [x,y], [eqs[2],eqs[1]],
                   ':-rvariable' = r1,
                   ':-xmin'=-0.05, ':-xmax'=0.3,
                   [0.5,0.5], -1.6, 6,
                   ':-height'=600, ':-width'=600 ):
ColouringProcedures:-HueToRGB( Bif2 ):
Embed( Bif2 );

The following may be a shorter, related example.

restart;
ee:={(exp(1))^(Y/(exp(Y)-1))+(exp(1))^(Y*exp(Y)/(exp(Y)-1))-1};
solve(ee,Y);

In Maple 15.01 the following produced just Warning, solutions may have been lost. But in later versions it produces error messages. And in my Maple 2016.1 it emits a long set of unexpected messages (and then takes a long time). In my Maple 2015.2 it generates the kind of error message you showed (quickly).

I have submitted a bug report.

acer

@leiniu You don't need me to send you a command for exporting an Image to a file, because Maple already has a command for that (as I mentioned above). It is called ImageTools:-Write, and you can read its Help Page.

The personal file folders on your machine will surely be different than they are on my machine. So you might not have a folder named "mapleprimes". You'll have to choose your own location.

You pass the file location to ImageTools:-Write as a string. For example, if the Image has been assigned to the name A in Maple,

ImageTools:-Write( "C:/Users/leiniu/My Documents/somename.bmp", A );

@vv Maple 18.02 and 2015.2 (64bit Linux) get that float value from symbolic `int` using either the ftoc or ftocms methods. But yes, in Maple 2016.0 that input generates this error message.

restart;
int((abs(sin(2.0*x))-abs(sin(x)))/x, x = 0 .. infinity);
Error, (in int) wrong number (or type) of arguments:
invalid options or option values passed to exact integration

Speaking of efficiency, I really ought to have pulled the FitIntensity(ToGrayscale(A)) out of that loop...

SetBackground:=proc(A::Array, C::string)
  local g,i,p,T;
  uses ImageTools;
  if not type(A,'Array(:-datatype=float[8])') then
    error "expecting an Image for the first argument";
  end if;
  if nops([op(2,A)])<>3 then
    error "expecting a color Image with exactly three layers";
  end if;
  p:=[ColorTools:-Color(C)[]];
  g:=FitIntensity(ToGrayscale(A));
  for i from 1 to 3 do
    T[i]:=Threshold(g,0.001,method=both,low=p[i],high=0.0);
    T[i]:=T[i]+GetLayer(A,i);
  end do;
  CombineLayers(T[1],T[2],T[3]);
end proc:

It would be neat to have a highly efficient color mapping command, to swap out pixels in an Image of a given color (or those "close enough" in some color space) with another color.

@itsme I submitted a bug report on the day it was posted.

First 289 290 291 292 293 294 295 Last Page 291 of 592