acer

32632 Reputation

29 Badges

20 years, 45 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

I'm not really sure what your goal is.

Is it something like this?

restart;

f:=GAMMA(L+2*q-3-k)/(GAMMA(L-k)*k)*((GAMMA(-2*q+L)*GAMMA(L+2*q-3-k)
   -GAMMA(L+2*q-3)*GAMMA(L-2*q-1-k)*(L+2*k-1-(4*k+2)*q))
   /((2*(-1+2*q))*(4*q-3)*GAMMA(L+2*q-3)*GAMMA(L+2*q-3-k)));

(1/2)*(GAMMA(-2*q+L)*GAMMA(L+2*q-3-k)-GAMMA(L+2*q-3)*GAMMA(L-2*q-1-k)*(L+2*k-1-(4*k+2)*q))/(GAMMA(L-k)*k*(-1+2*q)*(4*q-3)*GAMMA(L+2*q-3))

collect(numer(f),[k,GAMMA],u->u/denom(f));

(1/2)*(4*q-2)*GAMMA(L-2*q-1-k)/(GAMMA(L-k)*(-1+2*q)*(4*q-3))+(1/2)*GAMMA(L+2*q-3-k)*GAMMA(-2*q+L)/(GAMMA(L-k)*k*(-1+2*q)*(4*q-3)*GAMMA(L+2*q-3))+(1/2)*(-L+2*q+1)*GAMMA(L-2*q-1-k)/(GAMMA(L-k)*k*(-1+2*q)*(4*q-3))

 

Download collect_numer.mw

If that's right, then it would be slightly more efficient to do it as follows, and thereby call `denom` only once.

temp := denom(f):
collect(numer(f),[k,GAMMA],u->u/temp);
The backslash is the escape character. If you want a literal backslash then you can escape the backslash itself.

with(StringTools):

URL := "F:\\GoogleDrive\\api";

"F:\GoogleDrive\api"

SubstituteAll(URL, "\\", "/");

"F:/GoogleDrive/api"

 

Download string_subs.mw

I see three Sections in the uploaded Document, because the file is corrupted starting in the third Section.

Beton_Notat_og_opgaveark_ac.zip

I don't see anything past that point, as meaningful data.

On the other hand, the Standard GUI itself fails to recover and save as usable anything but the first two sections. Even when it claims (via file manager popup) that it's attempting to recover from the corrupt file, the Standard GUI still fails to close off the XML tags open at the end of the incomplete third section, and thus fails to recover all possible from that section in usable way. I find that to be disappointing behavior (and I've submitted several bugs reports about it).

There have been several dozen related reports over the years. It's not clear whether the primary trigger of the bug is the Danish language pack extension, or the inlining of several large images/canvases in the Documents. 

I may be able to address usefully only your first point.

When a Code Edit Region is collapsed a snippet is displayed, almost like a title of sorts. That's taken from the first line of the Region. If the first line is empty then so can that snippet be...

I've learned not to leave the first line of a Code Edit Region empty.

If you know the component's identity then you can toggle its `visible` property with the SetProperty command of the DocumentTools package.

If an Embedded Component (of which Code Edit Regions are one sort, under the hood) is toggled visible=false and you don't know its identity then the situation is a little tricky. On Sept 19, 2018 someone asked a Question about that. I answered with code which can be used/modified to return the identities of all components of a given sort.

I'm away from a computer for a few days, and copying the link to that other thread is hard, sorry.

For the followup example, even though combine (alone) is enough to handle the expression for t<1, I'll use combine@factor@expand below since it produces a terse form (with combined exponent) for either case t<1 and t>1.

restart;

expr := ((1-t)^2)^q;

                                    q
                          /       2\ 
                          \(1 - t) / 

combine(factor(expand(expr))) assuming t < 1;

                                 (2 q)
                          (1 - t)     

combine(factor(expand(expr))) assuming t > 1;

                                 (2 q)
                          (t - 1)

It also happens to fix up the inadvertantly expanded result from calling simplify under the assumption t>0, which the OP did. That is not fixed by wrapping with combine alone. (Here, combine@factor is enough.)

alt := simplify(expr) assuming t > 1;

                                      q
                        /           2\ 
                        \1 - 2 t + t / 

combine(factor(expand(alt))) assuming t > 1;

                                 (2 q)
                          (t - 1)

I have a mild fondness for uniform approaches. (Not that this solves all other examples, of course!)

restart;

kernelopts(version);

    Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750

sum(1/(1+x)^t, t=1..infinity, formal);

                               1
                               -
                               x

See also the Help page for topic updates,Maple2016,AdvancedMath and on that page the link to the bookmark #SymbolicSummation .

An unadorned and unmatched, literal, single right-quote is not valid syntax in the plaintext Maple language.

What you're asking for cannot be done with a literal single right-quote in plaintext 1D Maple Notation, unless it is wrapped in either a set of quotation marks or a set of left-quotes (aka name quotes).

And even such a quoted, literal, single right-quote were entered you'd still have to set things up to interpret it as a derivative. Which could be tricky if you want the notation to work automatically for any arbitrary function name, and not just f.

