Joe Riel

9530 Reputation

23 Badges

20 years, 29 days

MaplePrimes Activity


These are answers submitted by Joe Riel

@corregumucio It still is not clear to me what you want to achieve.  However, you can manually simplify the expression. A nice way to see that is to freeze common subexpressions,

pw := piecewise(a < -(4*((-ce-pk)/b-(1/4)*(-ce-3*pk-2*ci)/b))*b
                , [{k <= (a-ce-pk)/b}]
                , And((4*((1/4)*(-ce-3*pk-2*ci)/b-(-ce-pk)/b))*b <= a, a < -(4*((-ce-pk)/b-(1/4)*(-ce-2*pk-2*ci)/b))*b)
                , [{k <= (1/4)*(3*a-ce-3*pk-2*ci)/b}]
                , (4*((1/4)*(-ce-2*pk-2*ci)/b-(-ce-pk)/b))*b <= a
                , [{k <= (1/4)*(3*a-ce-3*pk-2*ci)/b}]
                , []
               ):
# freeze all operands of relations.
pw1 := subsindets(simplify(pw), relation, rel -> map(freeze, rel));
            { [{k <= freeze/R1}]                  a < freeze/R4
            {
            { [{k <= freeze/R0}]        And(freeze/R4 <= a, a < freeze/R3)
     pw1 := {
            { [{k <= freeze/R0}]                  freeze/R3 <= a
            {
            {         []                            otherwise

From inspection it is clear that1 pw1 can be reduced to

pw2 := subsop(3=NULL,5=NULL,6=NULL,7=NULL,pw1);
                      { [{k <= freeze/R1}]        a < freeze/R4
               pw2 := {
                      { [{k <= freeze/R0}]          otherwise

Now thaw the frozen expressions

pw3 := thaw(pw2);
            {             a - ce - pk
            {      [{k <= -----------}]              a < 3 ce + pk - 2 ci
            {                  b
     pw3 := {
            {        3 a - ce - 3 pk - 2 ci
            { [{k <= ----------------------}]             otherwise
            {                 4 b


The following works

deqs := {NULL
         , diff(u2(y), y, y)+m*b*rho*h^2*GR*(c3*y+c4) = 0
         , diff(u1(y), y, y)+K*(diff(N(y), y))/(1+K)+GR*(c1*y+c2)/(1+K) = 0
         , -2*K*(2*N(y)+diff(u1(y), y))/(2+K)+diff(N(y), y, y) = 0
        }:

bcs := {NULL
        , u1(-1) = 0
        , u2(1) = 0
        , u1(0) = u2(0)
        , (D(u1))(0)+K*N(0)/(1+K) = (D(u2))(0)/(m*h*(1+K))
        , (D(N))(0) = 0
        , N(-1) = 0
       }:

dsolve(deqs union bcs);

The following works

plot(GAMMA, 1..2);
 
B := int(t^(a-1)*(1-t)^(b-1),t=0..1);    
                                                     GAMMA(b) GAMMA(a)
                                                B := -----------------
                                                       GAMMA(a + b)
plot3d(B, a=1..2, b=1..2);

Here is how to plot B vs a with b fixed

plot(eval(B, b=1.5), a = 1..2);

You can generate the tuples using

(r,l) := (4,2):                             
combinat:-permute([0$(r-l),1$r]);

If you are given T(x,t), then just compute a directly:

a := diff(T(x,t),t)/diff(T(x,t),x,x);

I see what you mean:

with(DifferentialGeometry): with(JetCalculus): with(Physics):
DGsetup([x], [u, psi], E, 1):
Setup(anticommutativeprefix={psi}):
f := psi[]*psi[1]:
TotalDiff(f,x);
                                 2
                           psi[1]  - psi[] psi[1, 1]

The problem lies in TotalDiff, it doesn't know anything about the anticommutation rule. That is, when it applies the Leibniz rule to differentiate the product, it uses standard multiplication rather than the overloaded multiplication operator. There is a way to hack around this, that is, you can replace the module local procedure used by TotalDiff with one that uses the overloaded multiplication operator.  An easy way to do that is to load the Physics package, so `*` is overloaded, convert the local procedure to a string, parse it, and then reassign it.  That works because the parsed multiply operation is now interpreted as the overloaded operation. Thus

kernelopts(opaquemodules=false): # needed to access the module local procedure
use td0=DifferentialGeometry:-JetCalculus:-TotalDiff:-td0 in
    td0 := parse(sprintf("%a",eval(td0)));
end use:
TotalDiff(f,x);
                               -psi[] psi[1, 1]

No guarantees that this hack won't break something.

I'm not sure what the issue is.  Note that your linear transformation doesn't rotate the input, so the Maple plot won't look like the desired plot.  You can achieve that with a different transformation, say

A1 := <2,0;0,3>:
A2 := eval(<cos(theta),sin(theta);-sin(theta),cos(theta)>, theta=Pi/4):
A := A1 . A2;

Because your input is cylic, you can use a moving average without losing any points.

pts := [[1, 1], [3, 2], [3.5, 4], [4, 6], [5, 5], [6, 7], [7, 6], [8, 5], [9, 5.5], [10, 4], [11, 1], [12, -5], [11.5, -6], [12, -12], [10, -10], [8, -14], [7, -10], [3, -10], [2, -5], [1, -8], [0, 0], [1, 1]]:

x := op~(1,pts):
y := op~(2,pts):

n := nops(pts):
m := 5:
use Statistics in
x1 := MovingAverage([x[],x[2..m][]], m)[1..n];
y1 := MovingAverage([y[],y[2..m][]], m)[1..n];
end use:

pts1 := `[]`~(x1,y1):

plt1 := plot(pts):
plt2 := plot(pts1, color=blue):

plots:-display(plt1,plt2);

Try restarting Maple.  Those commands work fine for me.

You can use ?TypeTools[AddType] to create a new type. One way to do that is to specify a particular attribute for the Matrix. Thus

TypeTools:-AddType('MyMatrix', 'Matrix(attributes=[MyMatrix])'):

NewAdd := module()
option package;
export `+`;
    `+` := overload([proc(a::MyMatrix, b::MyMatrix)
                     local M;
                     option overload;
                         M := Matrix([[a[1,1]], [:-`+`(a[2,1],b[2,1])]], 'attributes=[MyMatrix]');
                         if _npassed > 2 then
                             return procname(M,_rest);
                         else
                             return M;
                         end if;
                     end proc,
                     proc(a::procedure, b::procedure)
                     option overload;
                         proc(V) `+`(a(V),b(V)) end proc
                     end proc
                    ]
                   );
end module:

A := Matrix([[1,2],[3,4]], 'attributes=[MyMatrix]'):
B := Matrix([[1,2],[3,4]]);
with(NewAdd);

A+A;
                                      [1]
                                      [ ]
                                      [6]

B+B;
                                   [2    4]
                                   [      ]
                                   [6    8]

`+`(A,A,A);
                                      [1]
                                      [ ]
                                      [9]


Note that the `+` procedure was extended to be n-ary (for n >= 2). 

Square brackets are not algebraic parentheses in Maple.  Use parentheses and it works fine.

Followup: actually, that doesn't take you out of the woods.  Maple generates the procedure, however, there is a problem at the initial point.  You can see that with

deq := (2*.1)*((y(t)*(diff(y(t), t, t))-1)*(1+(diff(y(t), t))^2)^(3/2)-y(t)*(diff(y(t), t))^2*(diff(y(t), t, t))*sqrt(1+(diff(y(t), t))^2))-2*sin(t)*(1+(diff(y(t), t))^2)^2 = 0:
ini := {y(0) = 0, (D(y))(0) = 0}:
eval(subs(t=0, ini, convert(deq,D)));
                                   -0.2 = 0

There is no general solution unless A and V are orthogonal.  To see that, let A lie on the z-axis and V lie in the x=0 plane.  Then

with(VectorCalculus):

A := Vector([0,0,a3]):
V := Vector([0,v2,v3]):
W := Vector([w1,w2,0]):

WxV := W &x V:
ex := WxV * (A.A) - A*(WxV.WxV):
eqs := convert(ex,set) union {W.W=Wmag^2}:
solve(eqs, {w1,w2,v3});
{v3 = 0, w1 = 0, w2 = Wmag}, {v3 = 0, w1 = 0, w2 = -Wmag},

                                      2       2   2     2
                   a3        RootOf(a3  - Wmag  v2  + _Z )
    {v3 = 0, w1 = ----, w2 = -----------------------------}
                   v2                     v2

This works

NewAdd := module()
option package;
export `+`;
    `+` := overload([proc(a::Matrix, b::Matrix)
                     option overload;
                         Matrix([[a[1,1]], [:-`+`(a[2,1], b[2,1])]])
                     end proc,
                     proc(a::procedure, b::procedure)
                     option overload;
                         proc(V) `+`(a(V),b(V)) end proc
                     end proc
                    ]
                   );
end module:

A  := proc(v::Matrix) Matrix([[v[1,1]-1],[v[2,1]]]); end proc:
At := proc(v::Matrix) Matrix([[v[1,1]+1],[v[2,1]]]); end proc:

with(NewAdd);
                                      [+]


V1:=Matrix([[a],[b]]);
                                         [a]
                                   V1 := [ ]
                                         [b]


A(V1)+At(V1);
                                    [a - 1]
                                    [     ]
                                    [ 2 b ]

(A+At)(V1);  
                                    [a - 1]
                                    [     ]
                                    [ 2 b ]
 a:=[class,23,45,74,34,25,76,class,55,67,78,34,65,12,23,45,64,23,class,12,13,15,class,99,98,97,59 ]:    
 ListTools:-Split(type,a, name);                 
                [], [23, 45, 74, 34, 25, 76], [55, 67, 78, 34, 65, 12, 23, 45, 64, 23], [12, 13, 15], [99, 98, 97, 59]


While Maple shouldn't be crashing, the proximate cause is that Lines is invalid.  I suspect you want

Lines:=map(spacecurve, [L1,L2,L3], t=-2..2);

and then (later)

display(A,Lines[]);
First 64 65 66 67 68 69 70 Last Page 66 of 114