Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

hi

i am new user for maple

Can Olympiad geometry problems be solved in Maple?

I want to display in 3d the following objects

  • Animated plottools objects (e.g. a spinning cube)
  • Static plot objects (e.g. surface plot)/li>
  • Time dependent spacecurves (to trace the path of objects)

Technically I could

  • create a sequence of time stamps
  • generate for each time stamp a plot structure using plots:-display for all the above objects
  • display the sequence of plot structures with plots:-display with the option insequence.

or

  • create separate plots with plots:-animate for each time dependent object
  • plot with plot3d all static objects
  • display all plots with plots:-display

or

  • defining a procedure containing all plotting commands as a function of time
  • create a background plot of all static objects using plots:-display
  • animate the procedure with a plots:-animate call with the background option

Without having any experience, my perference would be the last way. However I intend to generate some plot coordinates with dsolve,numeric. This would mean that at each point in time to be plotted, dsolve starts integration from the inital conditions (which I have not planned to update animation frame by animation frame)

Any recommensations or thoughts on this?

I want to compute the limit for a parameter (gamma) to infinity of an expression which includes summations over indexes. Below are two approaches. I believe that both should produce the same output, however:

  1. Approach A generates a signum, but I don't understand where this is coming from
  2. Approach B works smoothly once I fix the final value n of the index to some number but runs very slow if I leave n undefined (I had to interrupt the execution)

Maybe approach B is not wrong, and I just need to wait longer...

Any thoughts? 

Approach A: Compute infinity limit while keeping X and lambda undefined (since they are independent of gamma, see below), then define X and lambda
 

problem: what generates signum?

restart;

local gamma;

gamma

(1)

assume(0 < gamma, 0 < n, 0 < w, 0 < Delta, 0 < vo[i], -1 < rho and rho < 1, 0 < sigma__v, 0 < sigma__d, 0 < sigma__dr, delta[i]::real, delta[j]::real, delta[k]::real, delta__r::real, X[i]::real, X[j]::real, X__r::real);
interface(showassumed=0);

1

(2)

W:=sum(X[i]*(-lambda*X[i]-lambda*delta[i]-vo[i]),i=1..n)+X__r*(-lambda__r*X__r-lambda__r*delta__r-w*sum(vo[i],i=1..n))+sum((X[i]+w*X__r)*(vo[i]+(1/(w*n))*(Delta)),i=1..n)-gamma/2*sigma__v^2*(1-(1+rho*(n-1))/(n))*sum((X[i]+w*X__r)^2,i=1..n)-gamma/2*sigma__v^2*(rho-(1+rho*(n-1))/(n))*sum(sum((X[i]+w*X__r)*(X[j]+w*X__r),j=1..i-1)+sum((X[i]+w*X__r)*(X[j]+w*X__r),j=i+1..n),i=1..n);
 

sum(X[i]*(-lambda*X[i]-lambda*delta[i]-vo[i]), i = 1 .. n)+X__r*(-lambda__r*X__r-lambda__r*delta__r-w*(sum(vo[i], i = 1 .. n)))+Delta*X__r+sum(Delta*X[i]/(w*n)+vo[i]*X__r*w+X[i]*vo[i], i = 1 .. n)-(1/2)*gamma*sigma__v^2*(1-(1+rho*(n-1))/n)*(n*X__r^2*w^2+sum(2*X__r*w*X[i]+X[i]^2, i = 1 .. n))-(1/2)*gamma*sigma__v^2*(rho-(1+rho*(n-1))/n)*(n^2*X__r^2*w^2-n*X__r^2*w^2+sum(sum(X__r*w*X[j]+X[i]*X[j], j = i+1 .. n)+sum(X__r*w*X[j]+X[i]*X[j], j = 1 .. i-1)+X__r*w*X[i]*n-X__r*w*X[i], i = 1 .. n))

(3)

limit(W,gamma=infinity);

-signum(-(sum(sum(X[j]*(X__r*w+X[i]), j = i+1 .. n)+sum(X[j]*(X__r*w+X[i]), j = 1 .. i-1)+X__r*w*(n-1)*X[i], i = 1 .. n))+(n-1)*(sum(X[i]*(2*X__r*w+X[i]), i = 1 .. n)))*infinity

(4)

#convert(%, piecewise);

Approach B: Define X and lambda first, then compute infinity limit

problem: why last execution so slow?

restart;

local gamma;

gamma

(5)

assume(0 < gamma, 0 < n, 0 < w, 0 < Delta, 0 < vo[i], -1 < rho and rho < 1, 0 < sigma__v, 0 < sigma__d, 0 < sigma__dr, delta[i]::real, delta[j]::real, delta[k]::real, delta__r::real, X[i]::real, X[j]::real, X__r::real);
interface(showassumed=0);

1

(6)

X[i] := (1/(2*n*w))*sqrt((4*n-3)/(1+rho*(n-1)))*(sigma__d/sigma__v)*Delta-(1/(2*n))*delta[i]-(1/(2*n))*(sum(delta[j],j=1..i-1)+sum(delta[j],j=i+1..n));
X[j] := (1/(2*n*w))*sqrt((4*n-3)/(1+rho*(n-1)))*(sigma__d/sigma__v)*Delta-(1/(2*n))*delta[j]-(1/(2*n))*(sum(delta[k],k=1..j-1)+sum(delta[k],k=j+1..n));
X__r := (1/(2*w*sqrt(n*(1+rho*(n-1)))))*(sigma__dr/sigma__v)*Delta-(1/2)*delta__r;

