acer

29759 Reputation

29 Badges

19 years, 316 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Using seq is not the most efficient and convenient way to do this.

But you asked about it, so I'll answer the question as given.

In later versions you could do it in 1D Input as,

  seq(seq( if a[i,j]<0.2 then a[i,j]:=0 end if,i=1..20),j=1..20):
  a;

Otherwise you could do it as,

   seq(seq(`if`(b[i,j]<0.2,assign('b[i,j]',0),NULL),i=1..20),j=1..20);
   a;

There are other variants.

Here are two straightforward ways, using either diff or the D operator.

(You might also augment the original pde system with a new equation for the desired derivative, but I'll leave that.)

restart

CA0 := 0:CAi := 0.0336:L := 3:`&Gamma;_1` := 0.05:mu := 0.000894:rho := 998:Dab := 0.196e-8:
Re_1 := 4*`&Gamma;_1`*rho/mu:g := 9.8:delta := evalf(3*mu*`&Gamma;_1`/(rho^2*g))^(1/3):

Eq1 := mu*diff(uy(z), z, z) = -rho*g;

0.894e-3*(diff(diff(uy(z), z), z)) = -9780.4

Bcs := uy(delta) = 0., D[1](uy)(0) = 0.;

uy(0.2395046078e-3) = 0., (D(uy))(0) = 0.

sol:=dsolve({Bcs, Eq1}):UY:=rhs(sol);

-(2445100000/447)*z^2+35064235998909136283971/111750000000000000000000

uy_bar := rho*g*delta^2/(3*mu):

Eq2 := UY*diff(CA(y, z), y) = Dab*diff(CA(y, z), z, z);

(-(2445100000/447)*z^2+35064235998909136283971/111750000000000000000000)*(diff(CA(y, z), y)) = 0.196e-8*(diff(diff(CA(y, z), z), z))

IBC := {CA(0, z) = 0, CA(y, 0) = 0.0336, D[2](CA)(y, delta) = 0};

{CA(0, z) = 0, CA(y, 0) = 0.336e-1, (D[2](CA))(y, 0.2395046078e-3) = 0}

sol2:= pdsolve(Eq2, IBC, numeric)

_m139841087304896

sol2:-value(output=listprocedure);

[y = proc () option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; evalf(args[1]) end proc, z = proc () option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; evalf(args[2]) end proc, CA(y, z) = proc () local tv, xv, solnproc, stype, ndsol, vals; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; Digits := trunc(evalhf(Digits)); solnproc := proc (tv, xv) local INFO, errest, nd, dvars, dary, daryt, daryx, vals, msg, i, j; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; table( [( "soln_procedures" ) = array( 1 .. 1, [( 1 ) = (36893627988508775364)  ] ) ] ) INFO := table( [( "depshift" ) = [1], ( "spaceadaptive" ) = false, ( "autonomous" ) = true, ( "periodic" ) = false, ( "solmat_i2" ) = 0, ( "solmatrix" ) = Matrix(21, 8, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = .0, (1, 8) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (2, 8) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (3, 8) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (4, 7) = .0, (4, 8) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (5, 8) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0, (6, 8) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (7, 7) = .0, (7, 8) = .0, (8, 1) = .0, (8, 2) = .0, (8, 3) = .0, (8, 4) = .0, (8, 5) = .0, (8, 6) = .0, (8, 7) = .0, (8, 8) = .0, (9, 1) = .0, (9, 2) = .0, (9, 3) = .0, (9, 4) = .0, (9, 5) = .0, (9, 6) = .0, (9, 7) = .0, (9, 8) = .0, (10, 1) = .0, (10, 2) = .0, (10, 3) = .0, (10, 4) = .0, (10, 5) = .0, (10, 6) = .0, (10, 7) = .0, (10, 8) = .0, (11, 1) = .0, (11, 2) = .0, (11, 3) = .0, (11, 4) = .0, (11, 5) = .0, (11, 6) = .0, (11, 7) = .0, (11, 8) = .0, (12, 1) = .0, (12, 2) = .0, (12, 3) = .0, (12, 4) = .0, (12, 5) = .0, (12, 6) = .0, (12, 7) = .0, (12, 8) = .0, (13, 1) = .0, (13, 2) = .0, (13, 3) = .0, (13, 4) = .0, (13, 5) = .0, (13, 6) = .0, (13, 7) = .0, (13, 8) = .0, (14, 1) = .0, (14, 2) = .0, (14, 3) = .0, (14, 4) = .0, (14, 5) = .0, (14, 6) = .0, (14, 7) = .0, (14, 8) = .0, (15, 1) = .0, (15, 2) = .0, (15, 3) = .0, (15, 4) = .0, (15, 5) = .0, (15, 6) = .0, (15, 7) = .0, (15, 8) = .0, (16, 1) = .0, (16, 2) = .0, (16, 3) = .0, (16, 4) = .0, (16, 5) = .0, (16, 6) = .0, (16, 7) = .0, (16, 8) = .0, (17, 1) = .0, (17, 2) = .0, (17, 3) = .0, (17, 4) = .0, (17, 5) = .0, (17, 6) = .0, (17, 7) = .0, (17, 8) = .0, (18, 1) = .0, (18, 2) = .0, (18, 3) = .0, (18, 4) = .0, (18, 5) = .0, (18, 6) = .0, (18, 7) = .0, (18, 8) = .0, (19, 1) = .0, (19, 2) = .0, (19, 3) = .0, (19, 4) = .0, (19, 5) = .0, (19, 6) = .0, (19, 7) = .0, (19, 8) = .0, (20, 1) = .0, (20, 2) = .0, (20, 3) = .0, (20, 4) = .0, (20, 5) = .0, (20, 6) = .0, (20, 7) = .0, (20, 8) = .0, (21, 1) = .0, (21, 2) = .0, (21, 3) = .0, (21, 4) = .0, (21, 5) = .0, (21, 6) = .0, (21, 7) = .0, (21, 8) = .0}, datatype = float[8], order = C_order), ( "bandwidth" ) = [2, 3], ( "intspace" ) = Matrix(21, 1, {(1, 1) = .0, (2, 1) = .0, (3, 1) = .0, (4, 1) = .0, (5, 1) = .0, (6, 1) = .0, (7, 1) = .0, (8, 1) = .0, (9, 1) = .0, (10, 1) = .0, (11, 1) = .0, (12, 1) = .0, (13, 1) = .0, (14, 1) = .0, (15, 1) = .0, (16, 1) = .0, (17, 1) = .0, (18, 1) = .0, (19, 1) = .0, (20, 1) = .0, (21, 1) = .0}, datatype = float[8], order = C_order), ( "timevar" ) = y, ( "solmat_is" ) = 0, ( "mixed" ) = false, ( "method" ) = theta, ( "linear" ) = true, ( "timeadaptive" ) = false, ( "IBC" ) = b, ( "multidep" ) = [false, false], ( "solvec2" ) = Vector(21, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = .0}, datatype = float[8]), ( "totalwidth" ) = 8, ( "matrixhf" ) = true, ( "solmat_i1" ) = 0, ( "solvec3" ) = Vector(21, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = .0}, datatype = float[8]), ( "minspcpoints" ) = 4, ( "allocspace" ) = 21, ( "solspace" ) = Vector(21, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = 0.2395046078e-3}, datatype = float[8]), ( "inputargs" ) = [(-(2445100000/447)*z^2+35064235998909136283971/111750000000000000000000)*(diff(CA(y, z), y)) = 0.196e-8*(diff(diff(CA(y, z), z), z)), {CA(0, z) = 0, CA(y, 0) = 0.336e-1, (D[2](CA))(y, 0.2395046078e-3) = 0}], ( "explicit" ) = false, ( "adjusted" ) = false, ( "indepvars" ) = [y, z], ( "depords" ) = [[1, 2]], ( "timestep" ) = 0.119752303900000e-4, ( "vectorhf" ) = true, ( "norigdepvars" ) = 1, ( "BCS", 1 ) = {[[1, 0, 0], b[1, 0, 0]-0.336e-1], [[1, 1, 0.2395046078e-3], b[1, 1, 0.2395046078e-3]]}, ( "ICS" ) = [0], ( "eqnords" ) = [[1, 2]], ( "rightwidth" ) = 0, ( "solution" ) = Array(1..3, 1..21, 1..1, {(1, 1, 1) = .0, (1, 2, 1) = .0, (1, 3, 1) = .0, (1, 4, 1) = .0, (1, 5, 1) = .0, (1, 6, 1) = .0, (1, 7, 1) = .0, (1, 8, 1) = .0, (1, 9, 1) = .0, (1, 10, 1) = .0, (1, 11, 1) = .0, (1, 12, 1) = .0, (1, 13, 1) = .0, (1, 14, 1) = .0, (1, 15, 1) = .0, (1, 16, 1) = .0, (1, 17, 1) = .0, (1, 18, 1) = .0, (1, 19, 1) = .0, (1, 20, 1) = .0, (1, 21, 1) = .0, (2, 1, 1) = .0, (2, 2, 1) = .0, (2, 3, 1) = .0, (2, 4, 1) = .0, (2, 5, 1) = .0, (2, 6, 1) = .0, (2, 7, 1) = .0, (2, 8, 1) = .0, (2, 9, 1) = .0, (2, 10, 1) = .0, (2, 11, 1) = .0, (2, 12, 1) = .0, (2, 13, 1) = .0, (2, 14, 1) = .0, (2, 15, 1) = .0, (2, 16, 1) = .0, (2, 17, 1) = .0, (2, 18, 1) = .0, (2, 19, 1) = .0, (2, 20, 1) = .0, (2, 21, 1) = .0, (3, 1, 1) = .0, (3, 2, 1) = .0, (3, 3, 1) = .0, (3, 4, 1) = .0, (3, 5, 1) = .0, (3, 6, 1) = .0, (3, 7, 1) = .0, (3, 8, 1) = .0, (3, 9, 1) = .0, (3, 10, 1) = .0, (3, 11, 1) = .0, (3, 12, 1) = .0, (3, 13, 1) = .0, (3, 14, 1) = .0, (3, 15, 1) = .0, (3, 16, 1) = .0, (3, 17, 1) = .0, (3, 18, 1) = .0, (3, 19, 1) = .0, (3, 20, 1) = .0, (3, 21, 1) = .0}, datatype = float[8], order = C_order), ( "pts", z ) = [0, 0.2395046078e-3], ( "solmat_ne" ) = 0, ( "dependson" ) = [{1}], ( "fdepvars" ) = [CA(y, z)], ( "maxords" ) = [1, 2], ( "eqndep" ) = [1], ( "PDEs" ) = [(-(2445100000/447)*z^2+35064235998909136283971/111750000000000000000000)*(diff(CA(y, z), y))-(49/25000000000)*(diff(diff(CA(y, z), z), z))], ( "extrabcs" ) = [0], ( "startup_only" ) = false, ( "leftwidth" ) = 1, ( "erroraccum" ) = true, ( "spacepts" ) = 21, ( "initialized" ) = false, ( "solmat_v" ) = Vector(168, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = .0, (22) = .0, (23) = .0, (24) = .0, (25) = .0, (26) = .0, (27) = .0, (28) = .0, (29) = .0, (30) = .0, (31) = .0, (32) = .0, (33) = .0, (34) = .0, (35) = .0, (36) = .0, (37) = .0, (38) = .0, (39) = .0, (40) = .0, (41) = .0, (42) = .0, (43) = .0, (44) = .0, (45) = .0, (46) = .0, (47) = .0, (48) = .0, (49) = .0, (50) = .0, (51) = .0, (52) = .0, (53) = .0, (54) = .0, (55) = .0, (56) = .0, (57) = .0, (58) = .0, (59) = .0, (60) = .0, (61) = .0, (62) = .0, (63) = .0, (64) = .0, (65) = .0, (66) = .0, (67) = .0, (68) = .0, (69) = .0, (70) = .0, (71) = .0, (72) = .0, (73) = .0, (74) = .0, (75) = .0, (76) = .0, (77) = .0, (78) = .0, (79) = .0, (80) = .0, (81) = .0, (82) = .0, (83) = .0, (84) = .0, (85) = .0, (86) = .0, (87) = .0, (88) = .0, (89) = .0, (90) = .0, (91) = .0, (92) = .0, (93) = .0, (94) = .0, (95) = .0, (96) = .0, (97) = .0, (98) = .0, (99) = .0, (100) = .0, (101) = .0, (102) = .0, (103) = .0, (104) = .0, (105) = .0, (106) = .0, (107) = .0, (108) = .0, (109) = .0, (110) = .0, (111) = .0, (112) = .0, (113) = .0, (114) = .0, (115) = .0, (116) = .0, (117) = .0, (118) = .0, (119) = .0, (120) = .0, (121) = .0, (122) = .0, (123) = .0, (124) = .0, (125) = .0, (126) = .0, (127) = .0, (128) = .0, (129) = .0, (130) = .0, (131) = .0, (132) = .0, (133) = .0, (134) = .0, (135) = .0, (136) = .0, (137) = .0, (138) = .0, (139) = .0, (140) = .0, (141) = .0, (142) = .0, (143) = .0, (144) = .0, (145) = .0, (146) = .0, (147) = .0, (148) = .0, (149) = .0, (150) = .0, (151) = .0, (152) = .0, (153) = .0, (154) = .0, (155) = .0, (156) = .0, (157) = .0, (158) = .0, (159) = .0, (160) = .0, (161) = .0, (162) = .0, (163) = .0, (164) = .0, (165) = .0, (166) = .0, (167) = .0, (168) = .0}, datatype = float[8], order = C_order, attributes = [source_rtable = (Matrix(21, 8, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = .0, (1, 8) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (2, 8) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (3, 8) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (4, 7) = .0, (4, 8) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (5, 8) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0, (6, 8) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (7, 7) = .0, (7, 8) = .0, (8, 1) = .0, (8, 2) = .0, (8, 3) = .0, (8, 4) = .0, (8, 5) = .0, (8, 6) = .0, (8, 7) = .0, (8, 8) = .0, (9, 1) = .0, (9, 2) = .0, (9, 3) = .0, (9, 4) = .0, (9, 5) = .0, (9, 6) = .0, (9, 7) = .0, (9, 8) = .0, (10, 1) = .0, (10, 2) = .0, (10, 3) = .0, (10, 4) = .0, (10, 5) = .0, (10, 6) = .0, (10, 7) = .0, (10, 8) = .0, (11, 1) = .0, (11, 2) = .0, (11, 3) = .0, (11, 4) = .0, (11, 5) = .0, (11, 6) = .0, (11, 7) = .0, (11, 8) = .0, (12, 1) = .0, (12, 2) = .0, (12, 3) = .0, (12, 4) = .0, (12, 5) = .0, (12, 6) = .0, (12, 7) = .0, (12, 8) = .0, (13, 1) = .0, (13, 2) = .0, (13, 3) = .0, (13, 4) = .0, (13, 5) = .0, (13, 6) = .0, (13, 7) = .0, (13, 8) = .0, (14, 1) = .0, (14, 2) = .0, (14, 3) = .0, (14, 4) = .0, (14, 5) = .0, (14, 6) = .0, (14, 7) = .0, (14, 8) = .0, (15, 1) = .0, (15, 2) = .0, (15, 3) = .0, (15, 4) = .0, (15, 5) = .0, (15, 6) = .0, (15, 7) = .0, (15, 8) = .0, (16, 1) = .0, (16, 2) = .0, (16, 3) = .0, (16, 4) = .0, (16, 5) = .0, (16, 6) = .0, (16, 7) = .0, (16, 8) = .0, (17, 1) = .0, (17, 2) = .0, (17, 3) = .0, (17, 4) = .0, (17, 5) = .0, (17, 6) = .0, (17, 7) = .0, (17, 8) = .0, (18, 1) = .0, (18, 2) = .0, (18, 3) = .0, (18, 4) = .0, (18, 5) = .0, (18, 6) = .0, (18, 7) = .0, (18, 8) = .0, (19, 1) = .0, (19, 2) = .0, (19, 3) = .0, (19, 4) = .0, (19, 5) = .0, (19, 6) = .0, (19, 7) = .0, (19, 8) = .0, (20, 1) = .0, (20, 2) = .0, (20, 3) = .0, (20, 4) = .0, (20, 5) = .0, (20, 6) = .0, (20, 7) = .0, (20, 8) = .0, (21, 1) = .0, (21, 2) = .0, (21, 3) = .0, (21, 4) = .0, (21, 5) = .0, (21, 6) = .0, (21, 7) = .0, (21, 8) = .0}, datatype = float[8], order = C_order))]), ( "solvec1" ) = Vector(21, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = .0}, datatype = float[8]), ( "theta" ) = 1/2, ( "t0" ) = 0, ( "soltimes" ) = Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]), ( "stages" ) = 1, ( "spaceidx" ) = 2, ( "spacestep" ) = 0.119752303900000e-4, ( "depeqn" ) = [1], ( "vectorproc" ) = proc (v, vp, vpp, t, x, k, h, n, vec) local _s1, _s2, _s3, _s4, xi; _s2 := (49/50000000000)/h^2; _s3 := -(2445100000/447)/k; _s4 := (35064235998909136283971/111750000000000000000000)/k; vec[1] := 0.336e-1; vec[n] := 0; for xi from 2 to n-1 do _s1 := vp[xi-1]-2*vp[xi]+vp[xi+1]; vec[xi] := _s2*_s1+(_s3*x[xi]^2+_s4)*vp[xi] end do end proc, ( "solvec5" ) = 0, ( "depvars" ) = [CA], ( "timeidx" ) = 1, ( "spacevar" ) = z, ( "depdords" ) = [[[1, 2]]], ( "banded" ) = true, ( "solvec4" ) = 0, ( "matrixproc" ) = proc (v, vp, vpp, t, x, k, h, n, mat) local _s1, _s2, _s3, xi; _s1 := -(49/50000000000)/h^2; _s2 := -(2445100000/447)/k; _s3 := (49/111750000000000000000000)*(715596653038961964979*h^2+4470000000000*k)/(k*h^2); mat[4] := 1; mat[8*n-4] := (3/2)/h; mat[8*n-6] := (1/2)/h; mat[8*n-5] := -2/h; for xi from 2 to n-1 do mat[8*xi-4] := _s2*x[xi]^2+_s3; mat[8*xi-5] := _s1; mat[8*xi-3] := _s1 end do end proc, ( "errorest" ) = false ] ); if xv = "left" then return INFO["solspace"][1] elif xv = "right" then return INFO["solspace"][INFO["spacepts"]] elif tv = "start" then return INFO["t0"] elif not (type(tv, 'numeric') and type(xv, 'numeric')) then error "non-numeric input" end if; if xv < INFO["solspace"][1] or INFO["solspace"][INFO["spacepts"]] < xv then error "requested %1 value must be in the range %2..%3", INFO["spacevar"], INFO["solspace"][1], INFO["solspace"][INFO["spacepts"]] end if; dary := Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]); daryt := 0; daryx := 0; dvars := []; errest := false; nd := nops(INFO["depvars"]); if dary[nd+1] <> tv then try `pdsolve/numeric/evolve_solution`(INFO, tv) catch: msg := StringTools:-FormatMessage(lastexception[2 .. -1]); if tv < INFO["t0"] then error cat("unable to compute solution for %1<%2:
", msg), INFO["timevar"], INFO["failtime"] else error cat("unable to compute solution for %1>%2:
", msg), INFO["timevar"], INFO["failtime"] end if end try end if; if dary[nd+1] <> tv or dary[nd+2] <> xv then `pdsolve/interp2dto0d`(3, INFO["soltimes"], INFO["spacepts"], INFO["solspace"], nops(INFO["depvars"]), INFO["solution"], true, tv, xv, dary); if errest then `pdsolve/interp2dto0d`(3, INFO["soltimes"], INFO["spacepts"], INFO["err_t"], nops(INFO["depvars"]), INFO["solution"], true, tv, xv, daryt); `pdsolve/interp2dto0d`(3, INFO["soltimes"], INFO["spacepts"], INFO["err_x"], nops(INFO["depvars"]), INFO["solution"], true, tv, xv, daryx) end if end if; dary[nd+1] := tv; dary[nd+2] := xv; if dvars = [] then [seq(dary[i], i = 1 .. INFO["norigdepvars"])] else vals := NULL; for i to nops(dvars) do j := eval(dvars[i]); try if errest then vals := vals, evalhf(j(tv, xv, dary, daryt, daryx)) else vals := vals, evalhf(j(tv, xv, dary)) end if catch: userinfo(5, `pdsolve/numeric`, `evalhf failure`); try if errest then vals := vals, j(tv, xv, dary, daryt, daryx) else vals := vals, j(tv, xv, dary) end if catch: vals := vals, undefined end try end try end do; [vals] end if end proc; stype := "1st"; if nargs = 1 then if args[1] = "left" then return solnproc(0, "left") elif args[1] = "right" then return solnproc(0, "right") elif args[1] = "start" then return solnproc("start", 0) else error "too few arguments to solution procedure" end if elif nargs = 2 then if stype = "1st" then tv := evalf(args[1]); xv := evalf(args[2]) else tv := evalf(args[2]); xv := evalf(args[1]) end if; if not (type(tv, 'numeric') and type(xv, 'numeric')) then if procname <> unknown then return ('procname')(args[1 .. nargs]) else ndsol := pointto(solnproc("soln_procedures")[1]); return ('ndsol')(args[1 .. nargs]) end if end if else error "incorrect arguments to solution procedure" end if; vals := solnproc(tv, xv); vals[1] end proc]

U:= subs(sol2:-value(output=listprocedure), CA(y, z));

proc () local tv, xv, solnproc, stype, ndsol, vals; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; Digits := trunc(evalhf(Digits)); solnproc := proc (tv, xv) local INFO, errest, nd, dvars, dary, daryt, daryx, vals, msg, i, j; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; table( [( "soln_procedures" ) = array( 1 .. 1, [( 1 ) = (36893627988508777740)  ] ) ] ) INFO := table( [( "depshift" ) = [1], ( "spaceadaptive" ) = false, ( "autonomous" ) = true, ( "periodic" ) = false, ( "solmat_i2" ) = 0, ( "solmatrix" ) = Matrix(21, 8, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = .0, (1, 8) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (2, 8) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (3, 8) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (4, 7) = .0, (4, 8) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (5, 8) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0, (6, 8) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (7, 7) = .0, (7, 8) = .0, (8, 1) = .0, (8, 2) = .0, (8, 3) = .0, (8, 4) = .0, (8, 5) = .0, (8, 6) = .0, (8, 7) = .0, (8, 8) = .0, (9, 1) = .0, (9, 2) = .0, (9, 3) = .0, (9, 4) = .0, (9, 5) = .0, (9, 6) = .0, (9, 7) = .0, (9, 8) = .0, (10, 1) = .0, (10, 2) = .0, (10, 3) = .0, (10, 4) = .0, (10, 5) = .0, (10, 6) = .0, (10, 7) = .0, (10, 8) = .0, (11, 1) = .0, (11, 2) = .0, (11, 3) = .0, (11, 4) = .0, (11, 5) = .0, (11, 6) = .0, (11, 7) = .0, (11, 8) = .0, (12, 1) = .0, (12, 2) = .0, (12, 3) = .0, (12, 4) = .0, (12, 5) = .0, (12, 6) = .0, (12, 7) = .0, (12, 8) = .0, (13, 1) = .0, (13, 2) = .0, (13, 3) = .0, (13, 4) = .0, (13, 5) = .0, (13, 6) = .0, (13, 7) = .0, (13, 8) = .0, (14, 1) = .0, (14, 2) = .0, (14, 3) = .0, (14, 4) = .0, (14, 5) = .0, (14, 6) = .0, (14, 7) = .0, (14, 8) = .0, (15, 1) = .0, (15, 2) = .0, (15, 3) = .0, (15, 4) = .0, (15, 5) = .0, (15, 6) = .0, (15, 7) = .0, (15, 8) = .0, (16, 1) = .0, (16, 2) = .0, (16, 3) = .0, (16, 4) = .0, (16, 5) = .0, (16, 6) = .0, (16, 7) = .0, (16, 8) = .0, (17, 1) = .0, (17, 2) = .0, (17, 3) = .0, (17, 4) = .0, (17, 5) = .0, (17, 6) = .0, (17, 7) = .0, (17, 8) = .0, (18, 1) = .0, (18, 2) = .0, (18, 3) = .0, (18, 4) = .0, (18, 5) = .0, (18, 6) = .0, (18, 7) = .0, (18, 8) = .0, (19, 1) = .0, (19, 2) = .0, (19, 3) = .0, (19, 4) = .0, (19, 5) = .0, (19, 6) = .0, (19, 7) = .0, (19, 8) = .0, (20, 1) = .0, (20, 2) = .0, (20, 3) = .0, (20, 4) = .0, (20, 5) = .0, (20, 6) = .0, (20, 7) = .0, (20, 8) = .0, (21, 1) = .0, (21, 2) = .0, (21, 3) = .0, (21, 4) = .0, (21, 5) = .0, (21, 6) = .0, (21, 7) = .0, (21, 8) = .0}, datatype = float[8], order = C_order), ( "bandwidth" ) = [2, 3], ( "intspace" ) = Matrix(21, 1, {(1, 1) = .0, (2, 1) = .0, (3, 1) = .0, (4, 1) = .0, (5, 1) = .0, (6, 1) = .0, (7, 1) = .0, (8, 1) = .0, (9, 1) = .0, (10, 1) = .0, (11, 1) = .0, (12, 1) = .0, (13, 1) = .0, (14, 1) = .0, (15, 1) = .0, (16, 1) = .0, (17, 1) = .0, (18, 1) = .0, (19, 1) = .0, (20, 1) = .0, (21, 1) = .0}, datatype = float[8], order = C_order), ( "timevar" ) = y, ( "solmat_is" ) = 0, ( "mixed" ) = false, ( "method" ) = theta, ( "linear" ) = true, ( "timeadaptive" ) = false, ( "IBC" ) = b, ( "multidep" ) = [false, false], ( "solvec2" ) = Vector(21, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = .0}, datatype = float[8]), ( "totalwidth" ) = 8, ( "matrixhf" ) = true, ( "solmat_i1" ) = 0, ( "solvec3" ) = Vector(21, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = .0}, datatype = float[8]), ( "minspcpoints" ) = 4, ( "allocspace" ) = 21, ( "solspace" ) = Vector(21, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = 0.2395046078e-3}, datatype = float[8]), ( "inputargs" ) = [(-(2445100000/447)*z^2+35064235998909136283971/111750000000000000000000)*(diff(CA(y, z), y)) = 0.196e-8*(diff(diff(CA(y, z), z), z)), {CA(0, z) = 0, CA(y, 0) = 0.336e-1, (D[2](CA))(y, 0.2395046078e-3) = 0}], ( "explicit" ) = false, ( "adjusted" ) = false, ( "indepvars" ) = [y, z], ( "depords" ) = [[1, 2]], ( "timestep" ) = 0.119752303900000e-4, ( "vectorhf" ) = true, ( "norigdepvars" ) = 1, ( "BCS", 1 ) = {[[1, 0, 0], b[1, 0, 0]-0.336e-1], [[1, 1, 0.2395046078e-3], b[1, 1, 0.2395046078e-3]]}, ( "ICS" ) = [0], ( "eqnords" ) = [[1, 2]], ( "rightwidth" ) = 0, ( "solution" ) = Array(1..3, 1..21, 1..1, {(1, 1, 1) = .0, (1, 2, 1) = .0, (1, 3, 1) = .0, (1, 4, 1) = .0, (1, 5, 1) = .0, (1, 6, 1) = .0, (1, 7, 1) = .0, (1, 8, 1) = .0, (1, 9, 1) = .0, (1, 10, 1) = .0, (1, 11, 1) = .0, (1, 12, 1) = .0, (1, 13, 1) = .0, (1, 14, 1) = .0, (1, 15, 1) = .0, (1, 16, 1) = .0, (1, 17, 1) = .0, (1, 18, 1) = .0, (1, 19, 1) = .0, (1, 20, 1) = .0, (1, 21, 1) = .0, (2, 1, 1) = .0, (2, 2, 1) = .0, (2, 3, 1) = .0, (2, 4, 1) = .0, (2, 5, 1) = .0, (2, 6, 1) = .0, (2, 7, 1) = .0, (2, 8, 1) = .0, (2, 9, 1) = .0, (2, 10, 1) = .0, (2, 11, 1) = .0, (2, 12, 1) = .0, (2, 13, 1) = .0, (2, 14, 1) = .0, (2, 15, 1) = .0, (2, 16, 1) = .0, (2, 17, 1) = .0, (2, 18, 1) = .0, (2, 19, 1) = .0, (2, 20, 1) = .0, (2, 21, 1) = .0, (3, 1, 1) = .0, (3, 2, 1) = .0, (3, 3, 1) = .0, (3, 4, 1) = .0, (3, 5, 1) = .0, (3, 6, 1) = .0, (3, 7, 1) = .0, (3, 8, 1) = .0, (3, 9, 1) = .0, (3, 10, 1) = .0, (3, 11, 1) = .0, (3, 12, 1) = .0, (3, 13, 1) = .0, (3, 14, 1) = .0, (3, 15, 1) = .0, (3, 16, 1) = .0, (3, 17, 1) = .0, (3, 18, 1) = .0, (3, 19, 1) = .0, (3, 20, 1) = .0, (3, 21, 1) = .0}, datatype = float[8], order = C_order), ( "pts", z ) = [0, 0.2395046078e-3], ( "solmat_ne" ) = 0, ( "dependson" ) = [{1}], ( "fdepvars" ) = [CA(y, z)], ( "maxords" ) = [1, 2], ( "eqndep" ) = [1], ( "PDEs" ) = [(-(2445100000/447)*z^2+35064235998909136283971/111750000000000000000000)*(diff(CA(y, z), y))-(49/25000000000)*(diff(diff(CA(y, z), z), z))], ( "extrabcs" ) = [0], ( "startup_only" ) = false, ( "leftwidth" ) = 1, ( "erroraccum" ) = true, ( "spacepts" ) = 21, ( "initialized" ) = false, ( "solmat_v" ) = Vector(168, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = .0, (22) = .0, (23) = .0, (24) = .0, (25) = .0, (26) = .0, (27) = .0, (28) = .0, (29) = .0, (30) = .0, (31) = .0, (32) = .0, (33) = .0, (34) = .0, (35) = .0, (36) = .0, (37) = .0, (38) = .0, (39) = .0, (40) = .0, (41) = .0, (42) = .0, (43) = .0, (44) = .0, (45) = .0, (46) = .0, (47) = .0, (48) = .0, (49) = .0, (50) = .0, (51) = .0, (52) = .0, (53) = .0, (54) = .0, (55) = .0, (56) = .0, (57) = .0, (58) = .0, (59) = .0, (60) = .0, (61) = .0, (62) = .0, (63) = .0, (64) = .0, (65) = .0, (66) = .0, (67) = .0, (68) = .0, (69) = .0, (70) = .0, (71) = .0, (72) = .0, (73) = .0, (74) = .0, (75) = .0, (76) = .0, (77) = .0, (78) = .0, (79) = .0, (80) = .0, (81) = .0, (82) = .0, (83) = .0, (84) = .0, (85) = .0, (86) = .0, (87) = .0, (88) = .0, (89) = .0, (90) = .0, (91) = .0, (92) = .0, (93) = .0, (94) = .0, (95) = .0, (96) = .0, (97) = .0, (98) = .0, (99) = .0, (100) = .0, (101) = .0, (102) = .0, (103) = .0, (104) = .0, (105) = .0, (106) = .0, (107) = .0, (108) = .0, (109) = .0, (110) = .0, (111) = .0, (112) = .0, (113) = .0, (114) = .0, (115) = .0, (116) = .0, (117) = .0, (118) = .0, (119) = .0, (120) = .0, (121) = .0, (122) = .0, (123) = .0, (124) = .0, (125) = .0, (126) = .0, (127) = .0, (128) = .0, (129) = .0, (130) = .0, (131) = .0, (132) = .0, (133) = .0, (134) = .0, (135) = .0, (136) = .0, (137) = .0, (138) = .0, (139) = .0, (140) = .0, (141) = .0, (142) = .0, (143) = .0, (144) = .0, (145) = .0, (146) = .0, (147) = .0, (148) = .0, (149) = .0, (150) = .0, (151) = .0, (152) = .0, (153) = .0, (154) = .0, (155) = .0, (156) = .0, (157) = .0, (158) = .0, (159) = .0, (160) = .0, (161) = .0, (162) = .0, (163) = .0, (164) = .0, (165) = .0, (166) = .0, (167) = .0, (168) = .0}, datatype = float[8], order = C_order, attributes = [source_rtable = (Matrix(21, 8, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = .0, (1, 8) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (2, 8) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (3, 8) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (4, 7) = .0, (4, 8) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (5, 8) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0, (6, 8) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (7, 7) = .0, (7, 8) = .0, (8, 1) = .0, (8, 2) = .0, (8, 3) = .0, (8, 4) = .0, (8, 5) = .0, (8, 6) = .0, (8, 7) = .0, (8, 8) = .0, (9, 1) = .0, (9, 2) = .0, (9, 3) = .0, (9, 4) = .0, (9, 5) = .0, (9, 6) = .0, (9, 7) = .0, (9, 8) = .0, (10, 1) = .0, (10, 2) = .0, (10, 3) = .0, (10, 4) = .0, (10, 5) = .0, (10, 6) = .0, (10, 7) = .0, (10, 8) = .0, (11, 1) = .0, (11, 2) = .0, (11, 3) = .0, (11, 4) = .0, (11, 5) = .0, (11, 6) = .0, (11, 7) = .0, (11, 8) = .0, (12, 1) = .0, (12, 2) = .0, (12, 3) = .0, (12, 4) = .0, (12, 5) = .0, (12, 6) = .0, (12, 7) = .0, (12, 8) = .0, (13, 1) = .0, (13, 2) = .0, (13, 3) = .0, (13, 4) = .0, (13, 5) = .0, (13, 6) = .0, (13, 7) = .0, (13, 8) = .0, (14, 1) = .0, (14, 2) = .0, (14, 3) = .0, (14, 4) = .0, (14, 5) = .0, (14, 6) = .0, (14, 7) = .0, (14, 8) = .0, (15, 1) = .0, (15, 2) = .0, (15, 3) = .0, (15, 4) = .0, (15, 5) = .0, (15, 6) = .0, (15, 7) = .0, (15, 8) = .0, (16, 1) = .0, (16, 2) = .0, (16, 3) = .0, (16, 4) = .0, (16, 5) = .0, (16, 6) = .0, (16, 7) = .0, (16, 8) = .0, (17, 1) = .0, (17, 2) = .0, (17, 3) = .0, (17, 4) = .0, (17, 5) = .0, (17, 6) = .0, (17, 7) = .0, (17, 8) = .0, (18, 1) = .0, (18, 2) = .0, (18, 3) = .0, (18, 4) = .0, (18, 5) = .0, (18, 6) = .0, (18, 7) = .0, (18, 8) = .0, (19, 1) = .0, (19, 2) = .0, (19, 3) = .0, (19, 4) = .0, (19, 5) = .0, (19, 6) = .0, (19, 7) = .0, (19, 8) = .0, (20, 1) = .0, (20, 2) = .0, (20, 3) = .0, (20, 4) = .0, (20, 5) = .0, (20, 6) = .0, (20, 7) = .0, (20, 8) = .0, (21, 1) = .0, (21, 2) = .0, (21, 3) = .0, (21, 4) = .0, (21, 5) = .0, (21, 6) = .0, (21, 7) = .0, (21, 8) = .0}, datatype = float[8], order = C_order))]), ( "solvec1" ) = Vector(21, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0, (15) = .0, (16) = .0, (17) = .0, (18) = .0, (19) = .0, (20) = .0, (21) = .0}, datatype = float[8]), ( "theta" ) = 1/2, ( "t0" ) = 0, ( "soltimes" ) = Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]), ( "stages" ) = 1, ( "spaceidx" ) = 2, ( "spacestep" ) = 0.119752303900000e-4, ( "depeqn" ) = [1], ( "vectorproc" ) = proc (v, vp, vpp, t, x, k, h, n, vec) local _s1, _s2, _s3, _s4, xi; _s2 := (49/50000000000)/h^2; _s3 := -(2445100000/447)/k; _s4 := (35064235998909136283971/111750000000000000000000)/k; vec[1] := 0.336e-1; vec[n] := 0; for xi from 2 to n-1 do _s1 := vp[xi-1]-2*vp[xi]+vp[xi+1]; vec[xi] := _s2*_s1+(_s3*x[xi]^2+_s4)*vp[xi] end do end proc, ( "solvec5" ) = 0, ( "depvars" ) = [CA], ( "timeidx" ) = 1, ( "spacevar" ) = z, ( "depdords" ) = [[[1, 2]]], ( "banded" ) = true, ( "solvec4" ) = 0, ( "matrixproc" ) = proc (v, vp, vpp, t, x, k, h, n, mat) local _s1, _s2, _s3, xi; _s1 := -(49/50000000000)/h^2; _s2 := -(2445100000/447)/k; _s3 := (49/111750000000000000000000)*(715596653038961964979*h^2+4470000000000*k)/(k*h^2); mat[4] := 1; mat[8*n-4] := (3/2)/h; mat[8*n-6] := (1/2)/h; mat[8*n-5] := -2/h; for xi from 2 to n-1 do mat[8*xi-4] := _s2*x[xi]^2+_s3; mat[8*xi-5] := _s1; mat[8*xi-3] := _s1 end do end proc, ( "errorest" ) = false ] ); if xv = "left" then return INFO["solspace"][1] elif xv = "right" then return INFO["solspace"][INFO["spacepts"]] elif tv = "start" then return INFO["t0"] elif not (type(tv, 'numeric') and type(xv, 'numeric')) then error "non-numeric input" end if; if xv < INFO["solspace"][1] or INFO["solspace"][INFO["spacepts"]] < xv then error "requested %1 value must be in the range %2..%3", INFO["spacevar"], INFO["solspace"][1], INFO["solspace"][INFO["spacepts"]] end if; dary := Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]); daryt := 0; daryx := 0; dvars := []; errest := false; nd := nops(INFO["depvars"]); if dary[nd+1] <> tv then try `pdsolve/numeric/evolve_solution`(INFO, tv) catch: msg := StringTools:-FormatMessage(lastexception[2 .. -1]); if tv < INFO["t0"] then error cat("unable to compute solution for %1<%2:
", msg), INFO["timevar"], INFO["failtime"] else error cat("unable to compute solution for %1>%2:
", msg), INFO["timevar"], INFO["failtime"] end if end try end if; if dary[nd+1] <> tv or dary[nd+2] <> xv then `pdsolve/interp2dto0d`(3, INFO["soltimes"], INFO["spacepts"], INFO["solspace"], nops(INFO["depvars"]), INFO["solution"], true, tv, xv, dary); if errest then `pdsolve/interp2dto0d`(3, INFO["soltimes"], INFO["spacepts"], INFO["err_t"], nops(INFO["depvars"]), INFO["solution"], true, tv, xv, daryt); `pdsolve/interp2dto0d`(3, INFO["soltimes"], INFO["spacepts"], INFO["err_x"], nops(INFO["depvars"]), INFO["solution"], true, tv, xv, daryx) end if end if; dary[nd+1] := tv; dary[nd+2] := xv; if dvars = [] then [seq(dary[i], i = 1 .. INFO["norigdepvars"])] else vals := NULL; for i to nops(dvars) do j := eval(dvars[i]); try if errest then vals := vals, evalhf(j(tv, xv, dary, daryt, daryx)) else vals := vals, evalhf(j(tv, xv, dary)) end if catch: userinfo(5, `pdsolve/numeric`, `evalhf failure`); try if errest then vals := vals, j(tv, xv, dary, daryt, daryx) else vals := vals, j(tv, xv, dary) end if catch: vals := vals, undefined end try end try end do; [vals] end if end proc; stype := "1st"; if nargs = 1 then if args[1] = "left" then return solnproc(0, "left") elif args[1] = "right" then return solnproc(0, "right") elif args[1] = "start" then return solnproc("start", 0) else error "too few arguments to solution procedure" end if elif nargs = 2 then if stype = "1st" then tv := evalf(args[1]); xv := evalf(args[2]) else tv := evalf(args[2]); xv := evalf(args[1]) end if; if not (type(tv, 'numeric') and type(xv, 'numeric')) then if procname <> unknown then return ('procname')(args[1 .. nargs]) else ndsol := pointto(solnproc("soln_procedures")[1]); return ('ndsol')(args[1 .. nargs]) end if end if else error "incorrect arguments to solution procedure" end if; vals := solnproc(tv, xv); vals[1] end proc

U(1e-5,1e-6)

HFloat(0.02593255728999584)

D[2](U)(0.3, 1e-4);

-115.5158009

plot((D[2](U))(y, 0.1e-3), y = 0 .. 1, adaptive = false, numpoints = 20, size = [500, 200])

foo := diff( U(y,z), z );

diff(U(y, z), z)

eval(foo, [y=0.3, z=1e-4]);

-115.5158009

plot(eval(foo, z = 0.1e-3), y = 0 .. 1, adaptive = false, numpoints = 20, size = [500, 200])

Download Hw-02-01_problem_ac.mw

It's worded like that because only some tasks can be better done much more efficiently with the functional forms. It's not always the case.

Do-loops are not inherently inefficient. In fact they can sometimes be outright useful in writing very efficient code, eg. if one is trying to write procedures that can be run under evalhf or Compile.

I don't know your definition of "Generally speaking". Sometimes it seems more common for people to write inefficient code using loops -- though of course doing so is also possible with functional programming equivalents.

There are some common tasks that are often done poorly with loops. One class of such involves unnecessarily higher order computational complexity (often memory-space complexity, but sometimes time), eg. O(n^2) verus O(n), etc.

Would it help if you were shown examples of some common efficiency anti-patterns?

Here's one example. The procedure p3 below is inefficient in memory use and (partly due to ensuing memory management) time cost, and scales up very badly wrt size, but it's a code form that is often seen. I've even seen its poor technique in textbooks.

restart;

n := 10^5:

 

p1 := proc(N) local i;
  [seq(i^2, i=1..N)];
end proc:

p2 := proc(N) local i,T;
  T := table():
  for i from 1 to N do
    T[i] := i^2;
  end do:
  convert(T,list);
end proc:

p3 := proc(N) local i,R;
  R := []:
  for i from 1 to N do
    R := [op(R), i^2];
  end do:
  R;
end proc:


And now,

CodeTools:-Usage( p1(n) ):

memory used=5.27MiB, alloc change=0 bytes, cpu time=20.00ms, real time=21.00ms, gc time=0ns

CodeTools:-Usage( p2(n) ):

memory used=33.79MiB, alloc change=46.78MiB, cpu time=302.00ms, real time=305.00ms, gc time=81.00ms

CodeTools:-Usage( p3(n) ):

memory used=37.26GiB, alloc change=24.71MiB, cpu time=31.15s, real time=26.31s, gc time=11.58s

Download loop_functional.mw

While alternative p1 is by far the most efficient of the three above, its functional technique is not always very convenient without some structural code changes. Sometimes it's convenient to perform a given operation in a loop (say, because the operation is in stages and a handy procedure isn't yet written to do each one individually). The alternative p2 generates the same result too, and uses the same kind of loop structure as p3, but avoids the higher space complexity and ensuing memory management time cost. And while p2 doesn't scale up as well as p1, but it does do much better than p3.

