MaplePrimes Questions

I am facing difficulty to realize this double iterative process. 

The equations in question are 

The flow chart for the iterative process is given as


The different parameters are defined as

 

alphan:=1.72*10^(-4):
alphap:=2.037*10^(-4):
L:=1.3*10^(-3):
A:=2.08*10^(-6):
kp:=1.265:
kn:=1.011:
sigmap:=1.314e-5:
sigman:=1.119e-5:
alphapn:=alphap-alphan:
Rpn:=L/(A)*(sigmap+sigman):
RL:=1:
Kpn:=(A/L)*(kp+kn):
cf:=4205:
cc:=4153:
hf:=80:
hc:=1000:
Tfin:=773:
Tcin:=353:
mf:=20:
mc:=20:


Influence_of_different_cooling_methods_on_thermoelectric_performance_of_an_engine_exhaust_gas_waste_heat_recovery_system.pdf

Consider the second order BVP:

diff(u(x), x, x) = u(x), u(0) = 2, u(1) = 1

I want dsolve numeric to calculate the second derivative, diff(u(x), x, x)

The actual problem I am working on is a more complex BVP that cannot be solved symbolically, but this simpler BVP will illustrate the problem.

Several Mapleprimes posts say to add a second equation diff(u(x), x, x) = v(x) and solve the system for u(x), v(x). This works for IVP's. However, when I implement it as shown below for the BVP:

dsolve({diff(u(x), x, x) = u(x), diff(u(x), x, x) = v(x), u(0) = 2, u(1) = 1, v(1) = 1}, {u(x), v(x)})

dsolve solves the problem fine symbolically, but when I try to solve the problem numerically:

dsolve({diff(u(x), x, x) = u(x), diff(u(x), x, x) = v(x), u(0) = 2, u(1) = 1, v(1) = 1}, numeric)

I get the following error message:

Error, (in dsolve/numeric/bvp/convertsys) the ODE system does not contain derivatives of the unknown function v

The above dsolve numeric command is a simplifcation -- e.g. I use an approximate solution etc. -- dsolve numeric solves the original BVP just fine, but will NOT calculate the second derivative.

I have tried any number of variations. I can convert the original problem to a system of first order equations -- but then, of course, dsolve calculates no first derivatives -- so I don't have diff (u(x),x) = diff (u(x),x,x)! 

I've killed a whole day on this. I need to estimate the location of the inflection point in my real problem (the solution is a sigmoidal function). I can apply a finite difference approximation to the dsolve numeric solution, but it's not accurate enough. Dsolve should be more accurate, since dsolve will  regulate the error of the added variable, v(x), to within abserr.

Oh, you would make everyone's life so much easier if you would just have dsolve numeric return all the derivatives in the IVP/BVP being solved! Or provide a data struction as solution that can be integrated/differentiated.

Robert


 

 

 

I have a large Maple 2020 worksheet which contains images and text.  I have been asked to publish a paper on the worksheet, in which I need to include LaTeX format. I have attempted to make the Maple => LaTeX conversion, but have the resulting file is very cluttered and takes much time to clean.  Can anyone offer advice on the best way to get clean LaTeX document from a worksheet?

Melvin Brown

sympl55@gmail.com

 

Hi,

It seems that it's not possible to change the tickmarks on axis 2 of a sparsematrixplot.
Mire of this, trying to change them seems to suppress them...
Perhaps this was a problem in Maple 2015 which has since been corrected?
By any chance, would you have a trick to correct this?

TIA
 

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

M := LinearAlgebra:-RandomMatrix(20,density=0.25,generator=0 .. 1);