lambda := sqrt((1+rho*(n-1))/(4*n-3))*(sigma__v/sigma__d);
lambda__r := w*sqrt(n*(1+rho*(n-1)))*(sigma__v/sigma__dr);
 

(1/2)*((4*n-3)/(1+rho*(n-1)))^(1/2)*sigma__d*Delta/(n*w*sigma__v)-(1/2)*delta[i]/n-(1/2)*(sum(delta[j], j = 1 .. i-1)+sum(delta[j], j = i+1 .. n))/n

 

(1/2)*((4*n-3)/(1+rho*(n-1)))^(1/2)*sigma__d*Delta/(n*w*sigma__v)-(1/2)*delta[j]/n-(1/2)*(sum(delta[k], k = 1 .. j-1)+sum(delta[k], k = j+1 .. n))/n

 

(1/2)*sigma__dr*Delta/(w*(n*(1+rho*(n-1)))^(1/2)*sigma__v)-(1/2)*delta__r

 

((1+rho*(n-1))/(4*n-3))^(1/2)*sigma__v/sigma__d

 

w*(n*(1+rho*(n-1)))^(1/2)*sigma__v/sigma__dr

(7)

W:=sum(X[i]*(-lambda*X[i]-lambda*delta[i]-vo[i]),i=1..n)+X__r*(-lambda__r*X__r-lambda__r*delta__r-w*sum(vo[i],i=1..n))+sum((X[i]+w*X__r)*(vo[i]+(1/(w*n))*(Delta)),i=1..n)-gamma/2*sigma__v^2*(1-(1+rho*(n-1))/(n))*sum((X[i]+w*X__r)^2,i=1..n)-gamma/2*sigma__v^2*(rho-(1+rho*(n-1))/(n))*sum(sum((X[i]+w*X__r)*(X[j]+w*X__r),j=1..i-1)+sum((X[i]+w*X__r)*(X[j]+w*X__r),j=i+1..n),i=1..n):
 

W limit for n=3

Winf := collect(expand(simplify(limit(eval(W,n=3),gamma=infinity))),[Delta,Delta^2]):

quad_term := collect(expand(simplify(coeff(Winf,Delta^2))),[sigma__d,sigma__dr]);
linear_term := expand(simplify(coeff(Winf,Delta)));
coeff_term := collect(expand(simplify(eval(Winf,Delta=0))),delta__r^2);

(-(1/4)/(sigma__v*(1+2*rho)^(1/2)*w^2)+(1/2)*(1/(1+2*rho))^(1/2)/(w^2*sigma__v))*sigma__d+(1/12)*3^(1/2)*sigma__dr/((1+2*rho)^(1/2)*sigma__v*w)

 

-(1/2)*delta__r-(1/6)*delta[1]/w-(1/6)*delta[2]/w-(1/6)*delta[3]/w

 

((1/4)*3^(1/2)*sigma__v*w/((1+2*rho)^(1/2)*sigma__dr)+(1/2)*3^(1/2)*sigma__v*w*rho/((1+2*rho)^(1/2)*sigma__dr))*delta__r^2+(1/36)*sigma__v*delta[1]^2/((1+2*rho)^(1/2)*sigma__d)+(1/36)*sigma__v*delta[2]^2/((1+2*rho)^(1/2)*sigma__d)+(1/36)*sigma__v*delta[3]^2/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[1]^2*rho/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[2]^2*rho/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[3]^2*rho/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[2]*delta[1]/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[1]*delta[3]/((1+2*rho)^(1/2)*sigma__d)+(1/18)*sigma__v*delta[2]*delta[3]/((1+2*rho)^(1/2)*sigma__d)+(1/9)*sigma__v*delta[2]*delta[1]*rho/((1+2*rho)^(1/2)*sigma__d)+(1/9)*sigma__v*delta[1]*delta[3]*rho/((1+2*rho)^(1/2)*sigma__d)+(1/9)*sigma__v*delta[2]*delta[3]*rho/((1+2*rho)^(1/2)*sigma__d)

(8)

W limit for generic n

Winf := collect(expand(simplify(limit(W,gamma=infinity))),[Delta,Delta^2]):

quad_term := collect(expand(simplify(coeff(Winf,Delta^2))),[sigma__d,sigma__dr]);
linear_term := expand(simplify(coeff(Winf,Delta)));
coeff_term := collect(expand(simplify(eval(Winf,Delta=0))),delta__r^2);

 

NULL

Download Infinity_limit_and_summations.mw

Is it possible to configure Maple to rather use space-time indices {0,1,2,3} rather than it's default {1,2,3,4}.

Published literature is full of the former, while it seems Maple cannot express indices as such and it creates havoc trying to convert between Maple results and published literature.

In particular, if I enter

Coordinates(X=(t,x,y,z));

Then Maple should be able to index the time "t" as zero.

Is this possible to configure Maple to do this ?

Let's say we enter an arbitrary metric with "Setup" in maple.

Also suppose the metric is a vacuum solution and therefore the Ricci tensor R[alpha,beta]=0

As soon as I enter the metric, maple will evaluate the Ricci tenso when I type R[alpha,beta] and equates it to zero.

What is the command to rather show the the equations that makes up the Ricci tensor for this metric and prevent Maple  from evaluating the equation.