The main problem with p3 is not the loop per se; the problem is the repeated augmentation of lists (an immutable data structure).

So why do people so often code such tasks in the manner of p3? Perhaps it's because it's approach is simple to understand and remember. Loops are more straightforward to debug. And using a table introduces another flavor of data structure -- ie. more details to remember.

Do loops tend -- more "generally" than do functional equivalents -- to be used for code with an innappropriate computational complexity? Maybe.

But it's also possible that a reason for seeing more inefficient loop code is that loop code is more common than functional equivalents; I doubt anyone's studied the proportions, for Maple.

And it's possible to write suboptimal code with a functional programming approach. Unnecessary collectible garbage might get be produced by performing an unnecessary number of separate mappings, eg. with L indexable,
    f~( (L -~ 3.0)/~11.0 )/~ 5.0 + sin~( f~( (L -~ 3.0)/~11.0 )/~ 5.0 )
or what have you.

You could call collect on an expression containing placeholders for names nu[1],nu[2],u[1],u[2],u[3], and then subsitute for those placeholders.

collect_complete_ac.mw

Here is one way, using implicitplot since you had that.

(It might be possible to produce a nicer surface directly with plot3d, say, instead of generating a collection of polygons as implicitplot does.)

restart; with(plots)

Equations := [-.1272463007-.1364614350*y+.5478028265*y^2-.4626165419*x+0.7714146226e-1*y*x+.6671835197*x^2, 0.9582956998e-1-.5439311444*y+.5969331379*y^2+.2711291996*x-.1314652750*y*x+.4978275516*x^2, 0.4404070985e-1-.1903242613*y+.5210473801*y^2+.5305119366*x-0.9202813426e-1*y*x+.6327990414*x^2]

