acer

32373 Reputation

29 Badges

19 years, 333 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

It is, of course, trivial to scale the results below by the appropriate 1/2^k , simply by multiplying the generated Matrix by that factor. Or you can scale the two Matrix arguments passed into the procedure Gen.

restart;

interface(rtablesize=100):

with(LinearAlgebra):

M:=3:

F:=Matrix(M,M):
F[1,1] := 2:
F;

Matrix(3, 3, {(1, 1) = 2, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0})

L:=Matrix(M,M):
L:=LinearAlgebra[BandMatrix]([
      [seq(-sqrt(2*i-1)/(2*i-1)*sqrt(2*i-3),i=2..M)],
      [1,seq(0*i,i=1..M-1)],
      [seq((sqrt(2*i-3))/((2*i-3)*sqrt(2*i-1)),i=2..M)]]);

Matrix(3, 3, {(1, 1) = 1, (1, 2) = (1/3)*sqrt(3), (1, 3) = 0, (2, 1) = -(1/3)*sqrt(3), (2, 2) = 0, (2, 3) = (1/15)*sqrt(5)*sqrt(3), (3, 1) = 0, (3, 2) = -(1/5)*sqrt(5)*sqrt(3), (3, 3) = 0})

Gen:=proc(K::posint,A,B)
  Matrix(scan=triangular[upper],[seq([A,seq(B,i=j..2^(K-1)-1)],j=1..2^(K-1))]);
end proc:

 

Gen(2, LL, FF);

Matrix(2, 2, {(1, 1) = LL, (1, 2) = FF, (2, 1) = 0, (2, 2) = LL})

Gen(3, LL, FF);

Matrix(4, 4, {(1, 1) = LL, (1, 2) = FF, (1, 3) = FF, (1, 4) = FF, (2, 1) = 0, (2, 2) = LL, (2, 3) = FF, (2, 4) = FF, (3, 1) = 0, (3, 2) = 0, (3, 3) = LL, (3, 4) = FF, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = LL})

 

Gen(2, L, F);