This must be easy, but I just cannot find it in the manual. Must be simple to switch between displaying the constraint equation as calculated for say R[alpha,beta] from the metric and evaluating the equation.

Here are the source codes for the paper  "Gaps Between Integers Having a Common Divisor with an Odd Semi-prime"


 

gg := proc (x, y) return abs(x-y)-1 end proc

proc (x, y) return abs(x-y)-1 end proc

(1)

CopyArrayElem := proc (x, n) local y, i; y := Array(1 .. n); for i to n do y(i) := x(i) end do; return y end proc

proc (x, n) local y, i; y := Array(1 .. n); for i to n do y(i) := x(i) end do; return y end proc

(2)

PrintArray := proc (x, n) local i; for i to n do printf("%d, ", x(i)); if i = (1/2)*n then printf("|,") end if end do; printf("\n") end proc

proc (x, n) local i; for i to n do printf("%d, ", x(i)); if i = (1/2)*n then printf("|,") end if end do; printf("
") end proc

(3)

GapArray := proc (x, n) local i, y; y := Array(1 .. n-1); for i to n-1 do y(i) := gg(x(i), x(i+1)) end do; return y end proc

proc (x, n) local i, y; y := Array(1 .. n-1); for i to n-1 do y(i) := gg(x(i), x(i+1)) end do; return y end proc

(4)

ShiftArrayElem := proc (x, n, d) local i, y; y := Array(1 .. n); for i to n do y(i) := x(i)+d end do; return y end proc

proc (x, n, d) local i, y; y := Array(1 .. n); for i to n do y(i) := x(i)+d end do; return y end proc

(5)

NULL

"chost:=proc(p,q) local i,j,m; local Hpq,hh;   Hpq:=Array(1..p+q-2);  hh:=Array(1..p+q-2);    for i from 1 to q-1 do   Hpq(i):=i*p;   od;      for j from 1 to p-1 do;   Hpq(i++):=j*q;   od;   hh:=sort(Hpq);    return hh;    end proc "

proc (p, q) local i, j, m, Hpq, hh; Hpq := Array(1 .. p+q-2); hh := Array(1 .. p+q-2); for i to q-1 do Hpq(i) := i*p end do; for j to p-1 do Hpq(`++`(i)) := j*q end do; hh := sort(Hpq); return hh end proc

(6)

nGroup := proc (p, m) local j, n, ar; ar := Array(1 .. m); for j from 0 to m-1 do n := ceil((j+1)*p/m)-floor(j*p/m)-1; ar(j+1) := n end do; return ar end proc

proc (p, m) local j, n, ar; ar := Array(1 .. m); for j from 0 to m-1 do n := ceil((j+1)*p/m)-floor(j*p/m)-1; ar(j+1) := n end do; return ar end proc

(7)

Position := proc (ary, k) local i, pos; pos := 0; for i to k-1 do pos := pos+ary(i) end do; pos := pos+1; return pos end proc

proc (ary, k) local i, pos; pos := 0; for i to k-1 do pos := pos+ary(i) end do; pos := pos+1; return pos end proc

(8)

groups := proc (p, q, lm, m) local k, j, x, r, ll, rr, ni, bl, br, i; i := 1; printf("______\n"); for k from 0 to m-2 do ll := floor(k*p/m); rr := floor((k+1)*p/m); ni := rr-ll; for j to ni do r := (j+ll)*m-k*p; printf("(%d: %d),", i, r); if j = ni then printf(" # %d p-hosts after q-host %d\n", lm+1, i*q) end if; i := i+1 end do; printf("\n") end do; ll := floor((m-1)*p/m); rr := p-1; ni := rr-ll; for j to ni do r := (j+ll)*m-k*p; printf("(%d: %d),", i, r); i := i+1 end do; printf("\n______\n") end proc

proc (p, q, lm, m) local k, j, x, r, ll, rr, ni, bl, br, i; i := 1; printf("______
"); for k from 0 to m-2 do ll := floor(k*p/m); rr := floor((k+1)*p/m); ni := rr-ll; for j to ni do r := (j+ll)*m-k*p; printf("(%d: %d),", i, r); if j = ni then printf(" # %d p-hosts after q-host %d
", lm+1, i*q) end if; i := i+1 end do; printf("
") end do; ll := floor((m-1)*p/m); rr := p-1; ni := rr-ll; for j to ni do r := (j+ll)*m-k*p; printf("(%d: %d),", i, r); i := i+1 end do; printf("
______
") end proc

(9)

idx := proc (p, m) local i, r, ri; for i to p-1 do r := i*m-floor(i*m/p)*p; if r = 1 or r = p-1 then ri := i end if; printf("%d, ", r) end do; printf("\n"); return ri end proc

proc (p, m) local i, r, ri; for i to p-1 do r := i*m-floor(i*m/p)*p; if r = 1 or r = p-1 then ri := i end if; printf("%d, ", r) end do; printf("
"); return ri end proc

(10)

DoTest := proc (p, q) local k, i, j, x, y, r, ni, lambda, n, g, xx, ll, rr, w, pos, nj, hh, grp; n := p+q-2; g := Array(1 .. n-1); hh := chost(p, q); printf("Hosts of p and q are:\n"); PrintArray(hh, n); lambda := floor(q/p); r := q-lambda*p; printf("Lambda=%d\nr=%d\n", lambda, r); printf("The %d elements in S(r,p) are:\n", p-1); for i to p-1 do printf("%d,", i*r) end do; printf("\n"); printf("The %d elements in rZ(r,p) are:\n", p-1); for j to p-1 do x := j*r-floor(j*r/p)*p; printf("%d,", x) end do; printf("\n"); printf("The %d subsets are as follows:\n", r); groups(p, q, lambda, r); printf("The maximum gap is: %d \n", p-1); g := q-p-1; printf("Total number of maximum gaps is:%d\n", g); g := GapArray(hh, n); xx := CopyArrayElem(hh, n-1); dataplot(xx, g) end proc

proc (p, q) local k, i, j, x, y, r, ni, lambda, n, g, xx, ll, rr, w, pos, nj, hh, grp; n := p+q-2; g := Array(1 .. n-1); hh := chost(p, q); printf("Hosts of p and q are:
"); PrintArray(hh, n); lambda := floor(q/p); r := q-lambda*p; printf("Lambda=%d
r=%d
", lambda, r); printf("The %d elements in S(r,p) are:
", p-1); for i to p-1 do printf("%d,", i*r) end do; printf("
"); printf("The %d elements in rZ(r,p) are:
", p-1); for j to p-1 do x := j*r-floor(j*r/p)*p; printf("%d,", x) end do; printf("
"); printf("The %d subsets are as follows:
", r); groups(p, q, lambda, r); printf("The maximum gap is: %d 
", p-1); g := q-p-1; printf("Total number of maximum gaps is:%d
", g); g := GapArray(hh, n); xx := CopyArrayElem(hh, n-1); dataplot(xx, g) end proc

(11)

``

DoTest(3, 5)

 

DoTest(5, 7)

 

 

 

 

NULL

DoTest(7, 9)

 

DoTest(11, 13)

 

DoTest(7, 11)

 

NULL

DoTest(5, 23)

 

DoTest(11, 47)

 

DoTest(13, 71)

 

DoTest(17, 29)

 

DoTest(23, 31)

 

DoTest(13, 23)

 

DoTest(11, 17)

 

 

DoTest(11, 29)

 

DoTest(13, 27)

 

DoTest(13, 79)

 

DoTest(11, 45)

 

DoTest(41, 71)

 

DoTest(47, 97)

 

DoTest(53, 103)

 

DoTest(101, 199)

 

DoTest(101, 205)

 

DoTest(23, 45)

 

DoTest(13, 25)

 

DoTest(13, 77)

 

DoTest(23, 93)

 

DoTest(23, 91)

 

DoTest(13, 25)

 

DoTest(13, 77)

 

DoTest(47, 91)

 

DoTest(53, 109)

 

NULL


 

Download Hosts.mw

I wanted to draw vertical line (as y axis) and add a solid disk at some y location (to indicate some point location). I used plottools:-disk  to make the small disk and used plottools:-line to make the y-axis then used plots:-display to combine them.

All is ok, except the disk is transparent. i.e. I can see the y-axis line below it. Is there a way to make it not transparent? i.e. solid color, so that the y-axis below it do not show?

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

#plot vertical line
L:=plottools:-line([0,0],[0,3],color="blue"):
c1:=plottools:-disk([0,1],.1,color="red"):
c2:=plottools:-disk([0,2],.1,color="green"):
plots:-display([L,c1,c2],scaling=constrained,axes=none)

 


i.e. 

Download plotools_nov_9_2024.mw

 About 2 years ago I asked this question Application of how to test types in a module? - MaplePrimes on type checking and @CarlLove provided a great answer for inputs to a procedure in that package.

In the package I have a procdure to plot/draw lines. They require sorting out when there is a list of them The procedure recognises the different possible input formats. Could the types be defined in the procdure body. It would make sorting out a lot easier. I could possibly add them to Module load at the start of the package.

restart

 

# Line type
#type _TNL1  expression type {`+`,`*`,`=`, `symbol`,procedure}                         2D line or any expression function equation

#type _TNL2  listlist [[a,b],[c,d]] or [[a,b,c],[d,e,f]]                               2D  line just draws a line between the 2 points

#type _TNL4  listlist [[a,b,c],[d,e,f]]                                                3D line just draws a line between the 2 points

#type _TNL4  list of list & vector 2D [[a,b],<c,d>]  or possibly  [<c,d>,[a,b]]        2D generates line A*x+B*y+C                        

#type _TNL5  list of list & vector 3D [[a,b,c],<d,e,f>] or possibly [<d,e,f>,[a,b,c]]  3D line <a+alpha*d, b+alpha*e, c+alpha*f>

#type _TNL6  vector 3D <a+alpha*d, b+alpha*e, c+alpha*f>                               3D line <a+alpha*d, b+alpha*e, c+alpha*f> checks indets to know

#type _TNL7  list of vector[row] and vector[row]  [<a|b|c>, <d|e|f>]                   projective points are converted to [a/c,b/c] and [d/f,e/f] and line drawn between the points

 

 

 

sorts:=proc(l1::{list,set,Vector[column],`+`,`*`,`=`, `symbol`,procedure},
{range::list:=[-5,5,-4,4]},
{vars::list:=[':-x',':-y']},
{rangep::list:=[-3,3]},
{plopts::list:=[':-colour'=':-blue,magenta']})

description " sort the list of line formats and converts to plotable format  ";

local i,n,Listsystem,subplt, subL, tmp, vv,ll,subpltemp;

      #single line;
if l1::{'Vector[column]',`+`,`*`,`=`, `symbol`,procedure} then
   n:=1;
   subplt:=[{}];
   if l1::'Vector[column]'(3) and indets(l1)={} then
      subL:=[l1[1]*vars[1]+l1[2]*vars[2]+l1[3]];
    else
      subL:=[l1];
   end if;
 elif l1::list and nops(l1)= 2 and not(hastype(l1,set))then
    #for j to 2 do
    #   if  l1[j][1]::listlist or l1[j][2]::listlist  then

                                                        # this section not finished supposed
                                                        # to detect is the list is two line without extra plopts, range, rangexy                                                  
   #   end if;
   # end do;
   n:=1;
   subplt:=[{}];
    #print("here now");
   if hastype(l1,'Vector[column]'(3)) and hastype(l1,list) then  
      #print("in  here");
      vv:=(select(type,l1,('Vector[column]'(3)))[]);
      ll:=select(type,l1,list)[];
      #print("vv " ,vv, "ll",ll);
      subL:=[ll+~alpha*vv];  
    elif hastype(l1,'Vector[column]'(2)) and hastype(l1,list)  then
      vv:=(select(type,l1,('Vector[column]'(2)))[]);
      ll:=select(type,l1,list)[];
      subL:=[ (ll[2] - vars[2])*vv[1] - vv[2]*(ll[1] - vars[1])];    
    else
      subL:=[l1];
  end if;
  
      #single line with own sub-options plopts range rangep bundled as a set
elif l1::set then
   n:=1;
   subpltemp,tmp:=selectremove(has,l1,{':-rangep',':-range',':-plopts',':-rangep'});
   #print("00",subpltemp,tmp);
   subplt:=`if`(has(subpltemp,{':-plopts',':-range',':-rangep'}),[subpltemp],[{}]);
   tmp:=op(tmp);
   #print("TMP ",tmp ,nops(tmp));
   if tmp::{'Vector[column]',`+`,`*`,`=`, `symbol`,procedure} then
  
     if tmp::'Vector[column]'(3) and indets(tmp)={} then
        subL:=[tmp[1]*vars[1]+tmp[2]*vars[2]+tmp[3]];
      elif hastype(tmp,'Vector[column]'(2)) and hastype(tmp,list)  then
        vv:=select(type,tmp,'Vector[column]'(2))[];
        ll:=select(type,tmp,list)[];
        subL:= [(ll[2] - vars[2])*vv[1] - vv[2]*(ll[1] - vars[1])];  
     else
       subL:=[tmp];
   end if;
 elif nops(tmp)= 2  then
   #print("0th nops(tmp)",nops(tmp),tmp);
   # print("here here now");
   if hastype(tmp,'Vector[column]'(3)) and hastype(tmp,list) then  
      #print("in  here here");
      vv:=(select(type,tmp,('Vector[column]'(3)))[]);
      ll:=select(type,tmp,list)[];
      #print("vv " ,vv, "ll",ll);
      subL:=[ll+~alpha*vv];
     elif hastype(tmp,'Vector[column]'(2)) and hastype(tmp,list)  then
      vv:=(select(type,tmp,('Vector[column]'(2)))[]);
      ll:=select(type,tmp,list)[];
      subL:=[ (ll[2] - vars[2])*vv[1] - vv[2]*(ll[1] - vars[1])];         
    else
      subL:=[tmp];
   end if;
   end if;

    #a list of lines with possible sub-options if
 else
   n:=nops(l1);
   subplt:=[];
   subL:=[];
   for i to n do
     subpltemp:=select(has,l1[i],{':-plopts',':-range',':-rangep'});
     #print("subpltemp",subpltemp);
     #print("subpltemp",has(subpltemp,{':-plopts',':-range',':-rangep'}));
     if has(subpltemp,{':-plopts',':-range',':-rangep'})then subplt:=  [subplt[],subpltemp]else subplt:=[subplt[],{}] end if;
     tmp:=select(not(has),l1[i],{':-plopts',':-range',':-rangep'});
     if type(tmp,set)then tmp:=op(tmp)end if;
     #print("TMP ",tmp ,nops(tmp));
     #print("1st nops(tmp)",nops(tmp),tmp);
     if tmp::{'Vector[column]',`+`,`*`,`=`, `symbol`,procedure} then
  
     if tmp::'Vector[column]'(3) and indets(tmp)={} then
        subL:=[subL[],tmp[1]*vars[1]+tmp[2]*vars[2]+tmp[3]];
      else
        subL:=[subL[],tmp];
     end if;
 elif nops(tmp)= 2  then
   #print("nops(tmp)",nops(tmp),tmp);
   #print("2nd here here now");
   if hastype(tmp,'Vector[column]'(3)) and hastype(tmp,list) then  
      #print("in  here here");
      vv:=(select(type,tmp,('Vector[column]'(3)))[]);
      ll:=select(type,tmp,list)[];
      #print(tmp,"vv " ,vv, "ll",ll);
      subL:=[subL[],ll+~alpha*vv];
    elif hastype(tmp,'Vector[column]'(2)) and hastype(tmp,list)  then
      vv:=(select(type,tmp,('Vector[column]'(2)))[]);
      ll:=select(type,tmp,list)[];
      #print(tmp,"vv " ,vv, "ll",ll);
      subL:= [subL[],(ll[2] - vars[2])*vv[1] - vv[2]*(ll[1] - vars[1])];           
    else
      subL:=[subL[],tmp];
  end if;
end if;
    
end do;
end if:
return subplt, subL, n
end proc:

 

L1:=2*x+3*y-4;
L1ext:={L1, range=[-5,2,-4,4],plopts=[colour=red ,linestyle=dot] };
L2:=<5,-1,3>:
L2ext:={L2,plopts=[linestyle=dash, thickness=4]}:
L3:=[[2,1],[4,-5]]:
L3ext:={L3,plopts=[color=red,thickness=1]}:
L4:=[[2,1,-3],[4,-5,-2]]:
L4ext:={L4,plopts=[color=green]}:
L5:=[[2,3],<-1,4>]:
L5ext:={L5,plopts=[color=green,thickness=2],range=[-6,6,-6,6]}:
L6:=[[1,2,-3],<-3,1,4>]:
L6ext:={L6,rangep=[-4,1],plopts[linestyle=dash]}:
L7:=<1+3*alpha,4-1*alpha,-1+2*alpha>:
L7ext:={L7,rangep=[-4,1],plopts=[colour=purlpe,thickness=3]}:
L8:=[<2|3|1>,<4|7|2>]:
L8ext:={L8,plopts=[colour=red]}:

2*x+3*y-4

 

{2*x+3*y-4, plopts = [colour = red, linestyle = dot], range = [-5, 2, -4, 4]}

(1)

 

Lst:=[L1,L1ext,L2,L2ext,L3,L3ext,x^2+2*y^2+3-4*x*y,L4,L4ext,L5,L5ext,L6,L6ext,L7,L7ext,L8,L8ext]:

A,B,c:=sorts(Lst):

for i to c do
print(i,"  A= ",A[i],"    B= ",B[i]);
end do

1, "  A= ", {}, "    B= ", 2*x+3*y-4

 

2, "  A= ", {plopts = [colour = red, linestyle = dot], range = [-5, 2, -4, 4]}, "    B= ", 2*x+3*y-4

 

3, "  A= ", {}, "    B= ", 5*x-y+3

 

4, "  A= ", {plopts = [linestyle = dash, thickness = 4]}, "    B= ", 5*x-y+3

 

5, "  A= ", {}, "    B= ", [[2, 1], [4, -5]]

 

6, "  A= ", {plopts = [color = red, thickness = 1]}, "    B= ", [[2, 1], [4, -5]]

 

7, "  A= ", {}, "    B= ", x^2-4*x*y+2*y^2+3

 

8, "  A= ", {}, "    B= ", [[2, 1, -3], [4, -5, -2]]

 

9, "  A= ", {plopts = [color = green]}, "    B= ", [[2, 1, -3], [4, -5, -2]]

 

10, "  A= ", {}, "    B= ", -11+y+4*x

 

11, "  A= ", {plopts = [color = green, thickness = 2], range = [-6, 6, -6, 6]}, "    B= ", -11+y+4*x

 

12, "  A= ", {}, "    B= ", Vector[column](%id = 36893490129638901388)

 

13, "  A= ", {plopts[linestyle = dash], rangep = [-4, 1]}, "    B= ", Vector[column](%id = 36893490129638901628)

 

14, "  A= ", {}, "    B= ", Vector[column](%id = 36893490129638901988)

 

15, "  A= ", {plopts = [colour = purlpe, thickness = 3], rangep = [-4, 1]}, "    B= ", Vector[column](%id = 36893490129661594308)

 

16, "  A= ", {}, "    B= ", [Vector[row](%id = 36893490129661594428), Vector[row](%id = 36893490129661594548)]

 

17, "  A= ", {plopts = [colour = red]}, "    B= ", [Vector[row](%id = 36893490129661594428), Vector[row](%id = 36893490129661594548)]

(2)
 

 

Download 2024-11-09_A_Line_Type.mw

In the publication
https://www.scirp.org/pdf/apm_2021062513594181.pdf
I read that Maple18 contains the "Adomian Decomposition". In "Help" of "Maple2024" I found no direct reference to this method. I would like to ask you to provide references in the help text to this method for solving differential equations.

The other night, first time using Maple in more than 20 years, I asked for the solution to this, looking for u1 in terms of u2:

equ := u2 - u1/(-u1^2 + 1)

solve(equ, [u1])

==> u1 = (-1 + sqrt(4*u2^2 + 1))/(2*u2)

But this is sheer nonsense. The correct solution should be:

u1 = (-1 + sqrt(u2^2 + 1))/u2   ;; note the lack of 4x scaling inside the Sqrt, nor the 2x in the denominator.

What the heck??

I want collect 1/G(xi) & G'(xi)/G(xi) also 1/G(xi)*G(xi)/G(xi)  when they have power ,and give me what i looking for, i can do by hand but it take time any one can do this by maple code? like this picture below, and if possible find some arbitrary parameter

collect.mw

After more than 25 years of leading research in areas such as differential equations, special functions, and computational physics, Edgardo's role with Maplesoft will shift at the end of 2024 as he returns to academic research. At Maplesoft, he will transition into the position of Research Fellow Emeritus. In this role, Edgardo will remain engaged with many of his cherished projects, though he will not have as much time to maintain the intense level of activity that characterized his work for so many years.

Many of you know Edgardo personally or have interacted with him here or on the Maple Beta Forum. I hope you'll join me in wishing him the very best as he begins this new chapter.

how this integro-differential equation can be solved?
any assumption or suggestion is appreciated. tnx in advance

restart

eq:=diff(y(x),x)=y(x)+exp(x)*exp(-3*x)/2+int(exp(x+t)*y(t),t=0..x);

IC:=y(0)=1;

diff(y(x), x) = y(x)+(1/2)*exp(x)*exp(-3*x)+int(exp(x+t)*y(t), t = 0 .. x)

 

y(0) = 1

(1)

eq2:=g(x)=int(exp(x+t)*y(t),t=0..x);

g(x) = int(exp(x+t)*y(t), t = 0 .. x)

(2)

IC_2:=eval(eq2,[x=0,y=1])

g(0) = 0

(3)

sys:={diff(eq2,x),subs(rhs(eq2)=lhs(eq2),eq)}

{diff(g(x), x) = int(exp(x+t)*y(t), t = 0 .. x)+exp(2*x)*y(x), diff(y(x), x) = y(x)+(1/2)*exp(x)*exp(-3*x)+g(x)}

(4)

dsolve(sys union {IC,IC_2},numeric)

Error, (in dsolve/numeric/process_input) input system must be an ODE system, got independent variables {t, x}

 

Download integro-diffrential_problem.mw

Hey all Maple experts.I could really use some help with  diff,D,Diff

restart

interface(version)

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

(1)

with(Physics[Vectors])

NULL

CompactDisplay(A_(x, y, z, t), `&varphi;`(x, y, z, t), v_(x, y, z, t), F_(x, y, z, t), v__x(x, y, z, t), v__y(x, y, z, t), v__z(x, y, z, t), A__x(x, y, z, t), A__y(x, y, z, t), A__z(x, y, z, t), quiet)

macro(Av = A_(x, y, z, t), `&vartheta;` = `&varphi;`(x, y, z, t), Vv = v_(x, y, z, t), Fv = F_(x, y, z, t))

show, ON, OFF, kd_, ep_, Av, vartheta, Vv, Fv

(2)

Fv = q*('-VectorCalculus[Nabla](`&vartheta;`)'-(diff(Av, t))+`&x`(Vv, `&x`(VectorCalculus[Nabla], Av)))

F_(x, y, z, t) = q*(-Physics:-Vectors:-Nabla(varphi(x, y, z, t))-(diff(A_(x, y, z, t), t))+Physics:-Vectors:-`&x`(v_(x, y, z, t), Physics:-Vectors:-Curl(A_(x, y, z, t))))

(3)

Av = A__x(x, y, z, t)*_i+A__y(x, y, z, t)*_j+A__z(x, y, z, t)*_k, Vv = v__x(x, y, z, t)*_i+v__y(x, y, z, t)*_j+v__z(x, y, z, t)*_k, F_(x, y, z, t) = F__x*_i+F__y*_j+F__z*_k

A_(x, y, z, t) = A__x(x, y, z, t)*_i+A__y(x, y, z, t)*_j+A__z(x, y, z, t)*_k, v_(x, y, z, t) = v__x(x, y, z, t)*_i+v__y(x, y, z, t)*_j+v__z(x, y, z, t)*_k, F_(x, y, z, t) = F__x*_i+F__y*_j+F__z*_k

(4)

subs[eval](A_(x, y, z, t) = A__x(x, y, z, t)*_i+A__y(x, y, z, t)*_j+A__z(x, y, z, t)*_k, v_(x, y, z, t) = v__x(x, y, z, t)*_i+v__y(x, y, z, t)*_j+v__z(x, y, z, t)*_k, F_(x, y, z, t) = F__x*_i+F__y*_j+F__z*_k, F_(x, y, z, t) = q*(-Physics[Vectors][Nabla](varphi(x, y, z, t))-(diff(A_(x, y, z, t), t))+Physics[Vectors][`&x`](v_(x, y, z, t), Physics[Vectors][Curl](A_(x, y, z, t)))))

F__x*_i+F__y*_j+F__z*_k = q*(-(diff(varphi(x, y, z, t), x))*_i-(diff(varphi(x, y, z, t), y))*_j-(diff(varphi(x, y, z, t), z))*_k-(diff(A__x(x, y, z, t), t))*_i-(diff(A__y(x, y, z, t), t))*_j-(diff(A__z(x, y, z, t), t))*_k+(-v__y(x, y, z, t)*(diff(A__x(x, y, z, t), y))+v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x))+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), x))-v__z(x, y, z, t)*(diff(A__x(x, y, z, t), z)))*_i+(-v__z(x, y, z, t)*(diff(A__y(x, y, z, t), z))+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), y))+v__x(x, y, z, t)*(diff(A__x(x, y, z, t), y))-v__x(x, y, z, t)*(diff(A__y(x, y, z, t), x)))*_j+(v__y(x, y, z, t)*(diff(A__y(x, y, z, t), z))-v__y(x, y, z, t)*(diff(A__z(x, y, z, t), y))-v__x(x, y, z, t)*(diff(A__z(x, y, z, t), x))+v__x(x, y, z, t)*(diff(A__x(x, y, z, t), z)))*_k)