P := implicitplot(max(op(Equations)), x = -.3 .. 0, y = .1 .. .5, filledregions, coloring = [red, white], scaling = constrained, gridrefine = 3)

tP := subsindets(P, And(specfunc(POLYGONS), satisfies(proc (p) options operator, arrow; has(p, COLOUR(RGB, 1.00000000, 1.00000000, 1.00000000)) end proc)), proc () options operator, arrow; NULL end proc)

S := (plottools:-transform(proc (x, y) options operator, arrow; [x, y, sqrt(1-x^2-y^2)] end proc))(tP)

display(plottools:-sphere([0, 0, 0], 1, color = gray, transparency = .8, style = surface), S)

Download Projection_ac.mw

I'm supposing that you wanted the patch projected only onto the upper part of the sphere, where z>0. You could change that, to use -sqrt(...) instead. Or you could generate both. Eg, Projection_acc.mw

Following dharr's comment about the piecewise, a dsolve-numeric event could also be used.

min_problem_ac.mw

Alternate kinds of events are possible.

Yes, the terms are taken in the order in which they are currently stored.

restart;

m := [$1..3]:

P1 := add(m[k]*(R)^(k-1), k=1..3);

3*R^2+2*R+1

c := coeffs(P1, R, 't'): [c], [t];

[3, 2, 1], [R^2, R, 1]

