Maple 2022 Questions and Posts

These are Posts and Questions associated with the product, Maple 2022

How do we compute integrals of functions or expressions that have units attached?
For example

v__1 := proc (t) options operator, arrow; 3*Unit('m'/'s') end proc

proc (t) options operator, arrow; 3*Unit('m'/'s') end proc

(1)

v__2 := 4*Unit('m'/'s')

4*Units:-Unit(m/s)

(2)

s__1 := int(v__1(t), t = 0 .. 5)

15*Units:-Unit(m/s)

(3)

s__2 := int(v__2, t = 0 .. 5)

20*Units:-Unit(m/s)

(4)

NULL


The results of the integrals have the wrong units.

Download integration_with_units.mw

Let's say we have four equations and four unknowns and we use solve to find a solution.

The return value of solve is a set.

Here is an example

solve({T__1 = m__1*a, a = R*alpha, -R*T__1+R*T__2 = I__s*a/R, g*m__2-T__2 = m__2*a}, {T__1, T__2, a, alpha})

{T__1 = R^2*g*m__2*m__1/(R^2*m__1+R^2*m__2+I__s), T__2 = m__2*g*(R^2*m__1+I__s)/(R^2*m__1+R^2*m__2+I__s), a = R^2*g*m__2/(R^2*m__1+R^2*m__2+I__s), alpha = R*g*m__2/(R^2*m__1+R^2*m__2+I__s)}

(1)

NULL


If we want to make the four expressions above procedures, the manual way is to basically copy the right-hand side of each expression and then write

T__1 := (R,m__1, m__2, g, I__s) -> ...

T__2 := (R,m__1, m__2, g, I__s) -> ...

a := (R,m__1, m__2, g, I__s) -> ...

alpha := (R,m__1, m__2, g, I__s) -> ...

Is there a way to do this automatically from the return value of solve?

If the return value were a list, I would use something like

T__1 := unapply(result[1], R, m__1, m__2, g, I__s)

T__2 := unapply(result[2], R, m__1, m__2, g, I__s)

a := unapply(result[3], R, m__1, m__2, g, I__s)

alpha := unapply(result[4], R, m__1, m__2, g, I__s)

But the return value is not a list.

So, in summary my quesions are

1) what, in general, is the best way to obtain the desired procedures?

2) is there a way to use the strategy I suggested if the result were a list, but for sets?

Download solveEqs.mw

Dear Maple users

I have encountered a very strange error at one of my students. When using functions from the Expression Palette, she receives an error. It happens every time she is using this Palette. A reinstallation of Maple didn't help solve this issue. When using Command Completion for the very same function (for example cosine or square root), it works properly. 

She did send a Maple file to me in order for me to investigate it. I opened it and reexecuted the entire document. The error messages remained. I tried applying the functions from the Expression Palette myself resulting in the same errors. I even opened a new document and tried it again. Still an error. Then I closed Maple completely and opened it again. Within a new document, I applied a function from the Expression Palette. Now it worked!! I can't seem to understand  the logic behind this behavior. The file sent to me by the student obviously contain some kind of error, but why will this error spread to a new document, which I have opned on my own computer? My own computer does not have any issues with Maple. 

I have attached the Maple file with the errors and a screen shot. I hope someone can explain this strange behavior and tell me how I can help this student make Maple work again. 

Kind regards,

Erik V.

Maple file:

Error.mw

After saving and closing my maple file, it was corrupted when I tried to open it again later. 

I tried searching for a solution without any luck...can someone help me repair it?

Regnede_Eksamenssæt.mw

(When it asks to save it as Regnede_Eksamenssæt_1 only a small part of the document is included)

The documentation on plots:-densityplot says

Any additional arguments are interpreted as options which are specified as equations of the form option = value. For example, the option grid = [m, n] where m and n are positive integers specifies that the plot is to be constructed on an m by n grid at equally spaced points in the ranges a..b and c..d respectively. By default a 49 by 49 grid is used; thus 2401 points are generated, and 2401 colored cells are displayed.

Consider the following simple example

g := proc (x, y) print(x, y); return 55 end proc

plots:-densityplot(g, 1 .. 4, 2 .. 8, grid = [5, 5])

 

NULL

NULL


If we look at the output from the print statement inside of we see

Download DensityPlotGridQuestions.mw

That is, there are 16 points in the grid, not 5x5=25.

Is the documentation incorrect or did I miss something?

This question is about an aspect of the code below. In fact, the code could be made simpler to get at the question, but I chose to show you how the problem originated. 

We start with a 4x3 matrix A. There is a procedure, convertArrayToTable, that takes this matrix and creates a table. The table is such that the keys are the numbers in the first column of A. For each such key k1, the associated value is another table. The latter table has as keys the values in the second column that have k1 in the first column.