(5)

map(Component, F__x*_i+F__y*_j+F__z*_k = q*(-(diff(varphi(x, y, z, t), x))*_i-(diff(varphi(x, y, z, t), y))*_j-(diff(varphi(x, y, z, t), z))*_k-(diff(A__x(x, y, z, t), t))*_i-(diff(A__y(x, y, z, t), t))*_j-(diff(A__z(x, y, z, t), t))*_k+(-v__y(x, y, z, t)*(diff(A__x(x, y, z, t), y))+v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x))+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), x))-v__z(x, y, z, t)*(diff(A__x(x, y, z, t), z)))*_i+(-v__z(x, y, z, t)*(diff(A__y(x, y, z, t), z))+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), y))+v__x(x, y, z, t)*(diff(A__x(x, y, z, t), y))-v__x(x, y, z, t)*(diff(A__y(x, y, z, t), x)))*_j+(v__y(x, y, z, t)*(diff(A__y(x, y, z, t), z))-v__y(x, y, z, t)*(diff(A__z(x, y, z, t), y))-v__x(x, y, z, t)*(diff(A__z(x, y, z, t), x))+v__x(x, y, z, t)*(diff(A__x(x, y, z, t), z)))*_k), 1)

F__x = -v__y(x, y, z, t)*(diff(A__x(x, y, z, t), y))*q+v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x))*q+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), x))*q-v__z(x, y, z, t)*(diff(A__x(x, y, z, t), z))*q-(diff(varphi(x, y, z, t), x))*q-(diff(A__x(x, y, z, t), t))*q