M := Vector(4, {(1) = ` 20 x 20 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(2)

plots:-sparsematrixplot(
   M, matrixview
);

 

plots:-sparsematrixplot(
   M, matrixview
  ,axis[1]=[tickmarks=[seq(i=i-1, i in [seq](1..20, 5))]]
  ,axis[2]=[tickmarks=[seq(j=j-1, j in [seq](1..20, 5))]]
);

 

plots:-sparsematrixplot(
   M, matrixview
  ,axis[2]=[tickmarks=[seq(i=i-1, i in [seq](1..20, 5))]]
);

 

 


 

Download sparsematrixplot.mw

How I can plot3d function s. in the domain x ,y from -1300 to 200.

Thanks

if.mw
 

"restart;   #`    x__A`=-1300..200,      `y__A`=-1300..200    u1:=(((`x__A`-200)^(2)+(`y__A`^())^(2))*0.001)/(960000);   if  u1<=0.001  then w(u1):=-0.5772-ln(u1);  else if u1>0.001  then w(u1):=-0.5772-ln(u1)+u1-((u1)^(2))/(2*2!)+((u1)^(3))/(3*3!)-((u1)^(4))/(4*4!)+((u1)^(5))/(5*5!)-((u1)^(6))/(6*6!)+((u1)^(7))/(7*7!)-((u1)^(8))/(8*8!)+((u1)^(9))/(9*9!)-((u1)^(10))/(10*10!)+((u1)^(11))/(11*11!)-((u1)^(12))/(12*12!);     end if"

Error, invalid 'if' statement

"restart;      u1:=(((`x__A`-200)^2+(`y__A`)^2)*0.001)/960000;   if u1<=0.001  then w:=(u1)->-0.5772-ln(u1);  elseif u1>0.001  then w(u1):=-0.5772-ln(u1)+u1-((u1)^2)/(2*2!)+((u1)^3)/(3*3!)-((u1)^4)/(4*4!)+((u1)^5)/(5*5!)-((u1)^6)/(6*6!)+((u1)^7)/(7*7!)-((u1)^8)/(8*8!)+((u1)^9)/(9*9!)-((u1)^10)/(10*10!)+((u1)^11)/(11*11!)-((u1)^12)/(12*12!);     end if"

 

s := 6.87*10^(-3)*w(u1); plot3d(s, x__A = -1300 .. 200, y__A = -1300 .. 200)


 

Download if.mw

 

Hello,

Im exporting procedures defined in Maple to an external software and was planning to use the CodeGeneration -tools for that. How ever, i encountered quite surprising limitations.

 

First is default value for procedure parameter. The documentation explains that procedure parameter can be set to have a default value with syntax parameterName::type := defaultValue. And indeed, it works:

 

DefaultValueTest := proc(parameterWithDefaultValue::integer:=1)::integer;
	return parameterWithDefaultValue *2;
end proc;
DefaultValueTest();
                               2
DefaultValueTest(2);
                               4

However, apparently the CodeGenerator -package cannot handle it.

CSharp(DefaultValueTest);
Error, (in CodeGeneration:-IssueError) cannot translate initial value

This is not related to the chosen language, it wont work with Java or JavaScript translation either. Without the default value the generated code looks like this, as expected:

CSharp(DefaultValueTest);
public class CodeGenerationClass {
  public static System.Int32 DefaultValueTest (System.Int32 parameterWithDefaultValue)
  {
    return 2 * parameterWithDefaultValue;
  }
}

Whats up with this? Many if not all the CodeGeneration languages support default parameter value for function. In C# it would obviously be 

public static System.Int32 DefaultValueTest (System.Int32 parameterWithDefaultValue=1)

 

 

Another one is the type support. I was quite surprised that boolean type works fine in Maple but the codegeneration translation cannot handle it. For example:

Booltest := proc(boolVal::boolean)::integer;
	if ( boolVal = true ) then
		return 1;
	end if;
	
	return 0;
end proc;

Works fine in the maple.

Booltest(true);
                               1
Booltest(false);
                               0

But when ran trough the code generator:

CSharp(Booltest);
Warning, cannot translate type boolean, using default type
Error, (in CodeGeneration:-IssueError) cannot resolve types in {boolean, numeric}

Apparently, since the documentation says that if CodeGeneration doesn't recognize the type, it uses default type, which in this case is numeric, it cannot do the evaluation in the if clause ( numeric and boolean true ).

So if we change the if condition to a shorthand version:

if ( boolVal ) then

The csharp transpiled code looks like 

CSharp(Booltest);
Warning, cannot translate type boolean, using default type
public class CodeGenerationClass {
  public static System.Int32 Booltest (System.Double boolVal)
  {
    if (boolVal)
      return 1;
    return 0;
  }
}

 

Every languange in the codegeneration package has boolean type. So shouldn't there be a variable type bool in the translator/transpiler as well?

 

Is there a way around these problems? Are there plans on expanding the codegeneration/transpiler ruleset to cover these rather basic cases? 

 

 

 

 

 

This puzzling to me. First will show the code, then explain the problem

restart;
ode:=diff(diff(y(x),x),x)+8*diff(y(x),x)+25*y(x) = 1;
sol:=dsolve(ode);
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;

restart;

sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;

I was trying to changing the constant of integrations, to make them show at front, where it is better. But Maple refused to do so. Here is the output:


 

interface(version)

`Standard Worksheet Interface, Maple 2020.2, Windows 10, November 11 2020 Build ID 1502365`

restart;
ode:=diff(diff(y(x),x),x)+8*diff(y(x),x)+25*y(x) = 1;
sol:=dsolve(ode);
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;

diff(diff(y(x), x), x)+8*(diff(y(x), x))+25*y(x) = 1

y(x) = exp(-4*x)*sin(3*x)*_C2+exp(-4*x)*cos(3*x)*_C1+1/25

y(x) = exp(-4*x)*sin(3*x)*_C2+exp(-4*x)*cos(3*x)*_C1+1/25

y(x) = exp(-4*x)*sin(3*x)*_C2+exp(-4*x)*cos(3*x)*_C1+1/25

y(x) = exp(-4*x)*sin(3*x)*_C2+exp(-4*x)*cos(3*x)*_C1+1/25

restart;

sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;

y(x) = _C2*exp(-4*x)*sin(3*x)+_C1*exp(-4*x)*cos(3*x)+1/25

 


Why restart is needed to make Maple keep the output same as input? is it possible to rewrite it without having to do restart?

Download why_restart_needed.mw

 

Has anybody tried Maple 2020.2 on a new Macbook with Apple silicon? I believe native support is in development, i was curious if anyone had experience running Maple via Rosetta 2?

The function is y^2 = x^3 - 3x - 1

How to calculate the defined integral when x < 0 in maple? 

Always get a very long output rather than a numerical value. 

Thank you!

I have to create a simulation of the orbit of Hyperion around Saturn, which should be reliable for up to thousands of orbits. In practice I don't seem to be able to make the model stay consistent above a few hundred orbits using dsolve for the ODEs, but is there any way to do this so that the orbit stays on the same path?

I have uploaded my code here for your perusal.


 

``

with(plots)

G := 0.667408e-10

MH := 0.55855e19

MSat := 0.56832e27

M := MSat+MH

a := 0.1501e10

ecc := .232

beta := .89

Digits := 10

TH := sqrt(4*3.141592653589793^2*a^3/(G*M))

omegaH := (2*3.141592653589793)/TH

Eqns := diff(xH(t), t) = vxH(t), diff(yH(t), t) = vyH(t), diff(vxH(t), t) = -G*M*xH(t)/(xH(t)^2+yH(t)^2)^(3/2), diff(vyH(t), t) = -G*M*yH(t)/(xH(t)^2+yH(t)^2)^(3/2), diff(theta(t), t) = omega(t), diff(omega(t), t) = -G*MSat*beta^2*(xH(t)*sin(theta(t))-yH(t)*cos(theta(t)))*(xH(t)*cos(theta(t))+yH(t)*sin(theta(t)))/(xH(t)^2+yH(t)^2)^2.5

ICs := xH(0) = a*(1-ecc), yH(0) = 0., vxH(0) = 0., vyH(0) = sqrt(G*M*(1+ecc)/(a*(1-ecc))), theta(0) = 0., omega(0) = omegaH

soln := dsolve({Eqns, ICs}, numeric, method = rkf45, abserr = 0.1e-9, relerr = 0.1e-9, maxfun = 0)

T := 100*TH

odeplot(soln, [xH(t)/a, yH(t)/a], 0 .. T, scaling = constrained, labels = ["x/a", "y/a"], numpoints = 2000)``

odeplot(soln, [theta(t), omega(t)], 0 .. T, labels = ["theta", "omega"], numpoints = 2000)

``


 

Download Project.mw

Maple how to prove Sin2x=2sinxcosx for every real number 

 

Thank you! 


 

  restart:

  interface(rtablesize=10):


  local gamma:local pi:



if false then
 theta := 0.987: betae := 0.231: betay := 0.112: rho := 0.17: muh := 0.05 : sigma2 := 0.0411: sigma1 := 0.212: alpha1 := 0.111: alpha2 := 0.131 : eta := 0.134: thetaa := 0.7271: betaf := 0.00954: betah := 0.008220: gamma := 0.0012: mua := 0.0023: sigma3 := 0.203: d := 0.451: z := 0.072:
end if:

#
# D() is Maple's differential operator replated D(T)
# with DD(T) in the following to avoid confusion
#

  ODE1 := diff(B(T), T) = theta-(betae*C(T)+betay*rho*G(T))*B(T)-muh*B(T)+sigma2*E(T):
  ODE2 := diff(C(T), T) = (betae*C(T)+betay*rho*G(T))*B(T)-(muh+sigma1+alpha1)*C(T):
  ODE3 := diff(E(T), T) = sigma1*C(T)-(muh+sigma2)*E(T):
  ODE4 := diff(G(T), T) = alpha1*C(T)+alpha2*K(T)-eta*G(T):
  ODE5 :=  diff(H(T), T) = thetaa-(betaf*H(T)+betah*gamma*G(T))*H(T)-mua*H(T)+sigma3*K(T):
  ODE6 :=  diff(J(T), T) = (betaf*H(T)+betah*gamma*G(T))*H(T)-(mua+d+z+alpha2)*J(T):
  ODE7 :=  diff(K(T), T) = z*J(T)-(mua+sigma3)*K(T):

 
if false then
  B0 := 100: C0 := 60: E0 := 50: G0 := 55: H0 := 80: J0 := 80: K0 := 80:  

end if:

# system + ic


sys := { ODE1, ODE2, ODE3, ODE4, ODE5, ODE6, ODE7,
                   B(0) = B0, C(0) = C0, E(0) = E0, G(0) = G0, H(0) = H0, J(0) = J0, K(0) = K0

                 }:

params := convert(indets(sys, name) minus {T}, list);

[B0, C0, E0, G0, H0, J0, K0, alpha1, alpha2, betae, betaf, betah, betay, d, eta, gamma, mua, muh, rho, sigma1, sigma2, sigma3, theta, thetaa, z]

(1)

#
# Solve system
#
  ans := dsolve( { ODE1, ODE2, ODE3, ODE4, ODE5, ODE6, ODE7,
                   B(0) = B0, C(0) = C0, E(0) = E0, G(0) = G0, H(0) = H0, J(0) = J0, K(0) = K0
               
                 },
                 parameters = params,
                 numeric
               );

Error, (in dsolve/numeric) 'parameters' must be specified as a list of unique unassigned names

 

NULL


 

Download sim.mw

Hello everyone,

I have a problem when searching in a document. Namelly is there a way to search in the whole worksheet including all code editing regions?

In order to show a point, there is a worksheet. I determine a variable

x11:= 12;

This variable is used in the document and code edit regions. Then I want to change a variable name from x11 to x11data. In order to do that, I use Ctrl+F to find all the times when the variable is used. I have a problem while  searching 'x11'. Namelly, the cases outside a code edit region are displayed, and the ones that are situated in the code edit regions are not seen.

Best regards

The dsolve function is not working to solve a set of differential equations I have written. No error message is showing, but the code does not work.
 

``

with*plots

G := 0.667408e-10

0.667408e-10

(1)

M := 0.56832e27+0.55855e19

0.5683200056e27

(2)

a := 0.1501e10

0.1501e10

(3)

ecc := .232

.232

(4)

orbit := proc (T) local Eqns, ICs, soln; Eqns := diff(xH(t), t) = vxH(t), diff(yH(t), t) = vyH(t), diff(vxH(t), t) = G*M*xH(t)/(xH(t)^2+yH(t)^2)^(3/2), diff(vyH(t), t) = G*M*yH(t)/(xH(t)^2+yH(t)^2)^(3/2); ICs := xH(0) = a*(1-ecc), yH(0) = 0., vxH(0) = 0., vyH(0) = sqrt(G*M*(1+ecc)/(a*(1-ecc))); soln := dsolve({Eqns, ICs}, numeric, method = classical[rk4]); odeplot(soln, [xH(t)/a, yH(t)/a], 0 .. T, scaling = constrained, labels = ["x/a", "y/a"], numpoints = 2000) end proc

proc (T) local Eqns, ICs, soln; Eqns := diff(xH(t), t) = vxH(t), diff(yH(t), t) = vyH(t), diff(vxH(t), t) = G*M*xH(t)/(xH(t)^2+yH(t)^2)^(3/2), diff(vyH(t), t) = G*M*yH(t)/(xH(t)^2+yH(t)^2)^(3/2); ICs := xH(0) = a*(1-ecc), yH(0) = 0., vxH(0) = 0., vyH(0) = sqrt(G*M*(1+ecc)/(a*(1-ecc))); soln := dsolve({Eqns, ICs}, numeric, method = classical[rk4]); odeplot(soln, [xH(t)/a, yH(t)/a], 0 .. T, scaling = constrained, labels = ["x/a", "y/a"], numpoints = 2000) end proc

(5)

orbit(20)

odeplot(soln, [0.6662225183e-9*xH(t), 0.6662225183e-9*yH(t)], 0 .. 20, scaling = constrained, labels = ["x/a", "y/a"], numpoints = 2000)

(6)

``


 

Download Project.mw

Hello 

I need a procedure that given two lists of sets A and returns a list of lists such that L[i] is the list of j such that A[i] subset B[j]. Here is an example:

ans6 := [{alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 8], alpha[3, 6], alpha[3, 9]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 8], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 6], alpha[3, 8]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 3], alpha[3, 8]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 2], alpha[2, 4], alpha[2, 5], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 1], alpha[2, 2], alpha[2, 5], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 0], alpha[2, 2], alpha[2, 5], alpha[3, 3], alpha[3, 6]}, {alpha[1, 5], alpha[2, 8], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 8]}]:

ans7 := [{alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 3], alpha[3, 6], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 4], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 4], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 9]}]:

and my procedure

SubsetPairs:= (A::list(set), B::list(set))->
    map(z-> [ListTools:-SearchAll](true, map(w-> z subset w, B)), A)
:
SubsetPairs(ans6, ans7);

The result of applying SubsetPairs is:

[[], [], [1], [1], [1], [], [], [], [2, 3, 8, 23], [2, 4, 9, 24], [2, 5, 10, 25], [2, 6, 11, 26], [2, 7, 12, 27], [3, 4, 13, 28], [3, 5, 14, 29], [3, 6, 15, 30], [3, 7, 16], [4, 5, 17], [4, 6, 18], [4, 7, 19]]

When it is used for long lists, it takes a long time to return the results.  I wonder if a more time- and memory-efficient code can be implemented (perhaps Threads or Grid can be used).

In addition to that, how can a diagram (figure, plot, ...) be drawn to show which subset of the first list is linked to which subsets of the second list (including no link as well).  The length of the first list is always smaller than the length of the second list.  

Many thanks

 

First 344 345 346 347 348 349 350 Last Page 346 of 2308