PolynomialTools:-CoefficientList(P1, R);

[1, 2, 3]

sort(P1,order=plex(R),ascending);

1+2*R+3*R^2

c:= coeffs(P1, R, 't'): [c], [t];

[1, 2, 3], [1, R, R^2]

PolynomialTools:-CoefficientList(P1, R);

[1, 2, 3]

Download coeffs_ord.mw

Note that if the order of terms didn't matter then there'd be less point to the optional side-effect assignment to the 3rd argument 't'.

If you'd prefer you could use the CoefficientList command, for which the order is fixed and only the coefficients returned (because the order of the terms is implied). There is a cross-reference to that command from the Help page for coeffs.


ps. These aspects have not changed since Maple 2015.

Here is one way to handle your example,

S := "124e34e243e45e56e76f34e45e23ea12e98e34e43":

parse~(StringTools:-Split(S,cat(seq("A".."z"))));

     [124, 34, 243, 45, 56, 76, 34, 45, 23, 12, 98, 34, 43]

In Maple 2023.0 the edges themselves are represented as CURVES plotting substructures. That's different from, say Maple 2015.

That means that the edge lines will always be rendered on top of the arrow heads (which are POLYGONS substructures). You probably don't want to see such an effect; it's not pretty, if the colored arrow head appears below a differently colored edge line.