(6)

collect(F__x = -v__y(x, y, z, t)*(diff(A__x(x, y, z, t), y))*q+v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x))*q+v__z(x, y, z, t)*(diff(A__z(x, y, z, t), x))*q-v__z(x, y, z, t)*(diff(A__x(x, y, z, t), z))*q-(diff(varphi(x, y, z, t), x))*q-(diff(A__x(x, y, z, t), t))*q, [q, v__x(x, y, z, t), v__y(x, y, z, t), v__z(x, y, z, t)])

F__x = (v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x)-(diff(A__x(x, y, z, t), y)))+(diff(A__z(x, y, z, t), x)-(diff(A__x(x, y, z, t), z)))*v__z(x, y, z, t)-(diff(varphi(x, y, z, t), x))-(diff(A__x(x, y, z, t), t)))*q

(7)

convert(F__x = (v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x)-(diff(A__x(x, y, z, t), y)))+(diff(A__z(x, y, z, t), x)-(diff(A__x(x, y, z, t), z)))*v__z(x, y, z, t)-(diff(varphi(x, y, z, t), x))-(diff(A__x(x, y, z, t), t)))*q, Diff)

F__x = (v__y(x, y, z, t)*(Diff(A__y(x, y, z, t), x)-(Diff(A__x(x, y, z, t), y)))+(Diff(A__z(x, y, z, t), x)-(Diff(A__x(x, y, z, t), z)))*v__z(x, y, z, t)-(Diff(varphi(x, y, z, t), x))-(Diff(A__x(x, y, z, t), t)))*q

