Rubrum Acer

27078 Reputation

29 Badges

17 years, 69 days
Ontario, Canada

Social Networks and Content at

"You do not need to leave your room. Remain sitting at your table and listen. Do not even listen, simply wait, be quiet, still and solitary. The world will freely offer itself to you to be unmasked, it has no choice, it will roll in ecstasy at your feet." -- Franz Kafka

MaplePrimes Activity

These are replies submitted by acer

@mmcdara The following seems "simple" to me.

Applying straight map to a datatype=float[8] rtable gets rid of that datatype. (It's elementwise operations like round~ that you might wish/need to avoid for this goal. This is one of several important ways that map and elementwise ~ are different in behaviour.)


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

S := Sample(Binomial(10, 1/3), 3);

     S := [5., 5., 2.]


          [5, 5, 2]

This now seems quite tangential to the original Question.

In my Answer I just wanted to show using evalf[16] to get several places more accuracy than with evalf[15], for the Quantile of the left tail of ChiSquare. I didn't mean to start a thread on UseHardwareFloats or various ways of mapping over hardware datatype rtables, etc. Sorry for any confusion. Please branch it off into a separate thread if you'd like to discuss that in detail.

@mmcdara It is interesting that the floating-point Quantile implementation uses hardware precision calculations that are not so accurate for the left-tail of the ChiSquare random variable.

That can be alleviated by using either:
- an exact symbolic formula for the inverse of the CDF (or exact rational input), then evalf'ing
- forced "software" floating-point calculuations, by either using Digits>=16 or setting UseHardwareFloats to false.



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


Y := RandomVariable(ChiSquare(2)):

CDF(Y, y);

piecewise(y < 0, 0, 1-exp(-(1/2)*y))

symb := Quantile(Y, y);


evalf[15](eval(symb, y=0.95));


# evidence that previous result was accurate
evalf[15](evalf[100](eval(symb, y=0.95)));


Quantile(Y, 0.95); # good


evalf[15](eval(symb, y=0.05));


# evidence that previous result was accurate
evalf[15](evalf[100](eval(symb, y=0.05)));


Quantile(Y, 0.05); # not so good


evalf[15](Quantile(Y, 0.05)); # not so good


evalf[15](evalf[16](Quantile(Y, 0.05))); # better




UseHardwareFloats:=false: Digits:=15:

Y := RandomVariable(ChiSquare(2)):

Quantile(Y, 0.05);



@The function Here is another look at Tom's idea, with 2D Input.

The essence of Tom's idea is that a Matrix of formulas can actually be obtained for your example, which provide a way to get A^n without actually powering the Matrix A by repeated multiplication.


A := `<,>`(`<|>`(0, 1, 0, 0), `<|>`(0, 0, 1, 0), `<|>`(1, 0, 0, 0), `<|>`(0, 0, 0, -1))

Matrix(%id = 36893627973028077188)

An := LinearAlgebra:-MatrixPower(A, n)

Matrix(%id = 36893627973028056468)

A^3, eval(An, n = 3)

Matrix(%id = 36893627972913816028), Matrix(%id = 36893627972913816148)

E := Equate(An, LinearAlgebra:-IdentityMatrix(4))

[(2/3)*cos((2/3)*Pi*n)+1/3 = 1, -(1/3)*cos((2/3)*Pi*n)+(1/3)*3^(1/2)*sin((2/3)*Pi*n)+1/3 = 0, -(1/3)*cos((2/3)*Pi*n)-(1/3)*3^(1/2)*sin((2/3)*Pi*n)+1/3 = 0, 0 = 0, -(1/3)*cos((2/3)*Pi*n)-(1/3)*3^(1/2)*sin((2/3)*Pi*n)+1/3 = 0, (2/3)*cos((2/3)*Pi*n)+1/3 = 1, -(1/3)*cos((2/3)*Pi*n)+(1/3)*3^(1/2)*sin((2/3)*Pi*n)+1/3 = 0, 0 = 0, -(1/3)*cos((2/3)*Pi*n)+(1/3)*3^(1/2)*sin((2/3)*Pi*n)+1/3 = 0, -(1/3)*cos((2/3)*Pi*n)-(1/3)*3^(1/2)*sin((2/3)*Pi*n)+1/3 = 0, (2/3)*cos((2/3)*Pi*n)+1/3 = 1, 0 = 0, 0 = 0, 0 = 0, 0 = 0, cos(Pi*n)+I*sin(Pi*n) = 1]

solve(E, allsolutions)

{n = 6*_Z1}


Originally _Z1, renamed _Z1~:
  is assumed to be: integer

Student:-Calculus1:-Roots(add(t^2, t = `~`[lhs-rhs](E)), n = 1 .. 30)

[6, 12, 18, 24, 30]




@wswain That is quite often done, and does't normally cause issues.

In the context of linear algebra, texts usually use I to mean the identity matrix.

(You seem to have confused that with Maple's use of I to denote the imaginary unit.)

@ecterrab One of the points is that there is no call to any diff or conjugate before the forget.

So what is being forgotten that affects the (sole, only) call to diff that happens afterwards?

(I already knew what the subfunctions option to forget is supposed to do, thanks. I just don't see how that is relevent when the problematic example call to diff was not also called before the forget&unwith. What is being forgotten?)

The difference does not seem to lie in Physics:-ModuleUnload (which gets called by issuing restart but not by issuing unwith(Physics) , btw).

I also tested forcing a call to that, and it doesn't seem to be the key.

@Preben Alsholm That is an interesting observation.

It's still not clear to me what is the difference, since :-diff doesn't have a remember table, just before this call to forget. Some other action may be key, induced by the forget(:-diff) call, related to whether option subfunctions is utilized.

(I have not yet traced through that call to forget, say in the debugger, to try and pinpoint the difference. Clearly the "forgetting" doesn't relate specifically to f(x) or its conjugate per se, since that was not previously used. But the forgetting does something, and option subfunctions=false apparently disables whatever that is...)


kernelopts(version); # No Physics update applied

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




op(4,eval(:-diff)); # no remember table


#forget(Physics:-diff); # doesn't see to matter here

:-diff(:-conjugate(f(x)), x);

diff(conjugate(f(x)), x)




op(4,eval(:-diff)); # no remember table

forget(:-diff,subfunctions=true); # default

:-diff(:-conjugate(f(x)), x);

(diff(f(x), x))*(-conjugate(f(x))/f(x)+2*abs(1, f(x))/signum(f(x)))


I wonder how it is useful to have *both* of these results.

select( has, ["itself"=%, op(%)], diff(y(x),x));

["itself" = (diff(y(x), x))^3, diff(y(x), x)]

select( has, ["itself"=%, op(%)], diff(y(x),x));

["itself" = Q*(diff(y(x), x))^3, (diff(y(x), x))^3]



I wonder how it is useful to have such different results
for the expanded versus unexpanded forms.


expr1 := (Q+diff(y(x),x)^2)/(diff(y(x),x)^3+R);
expr2 := expand(expr1):

(Q+(diff(y(x), x))^2)/((diff(y(x), x))^3+R)

select( has, [op(expr1)], diff(y(x),x));

[Q+(diff(y(x), x))^2, 1/((diff(y(x), x))^3+R)]

select( has, [op(expr2)], diff(y(x),x));

[Q/((diff(y(x), x))^3+R), (diff(y(x), x))^2/((diff(y(x), x))^3+R)]


@nm The Help page says "operands", and you say "parts", which is not exactly the same. If you meant operands then you could have made that clear at the start.

You wrote, "...I want to select the part of the expression which has diff(y(x),x) in the expression." But your use (lattermost, in the Reply directly above) of the select command is returning an expression of the same type as the input. So in your words you state that you want only the "parts" (operands, you now say), but your use of select will return something applied to some of the operands (so that the result is of the same type).

Moving on (and using select in your last mentioned manner) these look weird and quite possibly unuseful,

Is this useful?
How is the next result a useful part of the input?

arctan( diff(y(x),x), Q);
select(has, % ,diff(y(x),x));

arctan(diff(y(x), x), Q)

arctan(diff(y(x), x))

Is it useful to have *both* of these results?

select(has, %, diff(y(x),x));

(diff(y(x), x))^3

diff(y(x), x)

Q + diff(y(x),x)^3;
select(has, %, diff(y(x),x));

Q+(diff(y(x), x))^3

(diff(y(x), x))^3


It's a valid expression, though you might not encounter it in your cases.


select(has, %, diff(y(x),x));

2^(diff(y(x), x))



How is the next result a useful part of the input?


select(has, %, diff(y(x),x));

abs(1, diff(y(x), x))

abs(diff(y(x), x))


How is it useful for the result for the expanded form be so
different from the result for the unexpanded form?


expr1 := Q*(diff(y(x),x)^3+R);
expr2 := expand(expr1);
select(has, expr1, diff(y(x),x));
select(has, expr2, diff(y(x),x));

Q*((diff(y(x), x))^3+R)

Q*(diff(y(x), x))^3+Q*R

(diff(y(x), x))^3+R

Q*(diff(y(x), x))^3


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?



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


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),

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


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







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);

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.

First 7 8 9 10 11 12 13 Last Page 9 of 502