acer

32363 Reputation

29 Badges

19 years, 332 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@nm I did not write that the negation of op(0,eval(g,1)) = int is unqualified "success". I wrote that it was a check for whether the return is an unevaluated int call.

How you choose to characterize "success" is something we can only guess at, in advance of your telling us.

BTW, Maple allows for some adventurous use of names vs symbols. Would you say that the following (deliberately exotic) example succeeds?

restart:

alias(y=x[int(f(x),x)]);
                                      y

g := int( y^2, y );

                                       1  3
                                  g := - y 
                                       3   

hastype(eval(g,1), specfunc(anything,int));

                                    true

If you would say that example succeeds then perhaps you also have certain as yet unstated qualifications on the class of examples to be tested.

@Bendesarts This now appears to be a C programming question, which might even be sensibly posed in a programming forum unrelated to Maple. It seems to me that Maple is just the tool used to create the standalone C source, but is otherwise not necessary for a solution.

But a version of the Watcom C compiler is bundled with the 32bit Maple 18 on Windows, and this might be used to create your DLL. I believe that you should strive for a DLL that does not rely on the Maple runtime, in this case, and so I would suggest that the Maple command `Compile` not be used directly. (You don't want something linked to Maple's libmrt, or which might only run alongside a licences Maple installation.) What is needed, then is the particular (shell) calling sequence of the WATCOM executables. I would have to dig, to find that out once again. I seem to recall that either I or Axel or someone else posted such a thing many years ago in this forum.

