acer

32343 Reputation

29 Badges

19 years, 327 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

This question lacks important details.

What does, "...the part of the expression which has diff(y(x),x) in the expression" mean? What do you mean by "the part".

Could it mean the addend of an expression which is a sum? Could it also mean the multiplicand of an expression which is a product?

What if the expression were, say,

    sin( f( diff(y(x),x) ) + Q )

What "part" of that expression would you be you after?

What if the expression were 3*diff(y(x),x) ? Which "part" of that would you want?

@Teep It is unclear what you are asking.

Do you have the .mla file, and do not know how to utilize it? Or are you lacking that file?

If you lack that file then you can obtain it from under the link I gave.

That link I gave also has notes various ways to install it. The basic idea is that you need the location of the .mla & .help files to be in one of the locations assigned to the libname variable. You can accomplish that manually by appending to libname the location that you place them (and optionally do that in an initialization file). Or you can install to a special location for which Maple adjusts libname on launch, and that link mentions how to accomplish that automatically.

Try to follow the instructions. If you have problems tell us explicitly and clearly what you have tried so far.

Do you actually have the files? Are they from here?

restart;

kernelopts(version);

`Maple 2022.1, X86 64 LINUX, May 26 2022, Build ID 1619613`

with(IntegrationTools):

f := sin(x)/sqrt(2+sin(2*x)):

raw := eval(value(Change(expand(Int(f,x)),t=tan(x),t)),t=tan(x)):

Q := combine(simplify(convert(combine(simplify(raw,tan),
                                      radical,symbolic),
                              sincos),symbolic)):

FF := simplify(evalc(Re(Q))) assuming x::real;

(1/2)*arctan((sin(x)-cos(x))/(2+sin(2*x))^(1/2))-(1/4)*ln((2+sin(2*x))^(1/2)+sin(x)+cos(x))+(1/8)*ln((-2*sin(x)-2*cos(x))*(2+sin(2*x))^(1/2)+2*sin(x)*cos(x)+sin(2*x)+3)

FFF := simplify(expand(evalc(Re(Q)))) assuming x::real;

(1/2)*arctan((sin(x)-cos(x))/(2+2*sin(x)*cos(x))^(1/2))-(1/4)*ln((2+sin(2*x))^(1/2)+sin(x)+cos(x))+(1/4)*ln((2+sin(2*x))^(1/2)-sin(x)-cos(x))

simplify(diff(FF,x)-f);

0

simplify(diff(FFF,x)-f);

0

Download intfun2.mw

With the H I supplied then --  given the form of f -- the simplest check is likely the following (Maple 2022.1),

    simplify(diff(H,x) - f);
                      0

For the F you gave, one slightly terser check is,

    (simplify@@2)(expand(diff(F,x) - f))

My earlier concoction manipulates diff(H,x) in order to obtain f, which (as is quite often the case) is a more involved task that simplifying their difference to zero.

The integration should be fun to see.

@MaPal93 That old posting you cited is (IMO) not the best way to install the DirectSearch v.2 package, in modern Maple versions. Here are some alternatives, in a descending priority that I would prefer:

1) Open the Maple cloud directly from your Maple GUI, and install that package directly from there.
2) Visit the Maple cloud webpage for that package and download from there.
3) Use the installer that comes in the .zip file bundled at the Application Center page for that package.