One possible approach is to split the edge lines at the arrow head, using some undefined value(s).

You could modify this to change all/several arrows at once.

restart;

with(GraphTheory):

G := Digraph({[1, 2], [2, 3], [3,4], [4,5], [5,1]}):

GP := DrawGraph(G, stylesheet=[vertexborder=false,vertexpadding=5,edgecolor = "black",vertexcolor="MistyRose",edgethickness=2],size=[250,250]);

changearrowhead:=proc(P,ind::posint:=1)
  local C,i,L,otherR,R,T,temp,this;
  R:=seq(`if`(op(i,P)::And(specfunc(POLYGONS),
                           satisfies(p->op([1,1,1],p)=3)),i,NULL),
         i=1..nops(P));
  this := R[ind];
  otherR := seq(`if`(op(i,P)::And(specfunc(CURVES)),i,NULL),
         i=1..nops(P));
  T:=op(plots:-display(op(this,P),overrideoption,_rest));
  L := op(1,T[1]);
  temp:=subsop(this=op(0,T[1])(op(T[1]),T[2..]),P);
  C := op([otherR[ind],1],temp);
  C := [C[1],
        [(L[1,1]+L[3,1])/2,(L[1,2]+L[3,2])/2],
        [L[2,1],undefined], [L[2,1],L[2,2]], C[2]];
  subsop([otherR[ind],1]=C,temp);