OK, so it seems that you have used Maple to emit C source (which is stand alone, ie. doesn't depend on any Maple runtime).

And now you want to create a shared object (dynamic library), so that other executables other than Maple can access its functions. That task doesn't really have anything to do with Maple, though its possible that you might be able to use whichever external C compiler is also used by Maple's Compiler command.

What version of Windows? Is your target a 32 or 64bit application? Which version(s) of Maple do you have, and for which did its Compiler command function properly? Do you have any other 3rd party C compiler installed?

acer

@Carl Love Thanks.

I could also add that checking for type specfunc is also possible. The key thing is to not cause a whole retry of the failing computation.

Which version of Maple?

Do you mean for float double precision? If so, the real or complex case?

For the nonsymmetric or the symmetric definite case?

acer

I forgot to mention that in the very last example the outer integrand is put into operator form by a call to `unapply`. That wasn't necessary when using method=_d01ajc, as per Axel's described approach. But this can be key when not specifying the method, since otherwise the internal machinery can try to expand the integrand expression (as part of discontinuity checks? It's unclear). Using operator form forcibly prevents such poking around, which can either cause a big slowdown or even a full stall and massive memory allocation even if at the top level Digits is (in this case) first brought back down to something more reasonable such as 25 say. The need for this trick crops up quite often, and I would like to see a more readily understandable, additional option to control this behaviour, instead of the obscure technique of switching to operator form.

@jonlg Yes, and indeed that's exactly what I suggested. It didn't seem like messing with the individual `tickmarks` or `xtickmarks` option should have been necessary to attain your goal.

@Rouben Rostamian  Manually changing the rotation of a 3D plot using the menubar (or rotating with the mouse cursor) does not change the PLOT3D structure, even if it already had an ORIENTATION substructure when first placed into a PlotComponent.

It would probably be better if that continues to not happen (or, at least not upon every rotation's rendering update) because it would be a very bad inefficiency if the GUI had to repeatedly send an updated PLOT3D structure back to the kernel. So, manual rotation is quite different from just changing linestyle or lighting, etc, because it is something for which an "update" can happen very often as one manually rotates.)

So instead I have been asking for those qualities (and the projection factor) to be properties of a PlotComponent, that could be queried and set using the DocumentTools:-GetProperty and DocumentTools:-SetProperty commands. As properties of the PlotComponent they could be picked off programatically and efficiently, with no need for a mass of data to flow back to the kernel engine from the GUI or even for any large plot structure to be updated/regenerated. I've been asking for some time now.

(Another way to improve such things would be to get a whole new plot data strucure, that was efficiently mutable, such that ORIENTATION could be updated without having to form a copy of the whole PLOT3D structure to be sent back over the socket. But I don't expect that to happen any time soon...)

 

@beidouxing Your use of {} and [] is invalid. Ie. You really don't have the mathematical expressions that you think you do.

After replacing with (), and digging around, it seemed to me that both c[1] and c[2] are unbounded above when w is replaced in some way (that I believe is equivalent) as you laid out, over x,y,z >0.

@Markiyan Hirnyk This seems to be one of those weird cases where an initial call to `solve` seems to churn, yet interrupting it and trying again succeeds.

For both the direct attempt using {eq1,eq2} as well as Carl's method with elimination of y I am seeing `solve` churn. But then if I interrupt and retry, then after a few tries it works.

restart:
eq1:=((x-1)^2+(y-5)^2)^(1/2)+1/2*abs(x+y) = 3*2^(1/2):
eq2:=abs(x+2)^(1/2) = 2-y:
G:=proc(i) solve( {eq1,eq2}, [x,y] ); end proc:
for i from 1 to 10 do
  traperror(timelimit(2,assign('res',G(i))));
  if res<>'res' and res<>NULL then printf("attempt %a",i); i:=10; end if;
end do:
res;

attempt 5
                              [[x = -2, y = 2]]

I see a similar effect when trying Carl's manual elimination of y. The first time I try it goes one and on. And similarly if I try solve( eliminate( {eq1,eq2}, y )[2] ).

Curiously, by trying to eliminate x rather than y I get a piecewise expression from which the single solution can be picked off immediately (though it's awkward to split the y cases programmatically, and I did only manually).

restart:
eq1:=((x-1)^2+(y-5)^2)^(1/2)+1/2*abs(x+y) = 3*2^(1/2):
eq2:=abs(x+2)^(1/2) = 2-y:
sol:=eliminate( {eq1,eq2}, x ):
op~(sol[1]) assuming y<>2:
solve(%, allsolutions);
                               {x = -2, y = 2}

{y=2} union op~(sol[1]) assuming y=2;
                               {x = -2, y = 2}

Will the first step consist of replacing the squiggly and square brackets with round brackets? In Maple {} is for sets and [] is for lists, but perhaps you just intended to use () which is for delimiting subexpressions.

Also (and I could be wrong) but what happens when x and y become arbitrarily small and positive while z becomes arbitrarily large and positive? Could it be that c[1] and c[2] tend to infinity in such case (under the condition that t[1]-isolated-for-w equals t[2]-isolated-for-w, and either is used for substitution of w in c[1] and c[2])? Perhaps consider the special case that x=y. Do you have some other bounds on x,y,z apart from their being either all positive or all negative?

acer

I agree, it is very nice. It might be even more impressive if the extraction of a valid IC for u(0)=D(h)(0) were done programmatically. Even if it might not always suceed. Perhaps just a call to fsolve, utilizing the intended parameter values, perhaps supplying a target range (for fsolve).

hmm. this is beginning to sound familiar. I suspect that this site has seen this kind of thing before.

It work for me, with these three lines all in the same Execution Group.

printf("Enter the number of players:\n");
numplayers:=readline(terminal):
printf("Number of players is %s\n",numplayers);

Are you using Execution Groups or Document Blocks? Which version of Maple, can I ask?

acer

@taro Thanks for your comments. I know what there is to know about Worksheets vs Documents and Execution Groups vs Document Blocks, both in terms of what's available with the mouse & menus as well as what might be accomplished acting on the XML source of the file. I believe that know how to take programatically a pair of Exec Groups in a Doc Block and merge the Input of the former with the Output of the latter (they are linked by a target-redirect "Label" in the saved XML) into just one single Exce Group. I also believe that I know how to turn programatically an Exec Group with 2D Input into one with a prompt and 1D Maple Notation input. And I'm considering code to sweep through a Worksheet or Document file and do all the above, keeping Text and Components and Sections untouched. I'll have to see how that goes. 

Others have informed member nm about how to set Preferences, to use 1D Maple Notation instead of 2D Math, Worksheets instead of Documents, etc. But that's not what he asked.

He asked how to take a particular worksheet with many Execution Groups containing 2D Input and change it into one with those as 1D Maple Notation input.

He knows how to change each one by hand (context menu), but he wants an easy way to do them all at once. Since the main menubar's offerings convert Text pieces when attempting such a sweep I suggested that it might be done with custom code.

@Markiyan Hirnyk Your wrote,

x = 1.7218665298804079765305637769036280861977865585731

when you should have used,

x = -1.7218665298804079765305637769036280861977865585731

First 343 344 345 346 347 348 349 Last Page 345 of 592