All of those approaches should put the relevent files into some special location that Maple looks for (so that you don't have to manually adjust libname in an edited initialization file).

You may have to completely close the Maple GUI and relaunch in order to see the Help pages that come with it.

If none of those approaches work then it would be interesting to know what is in the folder/directory that'd be named as the output of this Maple command:
    cat(kernelopts(homedir),"/maple/toolbox");

I have not yet found a satisfactory way.

I got something backwards (a simplification challenge):

H := 1/2*(-arctan((cos(x) - sin(x))/sqrt(2 + sin(2*x)))
     - log(cos(x) + sin(x) + sqrt(2 + sin(2*x))))

-(1/2)*arctan((cos(x)-sin(x))/(2+sin(2*x))^(1/2))-(1/2)*ln(cos(x)+sin(x)+(2+sin(2*x))^(1/2))

combine(simplify(expand(rationalize(diff(H,x)))));

sin(x)/(2+sin(2*x))^(1/2)

Download backwds.mw

@C_R The second argument to the indets command specifies a type, and that is documented. That is why Tom's answer doesn't use the word "type" explicitly-- it's implied by that particular choice of command.

And type suffixed is documented.

note: The top-level (global) name suffixed is not protected (Maple 2022.1) and so could be assigned some value. Some modest defensive programming could avoid accidental failure in such a case, eg. by using unevaluation quotes as Carl did.

   indets(A, 'suffixed'(t, :-nonnegint))


By the way, if you wish to use select here then you can get by without the extra layers of a user-defined anonymous operator (arrow) and an `if` call, both shown in an earlier suggestion. You had,

   select(X -> `if`(type(X, 'suffixed(t, integer)'), true, false), lst)

The `if`(...,true,false) layer is not needed because type itself returns true or false. And the anonymous operator is not needed because any additional arguments (3rd onward) passed to select will get passed along to the 1st argument (as predicate). So you can get by with the terser and more efficient,

   select(type, lst, 'suffixed'(t,:-nonnegint))

That kind of use of (only) kernel builtins can bring a small absolute time savings on average. But the relative time savings can be large, and so it can often scale better to large examples. So it can be worthwhile to program in such a way when possible.

@nm Your odetest example induces the following call to solve, whose result is different on the second attempt (with Carl's redefinition in play...).

restart;

kernelopts(version);

`Maple 2022.1, X86 64 LINUX, May 26 2022, Build ID 1619613`

#from https://www.mapleprimes.com/questions/230035-Error-in-SolveToolsCancelInverses
CI__orig:= eval(SolveTools:-CancelInverses):
unprotect(SolveTools:-CancelInverses):
SolveTools:-CancelInverses:= e->
local _A;
    eval(CI__orig(eval(e, _Z= _A), _rest), _A= _Z)
:
protect(SolveTools:-CancelInverses, CI__orig):

P := (-42*((-2*x^2+3*x*y(x)+y(x)^2)/x^2)^(1/2*17^(1/2))*2^(-3/2*17^(1/2))*((-11/21*17^(1/2)-17/7)*x^(2*17^(1/2)+1)+y(x)*x^(2*17^(1/2))*(17^(1/2)+85/21))+4*(1/8*(-2*x^2+3*x*y(x)+y(x)^2)/x^2)^(-1/2*17^(1/2))*((2*y(x)+3*x)*17^(1/2)+17*x))/(-5/4*x^(2*17^(1/2))*2^(-3/2*17^(1/2))*((-2*x^2+3*x*y(x)+y(x)^2)/x^2)^(1/2*17^(1/2))*(17^(1/2)+21/5)+(1/8*(-2*x^2+3*x*y(x)+y(x)^2)/x^2)^(-1/2*17^(1/2))),
y(x):

a1 := solve(P): # first call

a2 := solve(P): # second call

nops([a1]);

1

nops([a2]);
a2[2];

2

-(1/2)*(17^(1/2)+3)*x

# The above call to `solve` happens here, for the given odetest example.
#
showstat(`ODEtools/Solve/EnvDropMultiplicity`,29);


`ODEtools/Solve/EnvDropMultiplicity` := proc(ee, X := NULL, {keepalreadysolveduntouched::truefalse := false, removelabel::truefalse := false})
local EE, sol, N, sys, zn, vars, sysaux, tmp, to_jet, j, k, _sum, Q, Q_eqs, P,
  copy_P, PL, P2, PL2, PL21, PQ, ee_signum, sol_signum;
       ...
  29                   sol := :-solve(ee,X,_rest)
       ...
end proc
 

Download cancelinverses_rum_ex.mw

@MalakMMK Here is something like the previous simple (manually written) looped code. Of course it now has to store the converged value since that's the kind of image you requested.

So I adjusted the looped code to store the converged values as a side-effect in a new Array. That Array is then used for the hue values in the image, according to classification according to nearest actual root. The iteration counts are also (still) returned, and those are extracted (in bulk) from the plot3d result and used for the intensity values in the image.

The classification by root takes slightly longer than the iterative process (which is slower in this looped code than it is using Escape, contrary to your claim).

Of course one could improve the performance of the code that classifies by root. I don't have the time for that. Perhaps you could do it; this is your project work, after all.

King_iter_Ma2_umm.mw

[edit: there are also examples for which symmetry can provide additional savings.]

@MalakMMK Do you understand than the two images compute two different things, which is one reason why they differ in speed (as well as the main reason why they different in coloring)?

The first image has four colors because it shades according to which root, and your current example has four roots. It takes some extra time to classify the points -- by root.

You wrote, "...in the second image I'm Always getting 3 colors" but that is not true. It has a variety of colors, whose hue corresponds to the number of iterations counted.

In my earlier code I tried to simplify the real and imaginary parts of the iterative formula. That simplification can be too expensive, and even unnecesary as my later code showed for the Hafiz method.

You should try to understand the earlier code to the degree that you could verify that it's working properly. (I might have made mistakes!) And if you cannot edit and adjust the code then how can you adequately understand it? If you cannot adequately understand the code then how can you use it in your coursework?

@MalakMMK In your most recent followup query (ie. the Repley immediately above) you have not made it completely clear what you want.

You have not provided the code you used to generate those images, which doesn't help with any guessing on out part.

You do not have to inline all of any attachments, here. You can upload it and then insert a link (instead of the whole contents, inlined).

I think that you might be trying to ask for something like this:
  - utilize the looped code (as used by my densityplot examples)
  - instead of producing the HUE-based densityplot image (colored by number of iterations to attain tolerance), produce the other kind of image I previously showed where the color is according to which root is closest to the converged value.

If that guess by me is correct then it could be done by extracting the hue data from the densityplot result and then treating it similarly to this line in my earlier procedure:

   # ...set the hue by position in the list of all roots
   G:=Array(zip((a,b)->min[index](map[evalhf](abs,rts-~(a+b*I))),
                  newt[..,..,1],newt[..,..,2]),datatype=float[8],order=C_order):

I may have some time to look at that tomorrow evening, or possibly the day after.

ps. I don't quite understand why you might prefer the manually written looped code. That Escape command provides a much faster (multithreaded, then compiled or evalhf'd) implementation of the loop's same iterate-while-counting-until-tolerance-met idea. The faster way worked fine for the Hafiz 4th order method.

@Stretto You wrote, "printing has nothing to do with mouse hovering".

I can think of one mechanism where a displayed list of point data could cause arbitrary extra information to be revealed upon mouse hover, another for mouse single left-click, another for mouse right-click, and another for mouse left-button-selection. None of those need show positional "graphs" of the data.

@PhearunSeng 

Tom's worksheet has eqs as a list.

Your image shows that you rewrote that so that eqs is a Matrix.

You claimed that your image shows you running Tom's worksheet. But your image shows that the command's that you are using are different from his.

Download Tom's attachment. Open that .mw file, and run it. Don't paste in something else.

Also, it makes little sense to have the equations be some scalars expressions added to Vectors. Be more careful about your syntax.

@PhearunSeng You are still calling restart after you define eqs.

First 97 98 99 100 101 102 103 Last Page 99 of 592