Now, further below, if you are curious I write about why I am doing this (what the exact real problem is). For now, I am generating a matrix B which in is formed by the concatenation of A and 2A, along the column (ie, A on top of 2A).

So for this matrix B, the table T that is generated has, for example a key 1 and the associated value is a table with keys 0.2 and 0.400000000000000.

I wish to be able to access T[1][0.400000000000000] but this is not working and I don't know why.
 

restart

  convertArrayToTable := proc(arr)
        local m, t, i, c1, c2, c3:

        m := ArrayTools:-Size(arr)[1]:
        t := Table([]):

        for i from 1 to m do:
                c1 := arr[i,1]:
                c2 := arr[i,2]:
                c3 := arr[i,3]:

                if not assigned(t[c1]) then:
                        t[c1] := table([ c2 = c3]):
                else:
                        t[c1][c2] := c3:
                end:
        end:
        print(t):

        return t:
end:NULL

A := Matrix([[1, .2, 3], [2, .2, 6], [3, .2, 9], [4, .2, 12]])

Matrix(%id = 36893488151958141876)

(1)

B := ArrayTools:-Concatenate(1, A, Matrix(`<|>`(A[1 .. (), 1], 2*A[1 .. (), 2 .. 3])))

Matrix(%id = 36893488151958124892)

(2)

T := convertArrayToTable(B)

t

(3)

T[1]

t[1]

(4)

T[1][.2]

3

(5)

print(T[1])

t[1]

(6)

assigned(T[1])

true

(7)

Why can't I access the following key?

assigned(T[1][.400000000000000])

false

(8)

assigned(T[1][.2])

true

(9)

NULL

Download tableDecimalIndex.mw

 

So now just a brief note on why I want to create such a table.

I want to create a density plot based on the values in the rows of B. In the case of the simple example shown above, the grid of values would be based on values of x from 1 to 4 and of y from 0.2 to 0.400000000000000. Then I would specify, say "grid=[5,3]" for an eight point grid. 

In this example I am assuming the points used by the densityplot procedure would be exactly the ones in the rows of B, ie (1,0.2), (2,0.2), (3,0.2), (4,0.2),(1,0.400000000000000),(2,0.400000000000000),(3,0.400000000000000),(4,0.400000000000000).

The function I would pass in the signature

densityplot(f, a..b, c..d)

would be a custom procedure that I am assuming would be called as f(x,y) and would simply look up T[x][y] in the table I created to get the value.

Of course in my real problem the grid has way more points.

I am making a lot of assumptions about this densityplot procedure, but the documentation isn't very clear at all.

Here is a proof of concept of what I am trying to achieve (note that below, I am avoiding the issue of the decimal keys in tables by using integers instead):
 

restart

  convertArrayToTable := proc(arr)
        local m, t, i, c1, c2, c3:

        m := ArrayTools:-Size(arr)[1]:
        t := Table([]):

        for i from 1 to m do:
                c1 := arr[i,1]:
                c2 := arr[i,2]:
                c3 := arr[i,3]:

                if not assigned(t[c1]) then:
                        t[c1] := table([ c2 = c3]):
                else:
                        t[c1][c2] := c3:
                end:
        end:
        print(t):

        return t:
end:NULL

A := Matrix([[1, 2, 3], [2, 2, 6], [3, 2, 9], [4, 2, 12]])

Matrix(%id = 36893488151876893500)

(1)

B := ArrayTools:-Concatenate(1, A, Matrix(`<|>`(A[1 .. (), 1], 2*A[1 .. (), 2], 2*A[1 .. (), 3])), Matrix(`<|>`(A[1 .. (), 1], 3*A[1 .. (), 2], 3*A[1 .. (), 3])), Matrix(`<|>`(A[1 .. (), 1], 4*A[1 .. (), 2], 4*A[1 .. (), 3])))

Matrix(%id = 36893488151876862548)

(2)

T := convertArrayToTable(B)

t

(3)

f := proc(x,y)
        global T:
        print(x,y," Returning ",T[x][y]):
        return T[x][y]:
end: 

g := proc (x, y) print(x, y); return 55 end proc

plots:-densityplot(g, 1 .. 4, 2 .. 8, grid = [5, 5])

 

plots:-densityplot(f, 1 .. 4, 2 .. 8, grid = [5, 5])

Error, (in Plot:-ColorScheme) unable to produce gradient shading from given data

 

NULL


In the above output, the output from the print statement in the f procedure is not being shown. Locally on my computer it is shown and is called at the expected values (the ones in the rows of B). So that is all good. The issue seems to always go back to keying in to tables with certain (but not all) decimal numbers

 