end proc:

new1:=changearrowhead(GP, 2, color=red, style=polygon):
new1;

new2:=changearrowhead(new1, 4, color=gold, style=polygonoutline);

 

Download changearrowhead0.mw

This whole approach depends on the fact that the order of the POLYGONS and CURVES substructures match. That might not be set in stone for the future...

I just wrote this off the cuff. It's not mint-clean (option names unprotected). I didn't test thoroughly.

You have fasteners as a list of Vectors.

You are trying to map some mapped operation (that itself maps across the Vector entries) across the list. That can be done using map or elementwise operations with a nested syntax (including in 2D Input mode).

Your examples could also be handled by targeted substitution (evalindets).

[Sorry, my worksheet fails to display inline here right now.]

Download elementwise_ac.mw

You could construct an interpolating function from the x-y-z data, which could compute a z-value for any x,y pair within range.

Then you can make any usual kind of plot, and add coloring, options, etc.

For example, using the very small collection of data originally provided, see below.

I forced 20 contour values, but you could just as easily specifiy the contour values in steps of 100 ( ie, seq(...,100) instead of seq(...,numelems=20) ).

restart;

data := [[177.80000,0.,967.3266667],[169.80000,0.,963.5900000],
         [100.00000,0.,188.8933333],[176.92000,17.703000,967.3266667],
         [174.27000,35.230000,967.3200000],[169.90000,52.407000,967.3566667],
         [163.84000,69.064000,967.3366667],[156.15000,85.034000,967.3100000],
         [146.91000,100.16000,967.3366667],[136.20000,114.29000,967.3666667]]:

F := Interpolation:-Interpolate(data[..,1..2],data[..,3]):

P2:=plots:-contourplot(F,min(data[..,1])..max(data[..,1]),min(data[..,2])..max(data[..,2]),
                       contours=[seq(min(data[..,3])..max(data[..,3])*(1-1e-9),numelems=20)],
                       thickness=2, colorscheme=["Blue","Red"]):

plots:-display(
  plottools:-transform((x,y)->[x,y,0])(P2),
  plots:-surfdata(Matrix(data),source=irregular,
                  style=point,shading=zhue,symbolsize=15,symbol=solidcircle)
);

P2;

 

Download interp_cont_data.mw

Using Maple 18.02, since that's the version in which your attachment was last saved.

restart

kernelopts(version)

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

A[m] := (x/a)^(i+1)*(1-x/a)^2;B[n] := (y/b)^(i+1)*(1-y/b)^2;w := c[i]*A[m]*B[n];

(x/a)^(i+1)*(1-x/a)^2

(y/b)^(i+1)*(1-y/b)^2

c[i]*(x/a)^(i+1)*(1-x/a)^2*(y/b)^(i+1)*(1-y/b)^2

TPE := `assuming`([(1/2)*(int(int(D__11*(diff(w, x, x))^2+2*D__12*(diff(w, x, x))*(diff(w, y, y))+4*D__66*(diff(w, x, y))^2+D__22*(diff(w, y, y))^2-2*q__0*w, x = 0 .. a), y = 0 .. b))], [i > 0]);