Matrix(6, 6, {(1, 1) = 1, (1, 2) = (1/3)*sqrt(3), (1, 3) = 0, (1, 4) = 2, (1, 5) = 0, (1, 6) = 0, (2, 1) = -(1/3)*sqrt(3), (2, 2) = 0, (2, 3) = (1/15)*sqrt(5)*sqrt(3), (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (3, 1) = 0, (3, 2) = -(1/5)*sqrt(5)*sqrt(3), (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 1, (4, 5) = (1/3)*sqrt(3), (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = -(1/3)*sqrt(3), (5, 5) = 0, (5, 6) = (1/15)*sqrt(5)*sqrt(3), (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = -(1/5)*sqrt(5)*sqrt(3), (6, 6) = 0})

 

Gen(3, L, F);

Matrix(12, 12, {(1, 1) = 1, (1, 2) = (1/3)*sqrt(3), (1, 3) = 0, (1, 4) = 2, (1, 5) = 0, (1, 6) = 0, (1, 7) = 2, (1, 8) = 0, (1, 9) = 0, (1, 10) = 2, (1, 11) = 0, (1, 12) = 0, (2, 1) = -(1/3)*sqrt(3), (2, 2) = 0, (2, 3) = (1/15)*sqrt(5)*sqrt(3), (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (2, 9) = 0, (2, 10) = 0, (2, 11) = 0, (2, 12) = 0, (3, 1) = 0, (3, 2) = -(1/5)*sqrt(5)*sqrt(3), (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (3, 9) = 0, (3, 10) = 0, (3, 11) = 0, (3, 12) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 1, (4, 5) = (1/3)*sqrt(3), (4, 6) = 0, (4, 7) = 2, (4, 8) = 0, (4, 9) = 0, (4, 10) = 2, (4, 11) = 0, (4, 12) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = -(1/3)*sqrt(3), (5, 5) = 0, (5, 6) = (1/15)*sqrt(5)*sqrt(3), (5, 7) = 0, (5, 8) = 0, (5, 9) = 0, (5, 10) = 0, (5, 11) = 0, (5, 12) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = -(1/5)*sqrt(5)*sqrt(3), (6, 6) = 0, (6, 7) = 0, (6, 8) = 0, (6, 9) = 0, (6, 10) = 0, (6, 11) = 0, (6, 12) = 0, (7, 1) = 0, (7, 2) = 0, (7, 3) = 0, (7, 4) = 0, (7, 5) = 0, (7, 6) = 0, (7, 7) = 1, (7, 8) = (1/3)*sqrt(3), (7, 9) = 0, (7, 10) = 2, (7, 11) = 0, (7, 12) = 0, (8, 1) = 0, (8, 2) = 0, (8, 3) = 0, (8, 4) = 0, (8, 5) = 0, (8, 6) = 0, (8, 7) = -(1/3)*sqrt(3), (8, 8) = 0, (8, 9) = (1/15)*sqrt(5)*sqrt(3), (8, 10) = 0, (8, 11) = 0, (8, 12) = 0, (9, 1) = 0, (9, 2) = 0, (9, 3) = 0, (9, 4) = 0, (9, 5) = 0, (9, 6) = 0, (9, 7) = 0, (9, 8) = -(1/5)*sqrt(5)*sqrt(3), (9, 9) = 0, (9, 10) = 0, (9, 11) = 0, (9, 12) = 0, (10, 1) = 0, (10, 2) = 0, (10, 3) = 0, (10, 4) = 0, (10, 5) = 0, (10, 6) = 0, (10, 7) = 0, (10, 8) = 0, (10, 9) = 0, (10, 10) = 1, (10, 11) = (1/3)*sqrt(3), (10, 12) = 0, (11, 1) = 0, (11, 2) = 0, (11, 3) = 0, (11, 4) = 0, (11, 5) = 0, (11, 6) = 0, (11, 7) = 0, (11, 8) = 0, (11, 9) = 0, (11, 10) = -(1/3)*sqrt(3), (11, 11) = 0, (11, 12) = (1/15)*sqrt(5)*sqrt(3), (12, 1) = 0, (12, 2) = 0, (12, 3) = 0, (12, 4) = 0, (12, 5) = 0, (12, 6) = 0, (12, 7) = 0, (12, 8) = 0, (12, 9) = 0, (12, 10) = 0, (12, 11) = -(1/5)*sqrt(5)*sqrt(3), (12, 12) = 0})

 

Download block_band_matrix.mw

Using Maple 2015.2,

convert(hypergeom([a, b], [c], 1), StandardFunctions);

                   GAMMA(c) GAMMA(c - a - b)
                   -------------------------
                   GAMMA(c - a) GAMMA(c - b)

convert( hypergeom([a, b], [c], 1), GAMMA_related );

                   GAMMA(c) GAMMA(c - a - b)
                   -------------------------
                   GAMMA(c - a) GAMMA(c - b)

Also,

restart;

kernelopts(version);

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

 simplify( hypergeom([a, b], [c], 1) );

              GAMMA(c) GAMMA(c - a - b)
              -------------------------
              GAMMA(c - a) GAMMA(c - b)
restart;

kernelopts(version);

    Maple 18.02, X86 64 LINUX, Oct 20 2014, Build ID 991181

simplify( hypergeom([a, b], [c], 1) );

              GAMMA(c) GAMMA(c - a - b)
              -------------------------
              GAMMA(c - a) GAMMA(c - b)

I don't understand why some of your Questions are marked as Maple version 2015, and some with version 18, and some with 2018.

If you expression attains it maximum at the end-point x=100, for each R, then could you not just divide by the value there? I mean, divide the original expression by the expression evaluated at x=100.

Let's pretend that your example would not have that behaviour, and that the maximum value is attained at a different numeric x for each different numeric R.

More generally, you can construct a procedure that admits the value val for the parameter name nm, and then optimizes w.r.t. x=1..100. And this procedure could be made to return unevaluated if its first argument val is not a numeric value. And then you could plot the original expression divided by a call to that maximizing procedure.

The plot3d command would pass in different values for val.

The procedure could attempt to remember the return value for given values of val, since plot3d will pump in the same val several times (as it computes for both different x and different R, say).
 

restart;

Xmax:=proc(val,expr,nm::name)
  option remember, system;
  local res, xvar;
  if not val::numeric then return 'procname'(args); end if;
  xvar:=(indets(expr,name) minus {nm})[1];
  try
    res:=Optimization:-Maximize(eval(expr,nm=val),
                                xvar=1..100,method='branchandbound');
  catch:
  end try;
  if not res[1]::numeric then
    return Float(undefined);
  else
    return res[1];
  end if;
end proc:

 

CARA2 := x^(1-R)/(1-R);
#CARA2 := sqrt(abs(x-90))*x^(1-R)/(1-R);

x^(1-R)/(1-R)

Xmax(0.9,eval(CARA2,[R=Rdummy,x=xdummy]),Rdummy);

HFloat(15.848931924611136)

B := plot3d(CARA2, R = 0 .. .95, x = 1 .. 100):
B;

# If CARA2 always attains its maximum (for each R) at x=100 then
# this is simpler.

plot3d(CARA2/eval(CARA2, x=100),
       R = 0 .. .95, x = 1 .. 100);

Bnew:=plot3d(CARA2/Xmax(R,eval(CARA2,[R=Rdummy,x=xdummy]),Rdummy),
             R = 0 .. .95, x = 1 .. 100):
Bnew;

lnB := plot3d(ln(CARA2), R = 0 .. .95, x = 1 .. 100):
lnB;

lnBnew:=plot3d(ln(CARA2/Xmax(R,eval(CARA2,[R=Rdummy,x=xdummy]),Rdummy)),
               R = 0 .. .95, x = 1 .. 100):
lnBnew;

CARA1 := 1 - exp(-g*x);

1-exp(-g*x)

A := plot3d(CARA1, g = 0 .. 1, x = 1 .. 100):
A;

# Let's do this one just for fun, to illustrate how the use
# of the Xmax command differs from the above example.

Anew:=plot3d(CARA1/Xmax(g,eval(CARA1,[g=gdummy,x=xdummy]),gdummy),
             g = 0 .. 1, x = 1 .. 100):
Anew;

plots:-display(A, Anew, color=[red,blue]);

plots:-display(Anew, Bnew, color=[green, blue]);

 

Download Cara_thing.mw

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

First 168 169 170 171 172 173 174 Last Page 170 of 336