Download DensityPlot.mw

Let us begin with few simulations: 
 

restart;

CodeTools:-Usage(plots['pointplot3d'](Matrix((proc (_) options operator, arrow; [_[() .. (), 1]-_[() .. (), 3], _[() .. (), 2]-_[() .. (), 4], _[() .. (), 5]] end proc)(convert(ssystem("wolframscript -code \"RandomPoint[Simplex[IdentityMatrix[5]], 2*^4]\"")[-1], FromMma)), scan = [rectangular, columns], datatype = float[4]), scaling = constrained))

memory used=0.57TiB, alloc change=91.51MiB, cpu time=18.77m, real time=15.86m, gc time=4.91m

 

CodeTools:-Usage(plots['pointplot3d'](Matrix((proc (_) options operator, arrow; [_[() .. (), 1]-_[() .. (), 3], _[() .. (), 2]-_[() .. (), 4], _[() .. (), 5]] end proc)(convert(ssystem("wolframscript -code \"RandomPoint[Sphere[5], 2*^4, ConstantArray[List[0, 1], 5]]\"")[-1], FromMma)), scan = columns, datatype = float[4]), scaling = constrained))

memory used=0.56TiB, alloc change=-12.08MiB, cpu time=18.70m, real time=15.11m, gc time=5.69m

 

NULL


 

Download iDistributionVector.mws

Well, I'd like to prove (through the use of Maple): 

transform((x1, x2, x3, x4, x5) -> [x1 - x3, x2 - x4, x5])(inequal(And((x || (1 .. 5)) >=~ 0, norm([x || (1 .. 5)], 1) = 1))) # not Maple syntax

is equivalent to a filled pyramid

ImplicitRegion((X, Y, Z), 0 <= Z <= 1 - abs(X) - abs(Y)) # not SymPy syntax

transform((x1, x2, x3, x4, x5) -> [x1 - x3, x2 - x4, x5])(inequal(And((x || (1 .. 5)) >=~ 0, norm([x || (1 .. 5)], 2) = 1))) # not Maple syntax

is equivalent to a hemi-ball

ImplicitRegion((X, Y, Z), 0 <= Z <= sqrt(1 - X**2 - Y**2)) # not SymPy syntax

, and 

transform((x1, x2, x3, x4, x5) -> [x1 - x3, x2 - x4, x5])(inequal(And((x || (1 .. 5)) >=~ 0, norm([x || (1 .. 5)], 'infinity') = 1))) # not Maple syntax

is equivalent to a solid cuboid

ImplicitRegion((X, Y, Z), -1 <= X <= 1 & -1 <= Y <= 1 & 0 <= Z <= 1) # not SymPy syntax

. (Here, for the convenience of the descriptions, I utilize some non-standard notation from .) 
Note that ”two regions are equal" is a two-way property, which means the following proof 

is(Z >= 0) and is(Z <= 1 - abs(X) - abs(Y)) assuming (X, Y, Z) =~ (x1 - x3, x2 - x4, x5), x || (1 .. 5) >=~ 0, add(x || (1 .. 5)) = 1;
                              true
(*Accordingly, the latter region is a subset of the former one.*) 