2*c[i]*(-512*a^4*b^4*i^8*q__0-6144*a^4*b^4*i^7*q__0-29184*a^4*b^4*i^6*q__0+36*D__11*b^4*i^8*c[i]+8*D__12*a^2*b^2*i^8*c[i]+36*D__22*a^4*i^8*c[i]+16*D__66*a^2*b^2*i^8*c[i]-69120*a^4*b^4*i^5*q__0+612*D__11*b^4*i^7*c[i]+168*D__12*a^2*b^2*i^7*c[i]+612*D__22*a^4*i^7*c[i]+336*D__66*a^2*b^2*i^7*c[i]-82368*a^4*b^4*i^4*q__0+4257*D__11*b^4*i^6*c[i]+1482*D__12*a^2*b^2*i^6*c[i]+4257*D__22*a^4*i^6*c[i]+2964*D__66*a^2*b^2*i^6*c[i]-38016*a^4*b^4*i^3*q__0+15570*D__11*b^4*i^5*c[i]+7068*D__12*a^2*b^2*i^5*c[i]+15570*D__22*a^4*i^5*c[i]+14136*D__66*a^2*b^2*i^5*c[i]+9824*a^4*b^4*i^2*q__0+31959*D__11*b^4*i^4*c[i]+19386*D__12*a^2*b^2*i^4*c[i]+31959*D__22*a^4*i^4*c[i]+38772*D__66*a^2*b^2*i^4*c[i]+13920*a^4*b^4*i*q__0+36198*D__11*b^4*i^3*c[i]+29352*D__12*a^2*b^2*i^3*c[i]+36198*D__22*a^4*i^3*c[i]+58704*D__66*a^2*b^2*i^3*c[i]+3150*a^4*b^4*q__0+20448*D__11*b^4*i^2*c[i]+19048*D__12*a^2*b^2*i^2*c[i]+20448*D__22*a^4*i^2*c[i]+38096*D__66*a^2*b^2*i^2*c[i]+4320*D__11*b^4*i*c[i]-3648*D__12*a^2*b^2*i*c[i]+4320*D__22*a^4*i*c[i]-7296*D__66*a^2*b^2*i*c[i]-8064*D__12*a^2*b^2*c[i]-16128*D__66*a^2*b^2*c[i])/(a^3*b^3*(256*i^14+7680*i^13+103936*i^12+837888*i^11+4472800*i^10+16609536*i^9+43796912*i^8+81956400*i^7+106195721*i^6+88876434*i^5+38200637*i^4-3705948*i^3-13260492*i^2-5974560*i-907200))

 

You could rearrange that result with various kinds of simplification. For example,

 

collect(numer(TPE), [a, b], factor)/factor(denom(TPE))

((-4*c[i]*q__0*(2*i+7)*(2*i-1)*(2*i+5)^2*(2*i+3)^2*(2*i+1)^2*b^4+18*c[i]^2*D__22*i*(2*i+5)*(2*i+1)*(i+3)*(i+2)*(i+1)*(i+4)^2)*a^4+4*c[i]^2*(2*i+7)*(2*i-1)*(i+4)^2*(i+3)^2*(i+2)^2*(D__12+2*D__66)*b^2*a^2+18*c[i]^2*D__11*i*(2*i+5)*(2*i+1)*(i+3)*(i+2)*(i+1)*(i+4)^2*b^4)/(a^3*b^3*(2*i+7)*(2*i-1)*(2*i+5)^2*(2*i+3)^2*(2*i+1)^2*(i+4)^2*(i+3)^2*(i+2)^2)

collect(TPE, [D__11, D__12, D__22, D__66], factor)

18*(i+1)*i*b*c[i]^2*D__11/((2*i+7)*(2*i+5)*(2*i+1)*(2*i-1)*(i+3)*(i+2)*(2*i+3)^2*a^3)+4*c[i]^2*D__12/(b*a*(2*i+5)^2*(2*i+3)^2*(2*i+1)^2)+18*(i+1)*i*a*c[i]^2*D__22/((2*i+7)*(2*i+5)*(2*i+1)*(2*i-1)*(i+3)*(i+2)*(2*i+3)^2*b^3)+8*c[i]^2*D__66/(b*a*(2*i+5)^2*(2*i+3)^2*(2*i+1)^2)-4*a*b*q__0*c[i]/((i+4)^2*(i+3)^2*(i+2)^2)

Download total_PE_ac.mw

You can insert a new execution group after the current line using either the keyboard shortcut Ctl j, or the main menubar item,
   Insert -> Execution Group -> After Cursor

The keyboard shortcut for inserting before the cursor is Ctl k.

The keyboard shortcut for splitting an Execution Group at the current cursor position is the F3 key.

You can see a listing of the shortcuts on MS-Windows by looking at the Help page for topic
   worksheet,reference,hotwin
Here's the link to that in the online Help (version Maple 2013, not your Maple 18, but these particular shortcuts are unchanged).

For "Mac" (OS X) the variants are shown on the Help page with topic,
   worksheet,reference,hotmac
For example, Cmd j and Cmd k

That can be attained directly by Matrix indexing, eg.

with(GraphTheory):

g:=Graph({{2,3},{1,2}}):

foo:=AdjacencyMatrix(g);

foo := Matrix(3, 3, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 0, (2, 2) = 0, (2, 3) = 1, (3, 3) = 0}, storage = triangular[upper], order = C_order, shape = [symmetric])

ind := [3,1,2];

[3, 1, 2]

foo[ind,ind];

Matrix([[0, 0, 1], [0, 0, 1], [1, 1, 0]])

Download matrix_indexing_ex.mw

If I understand the question correctly then here are two more ways, using reasonably terse syntax.

restart;

A := <<1, 5, 9, 13> | <2, 6, 10, 14> | <3, 7, 11, 15> | <4, 8, 12, 16>>;

Matrix(4, 4, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 3, (1, 4) = 4, (2, 1) = 5, (2, 2) = 6, (2, 3) = 7, (2, 4) = 8, (3, 1) = 9, (3, 2) = 10, (3, 3) = 11, (3, 4) = 12, (4, 1) = 13, (4, 2) = 14, (4, 3) = 15, (4, 4) = 16})

B := <17,18,19,20>;

Vector(4, {(1) = 17, (2) = 18, (3) = 19, (4) = 20})

`<|>`(B$4)/~A

Matrix(4, 4, {(1, 1) = 17, (1, 2) = 17/2, (1, 3) = 17/3, (1, 4) = 17/4, (2, 1) = 18/5, (2, 2) = 3, (2, 3) = 18/7, (2, 4) = 9/4, (3, 1) = 19/9, (3, 2) = 19/10, (3, 3) = 19/11, (3, 4) = 19/12, (4, 1) = 20/13, (4, 2) = 10/7, (4, 3) = 4/3, (4, 4) = 5/4})

`<|>`(seq(B/~A[..,i],i=1..4))

Matrix(4, 4, {(1, 1) = 17, (1, 2) = 17/2, (1, 3) = 17/3, (1, 4) = 17/4, (2, 1) = 18/5, (2, 2) = 3, (2, 3) = 18/7, (2, 4) = 9/4, (3, 1) = 19/9, (3, 2) = 19/10, (3, 3) = 19/11, (3, 4) = 19/12, (4, 1) = 20/13, (4, 2) = 10/7, (4, 3) = 4/3, (4, 4) = 5/4})

Download mvdivelem_ex.mw

Those don't use any functionality new to only recent Maple versions.

ps. If you haven't already assigned the number of columns of Matrix A (here, the value 4) to some name, then it can be obtained as op([1,2],A) .

First 19 20 21 22 23 24 25 Last Page 21 of 309