restart;

cc := arctan(sin(phi)/cos(phi))-arccos(cos(phi)):

simplify( cc ) assuming phi>0, phi<Pi/2;

                   0

simplify(evalc(convert( cc, ln ))) assuming phi>Pi/2, phi<Pi;

                  -Pi

simplify(expand( eval(cc,phi=x+2*n*Pi) )) assuming n::posint, x>0, x<Pi/2;

                   0

# non-constant
convert(simplify(evalc(convert( cc, ln ))),tan) assuming phi>Pi, phi<3*Pi/2;

          -Pi + arccot(cot(2 phi))

dd := arctan(sin(phi),cos(phi))-arccos(cos(phi)):

simplify( dd ) assuming phi>0, phi<Pi;

                   0

simplify(expand( eval(dd,phi=x+2*n*Pi) )) assuming n::posint, x>0, x<Pi;

                   0

eval(cc, phi=5*Pi/4);

                   Pi
                - ----
                   2
restart;
A:=45*Unit(cm): B := 5.3*Unit(m):
C:=A+B;
          C := 45 [cm] + 5.3 [m]

C:=simplify(C);
           C := 5.750000000 [m]

Units:-Standard:-round( C );
                6 [m]
restart;
with(Units:-Standard, round):
A:=45*Unit(cm): B := 5.3*Unit(m):
C:=A+B;
          C := 45 [cm] + 5.3 [m]

C:=simplify(C);
           C := 5.750000000 [m]

round(C);
                6 [m]
restart;
with(Units:-Standard):
A:=45*Unit(cm): B := 5.3*Unit(m):
C:=A+B;
           C := 5.750000000 [m]

round(C);
                6 [m]

Another difference is that Units:-Standard:-round will not automatically "combine" units to the base SI units. In the following example it will not turn cm into meters, where round(0.054) becomes zero.

restart;
C :=  5.4*Unit(cm);
                C := 5.4 [cm]

simplify( round( C ) );
                     0

Units:-Standard:-round( C );
                   5 [cm]

combine( round( C ), units );
                  1/20 [m]

So which approach you choose could depend on whether you want rounding in terms of the original unit or the base SI unit.

It is an initially known constant in Maple, as a stand-in for Euler's constant (also known as the Euler-Mascheroni constant).

See the help page for Topic initialconstants.

evalf(gamma);

                   0.5772156649

restart;

ee := 3*log[10](a)-log[10](b);

3*ln(a)/ln(10)-ln(b)/ln(10)

ans := combine(ee,ln,symbolic);

ln(a^3/b)/ln(10)

inertans := applyrule(ln(x::anything)/ln(y::posint)=%log[y](x), ans);

%log[10](a^3/b)

combine(value(inertans) - ee, symbolic);

0

InertForm:-Display(inertans, inert=false);

%log[10](a^3/b)

 

Download some_log10.mw

The fine structure constant is not a derived constant in the ScientificConstants package.

Using rhs on a particular indexed position where you think an equation might lie -- when that position might vary -- is not a great idea. (It is common, inferior use of results from dsolve numeric, with listprocedure output.)

restart;

with(ScientificConstants):

form:=eval(derive,select(type,[GetConstant(e)],`=`));

2^(1/2)*(alpha*h/(mu[0]*c))^(1/2)

raw:=subsindets(form,And(name,Non(constant)),Constant);

2^(1/2)*(ScientificConstants:-Constant([fine_structure_constant])*ScientificConstants:-Constant([Planck_constant])/(ScientificConstants:-Constant([permeability_of_vacuum])*ScientificConstants:-Constant([speed_of_light_in_vacuum])))^(1/2)

evalf(raw);

0.1602176620e-18

evalf(Constant(e));

0.1602176620e-18

 

Download const_derive.mw

restart;

ans:=numapprox:-minimax(LambertW(x),x=0.3..30.0,[3,2],1,'maxerror');

(0.49622184e-3+(0.2471621408e-1+(0.5095498506e-2+0.2054985893e-4*x)*x)*x)/(0.279566316e-1+(0.2370869536e-1+0.1803666695e-2*x)*x)

maxerror;

0.8223993648e-3

plot(abs(LambertW(x)-ans),x=0.3..30,
     size=[600,200],gridlines=false);

 

Download lambertw_minimax.mw

It sounds as if you are trying to describe what Maple provides through its Statistics package as the ProbabilityTable discrete distribution.

The Statistics:-Sample command can be used to generate samples from it. Eg,

restart;

with(Statistics):

P := [1/2,1/4,1/8,1/16,1/16];

X := RandomVariable(ProbabilityTable(P)):

S:=Sample(X, 10^5);

Tally(S);

Histogram(S);

And of course you can use Sample(X, 1) to produce a sample of size one.

You can convert a string to a name, or use nprintf to construct a name.

You may be making the mistake of thinking that a name somehow contains the left quotes, just because it prints that way. But it prints that way for clarity (and because it's the easy way to enter it literally).

First 171 172 173 174 175 176 177 Last Page 173 of 339