(8)

convert(F__x = (v__y(x, y, z, t)*(diff(A__y(x, y, z, t), x)-(diff(A__x(x, y, z, t), y)))+(diff(A__z(x, y, z, t), x)-(diff(A__x(x, y, z, t), z)))*v__z(x, y, z, t)-(diff(varphi(x, y, z, t), x))-(diff(A__x(x, y, z, t), t)))*q, D)

F__x = (v__y(x, y, z, t)*((D[1](A__y))(x, y, z, t)-(D[2](A__x))(x, y, z, t))+((D[1](A__z))(x, y, z, t)-(D[3](A__x))(x, y, z, t))*v__z(x, y, z, t)-(D[1](varphi))(x, y, z, t)-(D[4](A__x))(x, y, z, t))*q

(9)

 
Hello everyone, in the result of this command execution process, it appears that the symbols for partial derivatives and derivatives in equation (8) are displayed incorrectly. What should I do?

Download error_display.mw

I am trying to compute partial derivatives of some complicated expression which include summations. First, I noticed that sum behaves differently if I use 1D vs. 2D math. Why?

Questions:
  1. Partial derivative of a summation: why is it not just 2*X[i]?
  2. Partial derivative of a double summation: how to define the nested structure of a double summation with j<>i?
  3. System of n+1 equations: how to define and solve for it?