is incomplete (because it's hard to determine whether the is routine always performs equivalent transformations in internal evaluation). 

So, can I execute such eliminations in Maple?

As the code:

poly := x^4 + 8*x + 12:
galois(poly, x)

"4T4", {"A(4)"}, "+", 12, {"(1 2 4)", "(2 3 4)"}

 Then I know it's Galois group has to be (isomorphic to) A4. And I can draw its Subgroup Lattice:

DrawSubgroupLattice(GaloisGroup(poly, x), 'indices')

But according to Galois's theory, each subgroup represents an intermediate field. As far as I know, ⑤⑥⑦⑧ are Q(r1),Q(r2),Q(r3) and Q(r4), respectively, where ri is the root of equation x^4+8x+12. But I have no idea what fields ②③④⑨ means. How do you calculate out those intermediate fields with maple?

I am a bit confused that why the color option in the following plot3d does not work.

plot3d( [ b, ( b^2 ) / 4, -b / 2 ], b = -4 .. 4, c = -4 .. 4, thickness = 5, color = red  ); 

The output is the following.

This is part of a package I put together in VScode. Testing it using CMaple.exe worked fine from the code editor. Then I imported it into Maple and saved it as a package, After ra restart  using using with(....) to load it, the special types defined in the package are not recognised. Procedures that don't check for the special types work ok. I have included one of each in the worksheet. 

If I just read in the .mpl file things do work.

What is the cause of this problem?

A secondary question. If I use the same special types in another package. Would that cause a conflict if both are loaded together?

restart

RationalTrigonometry:=module()
    option package;
    
    export
        AcuteObstuseQ,
        AcuteObstuseS,
        AltitudeQ,
        CircleParm,
        CircumCirQ,
        CfstoLeqn,
        CrossLaw,
        LinePrll,
        LinePrpnd,
        LinePts,
        LPproj,
        MedianQ,
        #QPrj,
        Quadrance,
        Quadrea,
        QQF,
        SolidSpread,
        SpreadLawQuadrea,
        SpreadLaw,
        SpreadPoly,
        Spread,
        Spreads123,
        TQF,
        TSF,
        UHG;

local MyModule,RelDPxyz,ppp,xpsn,ypsn,zpsn;

MyModule:= module()
uses TT= TypeTools;
global _T1, _T2L, _T2V, _T2VR, _T3L, _T3V, _T3VC, _T3VR, _T4L, _MyType,GeomClr,Prntmsg, prjpsn;
          GeomClr:="Blue";
          Prntmsg:="y";
          prjpsn:=3;

local
     MyTypes:= {_T1, _T2L, _T2V, _T2VR, _T3L, _T3V, _T3VC, _T3VR, _T4L},
     AllMyTypes:= MyTypes union {_MyType},
     ModuleLoad,
      ModuleUnload:= proc()
     local T;
          for T in AllMyTypes do if TT:-Exists(T) then TT:-RemoveType(T) end if; end do;
          return
     end proc;

     ModuleLoad:= proc()
     local
          g, #iterator over module globals
          e
     ;
          
          ModuleUnload();
          #op([2,6], ...) of a module is its globals.
          for g in op([2,6], thismodule) do
               e:= eval(g);
               #print("e",e);
               if g <> e and e in AllMyTypes then
                    error "The name %1 must be globally available.", g
               end if
          end do;
          TT:-AddType(_T1, algebraic);
          TT:-AddType(_T2V, 'Vector(2, algebraic)');
          TT:-AddType(_T2VR, 'Vector[row](2, algebraic)');
          TT:-AddType(_T2L, [algebraic $ 2]);
          TT:-AddType(_T3V, 'Vector(3, algebraic)');
          TT:-AddType(_T3VC, 'Vector[column](3, algebraic)');
          TT:-AddType(_T3VR, 'Vector[row](3, algebraic)');
          TT:-AddType(_T3L, [algebraic $ 3]);
          TT:-AddType(_T4L, [algebraic $ 4]);
          TT:-AddType(_MyType, MyTypes);
          return
     end proc;
export
     WhichMyType:= proc(X)
     local S:= select(T-> X::T, MyTypes), n:= nops(S);
         printf("%a is ", X);
         if n=0 then printf("not any of the special types.\n")
         else printf("type %a.\n", `if`(n=1, S[], Amd(S[])))
         fi
      end proc;
export    
     Dsp:= proc(msg:=" empty",prnt:=Prntmsg )
          if prnt = "y" then print(msg); end if;
     end proc;

     ModuleLoad()    
     end module;

ppp:=proc(prjpsn)
     description " the position x,y,z or z,x,y in a Vector";   
     if prjpsn=1 then   
        xpsn:=2;
        ypsn:=3;
        zpsn:=1;
      else  
        xpsn:=1;
        ypsn:=2;
        zpsn:=3;  
     end if;
    return xpsn, ypsn, zpsn
end proc;
    






#$include "Rational_Trigonometry\Quadruple Quad Formula.mpl"
#$include "Rational_Trigonometry\Quadrances_Overload_procs.mpl"

Quadrance :=overload([
   
   # 1 Quadrances p0 [x,y]
        proc(p0::{_T2L,_T2V}, clr := GeomClr,$)
                option overload;
                description "Calculates Quadrance of a [x,y] point";
                uses LinearAlgebra;         
                if clr = "b" or clr = "B" or clr = "blue" or clr = "Blue" then
                                MyModule:-Dsp(" Blue");
                                        BilinearForm(p0, p0, conjugate = false) ;
                        elif clr = "r" or clr = "R" or clr = "red" or clr = "Red" then
                                MyModule:-Dsp(" Red");
                                        p0[1]^2 - p0[2]^2 ;
                        elif clr = "g" or clr = "G" or clr = "green" or clr = "Green" then
                                MyModule:-Dsp(" Green");
                                        2*p0[1]*p0[2];
                end if;
        end proc,
# 7 Quadrances Point to Plane and intersection point 3D
        proc(p0::{_T3L,_T3V},pl::{_T4L,`+`,procedure},var::_T3L:=[x,y,z],$)
        option overload;
                local i, dlambda,nlambda,lambda,Q   ,intrP,  Vpn  ,f1  ;
                if pl::_T4L then
                        Vpn:=convert(pl,Vector[row]);
                 elif pl::{`+`,procedure} then
                        f1 := `if`(pl::procedure, pl(vars[]), pl);
                        Vpn:=<coeff(f1,var[1]),coeff(f1,var[2]),coeff(f1,var[3]),coeff(coeff(coeff(f1,var[3],0),var[2],0),var[1],0)>;
                end  if;
                
                nlambda:=(Vpn[1]*p0[1]+Vpn[2]*p0[2]+Vpn[3]*p0[3]+Vpn[4]);
                dlambda:=Vpn[1]^2+Vpn[2]^2+Vpn[3]^2;
                lambda:=nlambda/dlambda;
                intrP:=`<|>`(seq(p0[i]+lambda*Vpn[i],i=1..3));
                Q:=nlambda^2/dlambda;
                MyModule:-WhichMyType(pl);
                MyModule:-Dsp("Quadrance Point to Plane & intersect Point");
                return Q,intrP
                end proc,

        # 2 Quadrances p0 [x,y,z]
        proc(p0::{_T3L,_T3V}, clr := GeomClr,$)
                option overload;
                description "Calculates Quadrance of a [x,y,z] point Blue only";
                uses LinearAlgebra;         
                if clr = "b" or clr = "B" or clr = "blue" or clr = "Blue" then
                         MyModule:-Dsp("Quadrance 3D Point Blue");
                                BilinearForm(p0, p0, conjugate = false);
                        else print("3D Not yet implimented for Red or Green Geometry" );        
                end if;
        end proc,

        # 3 Quadrances P0-P1 [x,y]
         proc(p0::{_T2L,_T2V},p1::{_T2L,_T2V}, clr := GeomClr,$)
                option overload;
                description "Quadrance between two [x,y] points";        
                uses LinearAlgebra;                                
                if clr = "b" or clr = "B" or clr = "blue" or clr = "Blue" then                  
                                MyModule:-Dsp( "Quadrance between two 2D Points Blue") ;
                                 BilinearForm(p0 - p1, p0 - p1, conjugate = false);                        
                        elif clr = "r" or clr = "R" or clr = "red" or clr = "Red" then
                                        MyModule:-Dsp( "Quadrance between two 2D Points Red") ;
                                         (p0[1] - p1[1])^2 - (p0[2] - p1[2])^2;                         
                        elif clr = "g" or clr = "G" or clr = "green" or clr = "Green" then                         
                                        MyModule:-Dsp( "Quadrance between two 2D Points Green") ;
                                         (2*p1[1] - 2*p0[1])*(p1[2] - p0[2]);                        
                end if;
        end proc,

        # 4 Quadrances p0-p1 [x,y,z]
        proc(p0::{_T3L,_T3V},p1::{_T3L,_T3V}, clr::string := GeomClr,$)
                option overload;
                description "Calculates Quadrance of between two points/vectors [x,y,z] Blue only";
                uses LinearAlgebra;         
                if clr = "b" or clr = "B" or clr = "blue" or clr = "Blue" then
                                        MyModule:-Dsp( "Quadrance between two 3D Points Blue") ;
                                        BilinearForm(p0 - p1, p0 - p1, conjugate = false);
                        else print("Not at this point  implimented for Red or Green Geometry" );        
                end if;
        end proc,

        # 5 Quadrances Point to Line and intersection point 2D
        proc(p0::_T2L, l1::{_T3L,`+`,procedure}, vars::_T2L:=[x,y],clr:=GeomClr)
                option overload;
                local f1,P0:=p0,P1;
                if l1::_T3L then
                        P1:=l1;
                 else
                        f1 := `if`(l1::procedure, l1(vars[]), l1);
                        P1:=[coeff(f1,vars[1]),coeff(f1,vars[2]),coeff(coeff(f1,vars[1],0),vars[2],0)];
                end if;
                if  clr = "b" or clr = "B" or clr = "blue" or clr = "Blue"  then
                        MyModule:-Dsp( "Quadrance 2D Point to Line & intersect Point Blue") ;
                        return (P0[1]*P1[1] + P0[2]*P1[2] + P1[3])^2/(P1[1]^2 + P1[2]^2),
                        [((-P0[2]*P1[2] - P1[3])*P1[1] + P0[1]*P1[2]^2)/(P1[1]^2 + P1[2]^2),
                        ((-P0[1]*P1[1] - P1[3])*P1[2] + P0[2]*P1[1]^2)/(P1[1]^2 + P1[2]^2)];
                         
                 elif clr = "r" or clr = "R" or clr = "red" or clr = "Red"  then
                        if P1[1]^2 - P1[2]^2 <> 0 then
                                MyModule:-Dsp( "Quadrance 2D Point to Line & intersect Point Red") ;
                                return (P0[1]*P1[1] + P0[2]*P1[2] + P1[3])^2/(P1[1]^2 - P1[2]^2),
                                [((-P0[2]*P1[2] - P1[3])*P1[1] - P0[1]*P1[2]^2)/(P1[1]^2 - P1[2]^2),
                                ((P0[1]*P1[1] + P1[3])*P1[2] + P0[2]*P1[1]^2)/(P1[1]^2 - P1[2]^2)];
                                
                         else
                                "Null Red"
                        end if;
                 
                        #"Input ERROR "Red"";         
                 elif clr = "g" or clr = "G" or clr = "green" or clr = "Green" then
                        if P1[1]*P1[2] = 0 then
                                "Null Green";
                         else
                                 MyModule:-Dsp( "Quadrance 2D Point to Line & intersect Point Green") ;
                                return 1/2*(P0[1]*P1[1] + P0[2]*P1[2] + P1[3])^2/(P1[1]*P1[2]),
                                [1/2*(P0[1]*P1[1] - P0[2]*P1[2] - P1[3])/P1[1],
                                1/2*(-P0[1]*P1[1] + P0[2]*P1[2] - P1[3])/P1[2]];
                                 
                        end if;
                 else
                        "Input ERROR Green";  
                end if;
        end proc,
        
        # 6 Quadrances Point to Line and intersection point 3D
        proc(p0::{_T3L,_T3V},lP::{_T3L,_T3V},lV::{_T3V},$)
                option overload;
                local lambda , Q ,intrP ;
                lambda:=((p0[1]-lP[1])*lV[1]+(p0[2]-lP[2])*lV[2]+(p0[3]-lP[3])*lV[3])/(lV[1]^2+lV[2]^2+lV[3]^2);
                print(lambda);
                Q:=((p0[1]-lP[1]-lambda*lV[1])^2+(p0[2]-lP[2]-lambda*lV[2])^2+(p0[3]-lP[3]-lambda*lV[3])^2);
                
                intrP:=lP+lambda*lV;
                MyModule:-Dsp("Quadrance Point to 3D Line and Intersect Point");

                return Q,intrP
        end proc

        

        

]):


QQF := proc(Q1, Q2, Q3, Q4)
 ((Q1 + Q2 + Q3 + Q4)^2 - 2*Q1^2 - 2*Q2^2 - 2*Q3^2 - 2*Q4^2)^2 = 64*Q2*Q1*Q3*Q4;
 end proc;

     

end module:

 

RationalTrigonometry:-Quadrance([0,2,3],<3,1,-1>,<2,1,2>);

1/3

"Quadrance Point to 3D Line and Intersect Point"

25, Vector[column](%id = 36893489965928498348)

RationalTrigonometry:-Quadrance([4,-4,3],2*x-2*y+5*z+8,[x,y,z]);

2*x-2*y+5*z+8 is type _T1.

"Quadrance Point to Plane & intersect Point"

507/11, Vector[row](%id = 36893489965928500148)

RationalTrigonometry:-Quadrance([4,-4,3],[2,-2,5,8]);

[2, -2, 5, 8] is type _T4L.

"Quadrance Point to Plane & intersect Point"

507/11, Vector[row](%id = 36893489965928493652)

Qb:=RationalTrigonometry:-Quadrance([a,b],[c,d],"b");

"Quadrance between two 2D Points Blue"

(-c+a)^2+(-d+b)^2

RationalTrigonometry:-QQF(a,b,c,d)

((a+b+c+d)^2-2*a^2-2*b^2-2*c^2-2*d^2)^2 = 64*b*a*c*d

RationalTrigonometry:-QQF(10^2,5^2,2^2,3^2)

5760000 = 5760000

restart

with(RationalTrigonometry)

[AcuteObstuseQ, AcuteObstuseS, AltitudeQ, CfstoLeqn, CircleParm, CircumCirQ, CrossLaw, LPproj, LinePrll, LinePrpnd, LinePts, MedianQ, QQF, Quadrance, Quadrea, SolidSpread, Spread, SpreadLaw, SpreadLawQuadrea, SpreadPoly, Spreads123, TQF, TSF, UHG]

Quadrance([4,-4,3],2*x-2*y+5*z+8,[x,y,z])

Error, type `_T3L` does not exist

QQF(10^2,5^2,2^2,3^2)
                       5760000 = 5760000

 


 

Download Q_2023-01-14_Package_not_Recognising_Types.mw

please help, thank you!

restart

with(LinearAlgebra)

alias(u = u(x, t), ub = ub(x, t))

u, ub

(1)

``

z1 := (2*I)*u*(2*gamma*lambda^2+alpha*lambda-1/4)*(diff(ub, x))+(2*I)*ub*(-2*gamma*lambda^2+alpha*lambda-1/4)*(diff(u, x))+I*ub*gamma*(diff(u, x, x, x))+Typesetting[delayDotProduct](4*u*gamma, lambda*ub.u.ub, true)+Typesetting[delayDotProduct](4*ub*gamma, lambda*u.ub.u, true)+Typesetting[delayDotProduct]((3*I)*gamma, ub.u.ub.(diff(u, x)), true)+Typesetting[delayDotProduct]((3*I)*gamma, ub.u.(diff(ub, x)).u, true)+Typesetting[delayDotProduct]((3*I)*gamma, ub.(diff(u, x)).ub.u, true)+Typesetting[delayDotProduct]((3*I)*gamma, (diff(ub, x)).u.ub.u, true)+Typesetting[delayDotProduct](I*gamma, (diff(u, x)).(diff(ub, x, x)), true)-Typesetting[delayDotProduct](I*gamma, (diff(ub, x, x)).(diff(u, x)), true)+Typesetting[delayDotProduct](I*gamma, u.(diff(ub, x, x, x)), true)+Typesetting[delayDotProduct](I*gamma, ub.(diff(u, x, x, x)), true)-Typesetting[delayDotProduct]((2*I)*u*gamma, ub.(3*u.(diff(ub, x))-(4*I)*lambda^3), true)+Typesetting[delayDotProduct]((2*I)*ub*gamma, u.(3*ub.(diff(u, x))-(4*I)*lambda^3), true)+(1/2)*Typesetting[delayDotProduct](-4*gamma*lambda-2*alpha, u.(diff(ub, x, x)), true)+(1/2)*Typesetting[delayDotProduct](4*gamma*lambda+2*alpha, ub.(diff(u, x, x)), true)+(1/2)*Typesetting[delayDotProduct](-4*gamma*lambda-2*alpha, (diff(u, x)).(diff(ub, x)), true)+(1/2)*Typesetting[delayDotProduct](4*gamma*lambda+2*alpha, (diff(ub, x)).(diff(u, x)), true)+(1/2)*Typesetting[delayDotProduct](-(8*I)*gamma*lambda^2-(4*I)*alpha*lambda+I, (diff(ub, x)).u, true)+(1/2)*Typesetting[delayDotProduct](-(8*I)*gamma*lambda^2-(4*I)*alpha*lambda+I, ub.(diff(u, x)), true)-ub*(-2*gamma*lambda+alpha)*(diff(u, x, x))+u*(2*gamma*lambda+alpha)*(diff(ub, x, x))+Typesetting[delayDotProduct](2*u, u.ub.u, true)*alpha-Typesetting[delayDotProduct](2*ub, ub.u.ub, true)*alpha-I*u*gamma*(diff(ub, x, x, x)) = 0

(1/2)*(4*gamma*lambda+2*alpha)*((diff(ub, x)).(diff(u, x)))-ub*(-2*gamma*lambda+alpha)*(diff(diff(u, x), x))+u*(2*gamma*lambda+alpha)*(diff(diff(ub, x), x))+(3*I)*gamma*(`.`(ub, diff(u, x), ub, u))+(3*I)*gamma*(`.`(diff(ub, x), u, ub, u))+I*gamma*((diff(u, x)).(diff(diff(ub, x), x)))+I*gamma*(u.(diff(diff(diff(ub, x), x), x)))+(3*I)*gamma*(`.`(ub, u, ub, diff(u, x)))+(3*I)*gamma*(`.`(ub, u, diff(ub, x), u))+4*ub*gamma*(`.`(lambda*u, ub, u))+4*u*gamma*(`.`(lambda*ub, u, ub))+I*gamma*(ub.(diff(diff(diff(u, x), x), x)))+2*u*(`.`(u, ub, u))*alpha-2*ub*(`.`(ub, u, ub))*alpha-I*gamma*((diff(diff(ub, x), x)).(diff(u, x)))+(1/2)*(-4*gamma*lambda-2*alpha)*((diff(u, x)).(diff(ub, x)))+(1/2)*(4*gamma*lambda+2*alpha)*(ub.(diff(diff(u, x), x)))+(1/2)*(-4*gamma*lambda-2*alpha)*(u.(diff(diff(ub, x), x)))+(1/2)*(-(8*I)*gamma*lambda^2-(4*I)*alpha*lambda+I)*(ub.(diff(u, x)))+(2*I)*u*(2*gamma*lambda^2+alpha*lambda-1/4)*(diff(ub, x))+(2*I)*ub*(-2*gamma*lambda^2+alpha*lambda-1/4)*(diff(u, x))-I*u*gamma*(diff(diff(diff(ub, x), x), x))+(2*I)*ub*gamma*(u.(3*(ub.(diff(u, x)))-(4*I)*lambda^3))+I*ub*gamma*(diff(diff(diff(u, x), x), x))-(2*I)*u*gamma*(ub.(3*(u.(diff(ub, x)))-(4*I)*lambda^3))+(1/2)*(-(8*I)*gamma*lambda^2-(4*I)*alpha*lambda+I)*((diff(ub, x)).u) = 0

(2)

Parse:-ConvertTo1D, "first argument to _Inert_ASSIGN must be assignable"

Error, illegal use of an object as a name

"for m from 0 to 5 do  lambda^m:=coeff(lhs(z1),lambda,m)=0;  od;"

 

NULL

Download compare.mw

Here is a graph (g.txt) in Graphlet (gml) format that I threw up with another program. I want to import it by maple. 

I am expecting to do two things:

  • Import the graph correctly;
  • draw the graph according to the vertex position, vertex color, vertex shape and edge color etc. in the file.

This question may come from https://www.mapleprimes.com/questions/235457-How-To-Draw-A-Directed-but-Maybe-Not-Acyclic. My intention is to use this format to efficiently pass graphs and other attributes such as vertex positions, vertex colors, and edge colors. 

However maple doesn't seem to be able to handle them even it cannot handle  the above first point well.

Import ("G:\\test\\g.gml");
# or 
GraphTheory:-ImportGraph ("G:\\test\\g.gml",graphlet)

Error, (in Import) incorrect syntax in parse: unexpected number (near 12th character of parsed string)

Error, (in GraphTheory:-ImportGraph) incorrect syntax in parse: unexpected number (near 12th character of parsed string)

I'm not sure what type of the mistake is here.

 

Mathematica can do it nicely:

g=Import["G:\\test\\g.gml"]

List @@@ PropertyValue[g, VertexLabels]
GraphEmbedding[g]

 

{{8, "x8"}, {12, "b3"}, {14, "x14"}, {2, "b2"}, {13, "x13"}, {5, 
  "r3"}, {7, "r5"}, {9, "r6"}, {11, "x11"}, {6, "r4"}, {1, "b1"}, {15,
   "x15"}, {3, "r1"}, {4, "r2"}, {10, "x10"}}

{{1080, 1440}, {480, 320}, {660, 560}, {420, 160}, {1380, 880}, {1020,
   720}, {720, 880}, {660, 800}, {2160, 0}, {0, 0}, {1500, 
  480}, {1320, 800}, {1800, 240}, {900, 1120}, {1080, 1360}}

PropertyValue[g, VertexStyle]

 

Is there a way to write a function definition that involves multiple cases so that it looks nice with braces as one would write on paper. 
For example, the function $f(x)=|x|$ which is $f(x)=x$ if $x>0$ and $f(x)=-x$ if $x<0$.

First of all, I'd like to be able to write this out with braces in non-executable math in my worksheet. This would already be great.

Then, is it possible to actually define a function this way (ie, not just display the braces in non-executable, but actually run in executable math and have a defined function)?

Hello guys,

I created a palette, but when I click on an entry, the following occurs:

If the entry line, where the mouse cursor is, is empty, insertion takes place on this line.
If the input line has any expression and the mouse cursor is to the left of the expression, insertion takes place on the line above.

If the input line has any expression and the mouse cursor is to the right of the expression, insertion takes place on the line below.

Does anyone know how to fix this?

Sincerely,

Oliveira

How do I find the maximum value of k by putting dw/dk = 0? Also, how to find the range of k for which w is real? 

restart

w = -(1/2)*sqrt(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)

w = -(1/2)*(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)^(1/2)

(1)

diff(w = -(1/2)*(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)^(1/2), k)

0 = -(1/4)*(1920*c^6*gamma^2*k-1344*c^4*gamma^2*k^3+384*c^2*gamma^2*k^5-32*gamma^2*k^7+576*alpha*c^6*gamma-864*alpha*c^4*gamma*k^2-80*alpha*c^2*gamma*k^4+56*alpha*gamma*k^6-288*alpha^2*c^4*k-192*alpha^2*c^2*k^3-24*alpha^2*k^5+256*c^4*gamma*k-160*c^2*gamma*k^3+24*gamma*k^5+48*alpha*c^4-48*alpha*c^2*k^2-20*alpha*k^4+8*c^2*k-4*k^3)/(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)^(1/2)

(2)

NULL

NULL

Download drelation.mw

First 21 22 23 24 25 26 27 Last Page 23 of 43