For 3., each i equation is the partial derivative of my complicated expression with summations with respect to X[i], where i ranges from 1 to n. The last equation is the partial derivative with respect to X_r (a fixed variable).

Thanks.

restart

A := sum(X[i]^2, i = 1 .. n); eq[1] := diff(A, X[i]) = 0

sum(X[i]^2, i = 1 .. n)

 

sum(2*X[i], i = 1 .. n) = 0

(1)

B__wrong := sum(sum((X__r*w+X[i])*(X__r*w+X[j]), j = 1 .. n), i = 1 .. n); B__correct := 'sum(sum((X__r*w+X[i])*(X__r*w+X[j]), j = 1 .. n), i = 1 .. n)'

n^2*X__r^2*w^2+sum(sum(X__r*w*X[j]+X[i]*X[j], j = 1 .. n)+n*X__r*w*X[i], i = 1 .. n)

 

sum(sum((X__r*w+X[i])*(X__r*w+X[j]), j = 1 .. n), i = 1 .. n)

(2)

eqs := seq(eq[i], i = 1 .. n); vars := seq(X[i], i = 1 .. n)

Error, range bounds in seq must be numeric or character

 

Error, range bounds in seq must be numeric or character

 
 

NULL

Download equations_with_summations.mw

5 6 7 8 9 10 11 Last Page 7 of 2164