tomleslie

13876 Reputation

20 Badges

15 years, 173 days

MaplePrimes Activity


These are replies submitted by tomleslie

use command-line 'mint', rather than maplemint() from within a worksheet?

The attached shows the output of running maplemint() on the Shapes package, as well as on those procedures exported by this package

( I should state that there are a few "funnies" with this package - I think it is using some very *old* syntax, and is a bit careless with path names to include files.)

  restart;
  currentdir("C:/Program Files/Maple 2021/samples/ProgrammingGuide/shapes"):
  read "shapes.mpl";
  with(Shapes);

Warning, (in Shapes:-Shapes:-triangle:-circumference) `i` is implicitly declared local |triangle.mm:78|

 

[area, circumference, make]

(1)

  maplemint(Shapes);

Nested Procedure len( seg ) on lines 21 to 22
  These names were used as global names but were not declared:  END, START
Nested Procedure start_point( seg ) on lines 27 to 28
  These names were used as global names but were not declared:  START
Nested Procedure end_point( seg ) on lines 29 to 30
  These names were used as global names but were not declared:  END
Nested Procedure circumference( tri ) on lines 64 to 65
  These local variables were used but never assigned a value:  i
Nested Procedure make( what ) on lines 66 to 67
  These local variables were used but never assigned a value:  ctor, theShape
Nested Procedure circumference( shape ) on lines 74 to 75
  These names were used as global names but were not declared:  tag

 

  maplemint(area);

  maplemint(circumference);

Procedure circumference( shape )
  These names were used as global names but were not declared:  tag

 

  maplemint(make);

Procedure make( what )
  These local variables were used but never assigned a value:  ctor, theShape

 

 

Download mapMint.mw

@Carl Love 

when I run Preben's worksheet and select one of the animations, not plot/animation toolbar appears. So the only way to run the animation is from the context menu.

I've been getting this problem of occasional "non-appearance" of the plot/animation toolbar since installing Maple 2021. Unfortunately I can't make it happen reproducibly :-(

@666 jvbasha 

My original worksheet was developed in Maple 2021. Somoetime between Maple 2018 and 2019, the functionality of the D() operator changed a little. You are using Maple 18, which (if memory serves) was released somewhere around 2014.

The attached "runs" in Maple 18. It is pretty much the saem as my original worksheet except for a few additional evalf() commands.

The same warnings about numerical "stability" obviously apply

  restart:
  interface(version);

`Standard Worksheet Interface, Maple 18.02, Windows 7, October 20 2014 Build ID 991181`

(1)

  ra:=2: b1:=1.41: na:=0.7: we:=0.5: eta[1]:=4*0.1: d:=0.5/1:
  xi:=0.1: m:=na: ea:=0.5: pr:=21: gr:=0.1: R:=0.9323556933:

  PDE1:=ra*(diff(f(x,t),t))=+b1*(1+ea*cos(t))+(1/(R^2))*((diff(f(x,t),x,x))+(1/x)*diff(f(x,t),x));
  IBC:= {D[1](f)(0,t)=0,f(1,t)=0,f(x,0)=0};

2*(diff(f(x, t), t)) = 1.41+.705*cos(t)+1.150367877*(diff(diff(f(x, t), x), x))+1.150367877*(diff(f(x, t), x))/x

 

{f(1, t) = 0, f(x, 0) = 0, (D[1](f))(0, t) = 0}

(2)

#
# Solve the PDE then use the returned methods 'plot', 'plot3d',
# and 'animate' to produce various plots
#
  sol :=  pdsolve({PDE1}, IBC, numeric) :
  sol:-plot(f(x, t), t = 1.2, linestyle = "solid", title = "Velocity Profile", labels = ["r", "f"]);
  sol:-plot3d(f(x, t), x=0..1, t=0..2, style=surface, color=cyan );
  sol:-animate( f(x,t), x=0..1, t=0..2);

 

 

 

#
# Use the 'value' method to facilitate computation of
# assorted numerical values
#
# Check which quantities are "immediately available"
#
  sol:-value(f(x,t), output=listprocedure);
#
# Aow get some numerical values from this basic method
#
  sol:-value(f(x,t))(0.5,0.5);
#
# For ease of use, one can assign the 'f(x,t)' procedure to,
# the name 'fN' and then compute the values, as in
#
  fN:=eval( f(x,t), sol:-value(f(x,t), output=listprocedure)):
  fN(0.5,0.5);

[x = proc () option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; evalf(args[1]) end proc, t = proc () option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; evalf(args[2]) end proc, f(x, t) = 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 ) = (18446744074337899374)  ] ) ] ) INFO := table( [( "timeidx" ) = 2, ( "bandwidth" ) = [1, 3], ( "leftwidth" ) = 1, ( "indepvars" ) = [x, t], ( "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]), ( "stages" ) = 1, ( "theta" ) = 1/2, ( "t0" ) = 0, ( "solmat_v" ) = Vector(147, {(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}, datatype = float[8], order = C_order, attributes = [source_rtable = (Matrix(21, 7, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (4, 7) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (7, 7) = .0, (8, 1) = .0, (8, 2) = .0, (8, 3) = .0, (8, 4) = .0, (8, 5) = .0, (8, 6) = .0, (8, 7) = .0, (9, 1) = .0, (9, 2) = .0, (9, 3) = .0, (9, 4) = .0, (9, 5) = .0, (9, 6) = .0, (9, 7) = .0, (10, 1) = .0, (10, 2) = .0, (10, 3) = .0, (10, 4) = .0, (10, 5) = .0, (10, 6) = .0, (10, 7) = .0, (11, 1) = .0, (11, 2) = .0, (11, 3) = .0, (11, 4) = .0, (11, 5) = .0, (11, 6) = .0, (11, 7) = .0, (12, 1) = .0, (12, 2) = .0, (12, 3) = .0, (12, 4) = .0, (12, 5) = .0, (12, 6) = .0, (12, 7) = .0, (13, 1) = .0, (13, 2) = .0, (13, 3) = .0, (13, 4) = .0, (13, 5) = .0, (13, 6) = .0, (13, 7) = .0, (14, 1) = .0, (14, 2) = .0, (14, 3) = .0, (14, 4) = .0, (14, 5) = .0, (14, 6) = .0, (14, 7) = .0, (15, 1) = .0, (15, 2) = .0, (15, 3) = .0, (15, 4) = .0, (15, 5) = .0, (15, 6) = .0, (15, 7) = .0, (16, 1) = .0, (16, 2) = .0, (16, 3) = .0, (16, 4) = .0, (16, 5) = .0, (16, 6) = .0, (16, 7) = .0, (17, 1) = .0, (17, 2) = .0, (17, 3) = .0, (17, 4) = .0, (17, 5) = .0, (17, 6) = .0, (17, 7) = .0, (18, 1) = .0, (18, 2) = .0, (18, 3) = .0, (18, 4) = .0, (18, 5) = .0, (18, 6) = .0, (18, 7) = .0, (19, 1) = .0, (19, 2) = .0, (19, 3) = .0, (19, 4) = .0, (19, 5) = .0, (19, 6) = .0, (19, 7) = .0, (20, 1) = .0, (20, 2) = .0, (20, 3) = .0, (20, 4) = .0, (20, 5) = .0, (20, 6) = .0, (20, 7) = .0, (21, 1) = .0, (21, 2) = .0, (21, 3) = .0, (21, 4) = .0, (21, 5) = .0, (21, 6) = .0, (21, 7) = .0}, datatype = float[8], order = C_order))]), ( "ICS" ) = [0], ( "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]), ( "norigdepvars" ) = 1, ( "dependson" ) = [{1}], ( "autonomous" ) = true, ( "soltimes" ) = Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]), ( "depvars" ) = [f], ( "banded" ) = true, ( "allocspace" ) = 21, ( "spacestep" ) = 0.500000000000000e-1, ( "explicit" ) = false, ( "solvec5" ) = 0, ( "spacevar" ) = x, ( "totalwidth" ) = 7, ( "depeqn" ) = [1], ( "pts", x ) = [0, 1], ( "mixed" ) = false, ( "rightwidth" ) = 0, ( "erroraccum" ) = true, ( "linear" ) = true, ( "method" ) = theta, ( "timevar" ) = t, ( "spaceidx" ) = 1, ( "eqndep" ) = [1], ( "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]), ( "solmat_ne" ) = 0, ( "multidep" ) = [false, false], ( "initialized" ) = false, ( "errorest" ) = false, ( "eqnords" ) = [[2, 1]], ( "periodic" ) = false, ( "BCS", 1 ) = {[[1, 0, 1], b[1, 0, 1]], [[1, 1, 0], b[1, 1, 0]]}, ( "spacepts" ) = 21, ( "startup_only" ) = false, ( "solmat_i1" ) = 0, ( "spaceadaptive" ) = false, ( "solvec4" ) = 0, ( "depords" ) = [[2, 1]], ( "vectorhf" ) = true, ( "IBC" ) = b, ( "PDEs" ) = [2*(diff(f(x, t), t))-141/100-(141/200)*cos(t)-(1150367877/1000000000)*(diff(diff(f(x, t), x), x))-(1150367877/1000000000)*(diff(f(x, t), x))/x], ( "inputargs" ) = [{2*(diff(f(x, t), t)) = 1.41+.705*cos(t)+1.150367877*(diff(diff(f(x, t), x), x))+1.150367877*(diff(f(x, t), x))/x}, {f(1, t) = 0, f(x, 0) = 0, (D[1](f))(0, t) = 0}], ( "matrixhf" ) = true, ( "timeadaptive" ) = false, ( "solmatrix" ) = Matrix(21, 7, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (4, 7) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (7, 7) = .0, (8, 1) = .0, (8, 2) = .0, (8, 3) = .0, (8, 4) = .0, (8, 5) = .0, (8, 6) = .0, (8, 7) = .0, (9, 1) = .0, (9, 2) = .0, (9, 3) = .0, (9, 4) = .0, (9, 5) = .0, (9, 6) = .0, (9, 7) = .0, (10, 1) = .0, (10, 2) = .0, (10, 3) = .0, (10, 4) = .0, (10, 5) = .0, (10, 6) = .0, (10, 7) = .0, (11, 1) = .0, (11, 2) = .0, (11, 3) = .0, (11, 4) = .0, (11, 5) = .0, (11, 6) = .0, (11, 7) = .0, (12, 1) = .0, (12, 2) = .0, (12, 3) = .0, (12, 4) = .0, (12, 5) = .0, (12, 6) = .0, (12, 7) = .0, (13, 1) = .0, (13, 2) = .0, (13, 3) = .0, (13, 4) = .0, (13, 5) = .0, (13, 6) = .0, (13, 7) = .0, (14, 1) = .0, (14, 2) = .0, (14, 3) = .0, (14, 4) = .0, (14, 5) = .0, (14, 6) = .0, (14, 7) = .0, (15, 1) = .0, (15, 2) = .0, (15, 3) = .0, (15, 4) = .0, (15, 5) = .0, (15, 6) = .0, (15, 7) = .0, (16, 1) = .0, (16, 2) = .0, (16, 3) = .0, (16, 4) = .0, (16, 5) = .0, (16, 6) = .0, (16, 7) = .0, (17, 1) = .0, (17, 2) = .0, (17, 3) = .0, (17, 4) = .0, (17, 5) = .0, (17, 6) = .0, (17, 7) = .0, (18, 1) = .0, (18, 2) = .0, (18, 3) = .0, (18, 4) = .0, (18, 5) = .0, (18, 6) = .0, (18, 7) = .0, (19, 1) = .0, (19, 2) = .0, (19, 3) = .0, (19, 4) = .0, (19, 5) = .0, (19, 6) = .0, (19, 7) = .0, (20, 1) = .0, (20, 2) = .0, (20, 3) = .0, (20, 4) = .0, (20, 5) = .0, (20, 6) = .0, (20, 7) = .0, (21, 1) = .0, (21, 2) = .0, (21, 3) = .0, (21, 4) = .0, (21, 5) = .0, (21, 6) = .0, (21, 7) = .0}, datatype = float[8], order = C_order), ( "extrabcs" ) = [0], ( "timei" ) = 3, ( "depdords" ) = [[[2, 1]]], ( "minspcpoints" ) = 4, ( "solmat_is" ) = 0, ( "fdepvars" ) = [f(x, t)], ( "vectorproc" ) = proc (v, vp, vpp, t, x, k, h, n, vec) local _s1, _s2, _s3, _s4, _s5, _s6, _s7, _s8, xi; _s1 := cos(t+(1/2)*k); _s4 := 2300735754*k; _s5 := 8000000000*h^2; _s6 := 1150367877*h*k; _s7 := 4000000000*k*h^2; _s8 := 2820000000*k*h^2*(_s1+2); vec[1] := 0; vec[n] := 0; for xi from 2 to n-1 do _s2 := -vp[xi-1]+vp[xi+1]; _s3 := vp[xi-1]-2*vp[xi]+vp[xi+1]; vec[xi] := (_s3*_s4*x[xi]+_s5*vp[xi]*x[xi]+_s2*_s6+_s8*x[xi])/(_s7*x[xi]) end do end proc, ( "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), ( "adjusted" ) = false, ( "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), ( "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) = 1.0}, datatype = float[8]), ( "depshift" ) = [1], ( "timestep" ) = 0.500000000000000e-1, ( "maxords" ) = [2, 1], ( "solmat_i2" ) = 0, ( "matrixproc" ) = proc (v, vp, vpp, t, x, k, h, n, mat) local _s1, _s2, _s3, xi; _s1 := -1150367877*h; _s2 := 4000000000*h^2; _s3 := (1/1000000000)*(2000000000*h^2+1150367877*k)/(k*h^2); mat[3] := -(3/2)/h; mat[4] := 2/h; mat[5] := -(1/2)/h; mat[7*n-4] := 1; for xi from 2 to n-1 do mat[7*xi-4] := _s3; mat[7*xi-5] := -(_s1+2300735754*x[xi])/(_s2*x[xi]); mat[7*xi-3] := (_s1-2300735754*x[xi])/(_s2*x[xi]) end do end proc ] ); 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 := [proc (t, x, u) u[1] end proc]; 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 := "2nd"; 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]

 

[x = .5, t = .5, f(x, t) = .274730832428660143]

 

.274730832428660143

(3)

#
# The solution module returned by pdsolve() does not
# contain any derivatives, so these have to be computed
# explicitly. The simplest method is to use the 'D'
# operator.
#
# Differentiation wrt 'x' evaluated at x=0.2, t=1.2
#
  evalf(D[1](fN)(0.2, 1.2));
#
# Differentiation twice wrt 'x' and evaluate at x=0.2,
# t=1.2
#
  evalf(D[1,1](fN)(0.2, 1.2));
#
# Differentiation wrt 't' evaluated at x=0.2, t=1.2
#
  evalf(D[2](fN)(0.2, 1.2));
#
# Plot the first and second derivatives of f(x,t) wrt 'x' for t=1.2
# Note the "glitch" in the second derivative
#
  plot( [ D[1](fN)(x, 1.2),
          D[1, 1](fN)(x, 1.2)
        ],
        x=0..1,
        color=[red, blue]
      );
#
# Plot the first and second derivatives of f(x,t) wrt 't' for x=0.5
#
  plot( [ D[2](fN)(0.5, t),
          D[2, 2](fN)(0.5, t)
        ],
        t=0..2,
        color=[red, blue],
        axes=boxed
      );
  

-.1590019759

 

-1.149981230

 

-0.8026099339e-1

 

 

 

  M:= Matrix([ [ "x", "f(x,t)", "diff(f(x,t),x)", "diff(f(x,t),x,x)"],
                  seq( [j, fN(j, 1.2), evalf(D[1](fN)(j,1.2)), evalf(D[1,1](fN)(j,1.2))], j=0.1..0.9, 0.1)
               ]
            );
  ExcelTools:-Export( M, "C:/Users/TomLeslie/Desktop/pdeDat.xlsx");

M := Matrix(10, 4, {(1, 1) = "x", (1, 2) = "f(x,t)", (1, 3) = "diff(f(x,t),x)", (1, 4) = "diff(f(x,t),x,x)", (2, 1) = .1, (2, 2) = .386450395099301292, (2, 3) = -0.7957793238e-1, (2, 4) = -1.096653890, (3, 1) = .2, (3, 2) = .374519447545877127, (3, 3) = -.1590019759, (3, 4) = -1.149981230, (4, 1) = .3, (4, 2) = .354660645957600662, (4, 3) = -.2381063559, (4, 4) = -1.188912300, (5, 1) = .4, (5, 2) = .326914868358544664, (5, 3) = -.3167095051, (5, 4) = -1.254515940, (6, 1) = .5, (6, 2) = .291342358954074454, (6, 3) = -.3946031424, (6, 4) = -1.361681320, (7, 1) = .6, (7, 2) = .248026334799754833, (7, 3) = -.4715328601, (7, 4) = -1.217418660, (8, 1) = .7, (8, 2) = .197076684864131463, (8, 3) = -.5472420907, (8, 4) = -1.897191300, (9, 1) = .8, (9, 2) = .138628396303586865, (9, 3) = -.6213846287, (9, 4) = -1.192826120, (10, 1) = .9, (10, 2) = 0.728807948292487240e-1, (10, 3) = -.6937862569, (10, 4) = -50.76329468})

(4)

 


 

Download pdeTut18.mw

@pauldaas 

I don't see much point in using the embedded for loop. The following will do exactly the same thing

f:=unapply(piecewise( seq( [x<=a[i], y[i](x)][], i=1..10)),x);

 

@Bendesarts 

You can only use maplemint on a procedure.

However when I'm using an external editor, this usually means that I'm working on a reasonably-sized problem, so "good programming practice" would mean that I'm splitting it into procedures (and maybe a module or two) anyway.

In any case, you don't have to use maplemint(). The read statement will read/check your code as if it were typed directly into a Maple worksheet - so any syntax errors you have madewill be reported in the usual way. Using maplemint() just adds an "extra" level of checking which I (sometimes) find useful

@acer 

and its not an "aggressive statement of disbelief", just plain, ordinary disbelief.

I'm running on 64-bit Win 7.

The code

 restart;
  interface(version);
  t1:=time[real]():
  with(plots):
  nFrames:=200:
  gr:=[91, 91]:
  CodeTools:-Usage
  ( animate
    ( densityplot,
      [ arctan
        ( x*(a*x^2 + a*y^2 - a - 200*y - 100),
          a*y^3 + (a - 100)*y^2 + (a*x^2 + a - 100)*y - 100 + (a + 100)*x^2
        ),
        x=-4 .. 4,
        y=-4 .. 4,
        axes = boxed,
        view = [-2 .. 2, -2 .. 2],
        restricttoranges,
        colorstyle = HUE,
        style = surface,
        grid = gr
      ],
      a = 1 .. 200,
      frames=nFrames
    )
  );

  t2:=time[real]()-t1;

Runniing the above code in Maple 2020 the output is

Standard Worksheet Interface, Maple 2020.2, Windows 7, November 11 2020 Build ID 1502365
memory used=171.22MiB, alloc change=124.70MiB, cpu time=5.55s, real time=5.50s, gc time=218.40ms
t2 := 9.415

Runniing the above code in Maple 2021, the output is

Standard Worksheet Interface, Maple 2021.0, Windows 7, March 5 2021 Build ID 1523359
memory used=177.30MiB, alloc change=56.70MiB, cpu time=5.54s, real time=5.49s, gc time=140.40ms
t2 := 10.356

Running the code multiple times in each version, doen't *seem* to make much difference.

With multiple runs the 't2' value on Maple 2020 is anywhere between 9.0 an 10.5secs.

With multiple runs the 't2' value on Maple 2021 is anywhere between 9.5 and 11secs

 

@acer 

If I adjust my original gode to allow for a 91 x 91 grid and 200 frames, then CodelTools:-Usage tells me that the plots are generated in about 5.5secs, ie executing the following

  restart;
  with(plots):
  nFrames:=200:
  gr:=[91, 91]:
  CodeTools:-Usage
  ( animate
    ( densityplot,
      [ arctan
        ( x*(a*x^2 + a*y^2 - a - 200*y - 100),
          a*y^3 + (a - 100)*y^2 + (a*x^2 + a - 100)*y - 100 + (a + 100)*x^2
        ),
        x=-4 .. 4,
        y=-4 .. 4,
        axes = boxed,
        view = [-2 .. 2, -2 .. 2],
        restricttoranges,
        colorstyle = HUE,
        style = surface,
        grid = gr
      ],
      a = 1 .. 200,
      frames=nFrames
    )
  );

produces the output

memory used=172.49MiB, alloc change=89.31MiB, cpu time=5.44s, real time=5.44s, gc time=124.80ms

Now obviopusly the above does not include the "render" time so I have to do this the old-fashioned way using stopwatch function on the Breitling chronometer starpped to my left wrist. Measured this way the time between the above output from CodeTools:-Usage() appearing and the plot appearing on screen is ~4 secs. If I use the same antiquated approach to time the "whole" calculation from the "restart" to the first frame of the animation appearing, I get 9secs, whihc would seem to be consistent.

I have no idea wherre your 100secs render time comes from!!

I can't upload the animation here, even as a GIF - this site just barfs

I can't even upload the worksheet (with the embedded graphic) as a link - because again this site just barfs

phplt4.mw

I meaant to put this response unde the OP's previous question - I was trying to replicate his reported core dump

@mapleatha 

  1. Animations will not "animate" automatically
  2. The animate() command will just produce a "static" figure
  3. Click on the figure. An animation toolbar should appear at the top of the worksheet, with a fairly obvious "play" icon
  4. There have been reports that for some people the animation toolbar does not appear; if this happens for your, click on the "static" plot, then right-click to bring up a context menu, one of whose entries should be "Animation" - just follow it an dplay

Windows7+Google Chrome

restart:

S:= x-> piecewise(
     x <= -2, 0,
     x <= -1, (2+x)^3/4,
     x <= 0,  (2+x)^3/4 - (1+x)^3,
     x <= 1,  (2-x)^3/4 - (1-x)^3,
     x <= 2,  (2-x)^3/4,
     0
):

n:= 9:

phi:= proc(x::name)
local
    i, xi, h, R,
    T:= table([
        0=    S(xi) - 4*S(xi+1),
        1=    S(xi-1) - S(xi+1),
        _n=   S(xi-_n) - S(xi-(_n+2)),
        _n+1= S(xi-(_n+1)) - 4*S(xi-(_n+2))
    ])
;
    if not procname::indexed or nops(procname) <> 1 then
        error "phi must be called with a single index"
    fi;
    i:= op(procname);
    if not i::integer[0.._n+1] then
        error
            "phi's index must be an integer from 0 to %1 but"
            " received %2", _n+1, i
    fi;
    R:= `if`(assigned(T[i]), T[i], S(xi-i));    
    unapply(subs(xi= x/h, convert(R, piecewise, xi)), [x,h])
end proc
:

phi:= subs(_n= n, eval(phi)):

#Examples:
for k in [0,1,iquo(n,2),n,n+1] do print(i=k, phi[k](x)(x,h)) od:

i = 0, piecewise(x/h <= -3, 0, x/h <= -2, -(3+x/h)^3, x/h <= -1, 17*(x/h+2)^3*(1/4)-(3+x/h)^3, x/h <= 0, (1/4)*(x/h+2)^3-(x/h+1)^3-(1-x/h)^3-4*x^3/h^3, x/h <= 1, (1/4)*(2-x/h)^3-2*(1-x/h)^3, x/h <= 2, (1/4)*(2-x/h)^3, 2 < x/h, 0)

 

i = 1, piecewise(x/h <= -3, 0, x/h <= -2, -(1/4)*(3+x/h)^3, x/h <= -1, -(1/4)*(3+x/h)^3+(x/h+2)^3, x/h <= 1, (1/4)*(x/h+1)^3-(1/4)*(1-x/h)^3-x^3/h^3, x/h <= 2, (1/4)*(3-x/h)^3-(2-x/h)^3, x/h <= 3, (1/4)*(3-x/h)^3, 3 < x/h, 0)

 

i = 4, piecewise(x/h <= 2, 0, x/h <= 3, (1/4)*(x/h-2)^3, x/h <= 4, (1/4)*(x/h-2)^3-(x/h-3)^3, x/h <= 5, (1/4)*(6-x/h)^3-(5-x/h)^3, x/h <= 6, (1/4)*(6-x/h)^3, 6 < x/h, 0)

 

i = 9, piecewise(x/h <= 7, 0, x/h <= 8, (1/4)*(x/h-7)^3, x/h <= 9, (1/4)*(x/h-7)^3-(x/h-8)^3, x/h <= 10, (1/4)*(11-x/h)^3-(10-x/h)^3-(1/4)*(x/h-9)^3, x/h <= 11, (1/4)*(11-x/h)^3-(1/4)*(x/h-9)^3+(x/h-10)^3, x/h <= 12, -(1/4)*(13-x/h)^3+(12-x/h)^3, x/h <= 13, -(1/4)*(13-x/h)^3, 13 < x/h, 0)

 

i = 10, piecewise(x/h <= 8, 0, x/h <= 9, (1/4)*(x/h-8)^3, x/h <= 10, (1/4)*(x/h-8)^3-2*(x/h-9)^3, x/h <= 11, (1/4)*(12-x/h)^3-(11-x/h)^3-(x/h-9)^3+4*(x/h-10)^3, x/h <= 12, (17/4)*(12-x/h)^3-(13-x/h)^3, x/h <= 13, -(13-x/h)^3, 13 < x/h, 0)

(1)

 


 

Download PWM.mw

@Carl Love 

Your worksheet PiecewiseMerge.mw, uploaded from Windows7+Firefox

restart:

S:= x-> piecewise(
     x <= -2, 0,
     x <= -1, (2+x)^3/4,
     x <= 0,  (2+x)^3/4 - (1+x)^3,
     x <= 1,  (2-x)^3/4 - (1-x)^3,
     x <= 2,  (2-x)^3/4,
     0
):

n:= 9:

phi:= proc(x::name)
local
    i, xi, h, R,
    T:= table([
        0=    S(xi) - 4*S(xi+1),
        1=    S(xi-1) - S(xi+1),
        _n=   S(xi-_n) - S(xi-(_n+2)),
        _n+1= S(xi-(_n+1)) - 4*S(xi-(_n+2))
    ])
;
    if not procname::indexed or nops(procname) <> 1 then
        error "phi must be called with a single index"
    fi;
    i:= op(procname);
    if not i::integer[0.._n+1] then
        error
            "phi's index must be an integer from 0 to %1 but"
            " received %2", _n+1, i
    fi;
    R:= `if`(assigned(T[i]), T[i], S(xi-i));    
    unapply(subs(xi= x/h, convert(R, piecewise, xi)), [x,h])
end proc
:

phi:= subs(_n= n, eval(phi)):

#Examples:
for k in [0,1,iquo(n,2),n,n+1] do print(i=k, phi[k](x)(x,h)) od:

i = 0, piecewise(x/h <= -3, 0, x/h <= -2, -(3+x/h)^3, x/h <= -1, 17*(x/h+2)^3*(1/4)-(3+x/h)^3, x/h <= 0, (1/4)*(x/h+2)^3-(x/h+1)^3-(1-x/h)^3-4*x^3/h^3, x/h <= 1, (1/4)*(2-x/h)^3-2*(1-x/h)^3, x/h <= 2, (1/4)*(2-x/h)^3, 2 < x/h, 0)

 

i = 1, piecewise(x/h <= -3, 0, x/h <= -2, -(1/4)*(3+x/h)^3, x/h <= -1, -(1/4)*(3+x/h)^3+(x/h+2)^3, x/h <= 1, (1/4)*(x/h+1)^3-(1/4)*(1-x/h)^3-x^3/h^3, x/h <= 2, (1/4)*(3-x/h)^3-(2-x/h)^3, x/h <= 3, (1/4)*(3-x/h)^3, 3 < x/h, 0)

 

i = 4, piecewise(x/h <= 2, 0, x/h <= 3, (1/4)*(x/h-2)^3, x/h <= 4, (1/4)*(x/h-2)^3-(x/h-3)^3, x/h <= 5, (1/4)*(6-x/h)^3-(5-x/h)^3, x/h <= 6, (1/4)*(6-x/h)^3, 6 < x/h, 0)

 

i = 9, piecewise(x/h <= 7, 0, x/h <= 8, (1/4)*(x/h-7)^3, x/h <= 9, (1/4)*(x/h-7)^3-(x/h-8)^3, x/h <= 10, (1/4)*(11-x/h)^3-(10-x/h)^3-(1/4)*(x/h-9)^3, x/h <= 11, (1/4)*(11-x/h)^3-(1/4)*(x/h-9)^3+(x/h-10)^3, x/h <= 12, -(1/4)*(13-x/h)^3+(12-x/h)^3, x/h <= 13, -(1/4)*(13-x/h)^3, 13 < x/h, 0)

 

i = 10, piecewise(x/h <= 8, 0, x/h <= 9, (1/4)*(x/h-8)^3, x/h <= 10, (1/4)*(x/h-8)^3-2*(x/h-9)^3, x/h <= 11, (1/4)*(12-x/h)^3-(11-x/h)^3-(x/h-9)^3+4*(x/h-10)^3, x/h <= 12, (17/4)*(12-x/h)^3-(13-x/h)^3, x/h <= 13, -(13-x/h)^3, 13 < x/h, 0)

(1)

 

Download PWM.mw

 

@Ronan 

The question

 I seperated out the code onto different lines to help me understand what is happening. The Iterator:-Cartesian product then gave an error. So I had to change $=0..4 to $ 0..4  Why?

Well the only response I am prepared ot give to this is an excerpt from the help page for the '$' expression sequence operator, which helpfully(?) states

Note:  Some of these calling sequences are not currently supported in 2-D input in the Standard interface.  However, equivalent forms work.  You can always use the forms expr $ i = m .. n, expr $ n, and $ m .. n.

Rather annoyingly, the help page does not specify which calling sequences don't work with 2D-input. I assume that when you converted my original (functional) code to 2D input, you managed to produce a non-functional calling sequence :-(

The question

As A an B use the arrow operator, why add(A~...   instead of  add(A(m)~......  which actually gives incorrect output.

doesn't make much sense to me. Maybe if you consider the relevant code on a step-by-step basis (illustrated in the attached) the calculation will become clearer

 restart;

 A:= m-> (2*m[1] + 3*m[2])!*c0^(1 + m[1] + 2*m[2])*c2^m[1]*c3^m[2]
          /
          ((1 + m[1] + 2*m[2])!*m[1]!*m[2]!*c1^(2*m[1] + 3*m[2] + 1));

proc (m) options operator, arrow; factorial(2*m[1]+3*m[2])*c0^(1+m[1]+2*m[2])*c2^m[1]*c3^m[2]/(factorial(1+m[1]+2*m[2])*factorial(m[1])*factorial(m[2])*c1^(2*m[1]+3*m[2]+1)) end proc

(1)

#
# Doing things "step-by-step"
#
# Step 1:  Set up the iterator
#
  Step1 := Iterator:-CartesianProduct([$ (0 .. 4)] $ 2);
#
# Step 2: Produce a list of all possible combinations
#         provided by the iterator. Output is a list of
#         the 1D arrays produced by the iterator
#
  Step2:=[seq(x[], x=Step1)];
#
# Step 3: Apply the function A() to each entry of the
#         above, by using the elementwise ('~') operator.
#         Output is a list of the terms produced by
#         applying the function A() to each entry in the
#         list produced at Step2
#
  Step3:=A~(Step2);
#
# Step 4: Add all the elements generated by the above
#         command. Output is the sum of all terms
#
  add(Step3);

CartesianProduct([0, 1, 2, 3, 4], [0, 1, 2, 3, 4])

 

[Array(%id = 36893488148212451316), Array(%id = 36893488148212451436), Array(%id = 36893488148212451556), Array(%id = 36893488148212451676), Array(%id = 36893488148212451796), Array(%id = 36893488148212451916), Array(%id = 36893488148212452036), Array(%id = 36893488148212452156), Array(%id = 36893488148212452276), Array(%id = 36893488148212452396), Array(%id = 36893488148212452516), Array(%id = 36893488148212452636), Array(%id = 36893488148212452756), Array(%id = 36893488148212452876), Array(%id = 36893488148212452996), Array(%id = 36893488148212453116), Array(%id = 36893488148212453236), Array(%id = 36893488148212445180), Array(%id = 36893488148212445300), Array(%id = 36893488148212445420), Array(%id = 36893488148212445540), Array(%id = 36893488148212445660), Array(%id = 36893488148212445780), Array(%id = 36893488148212445900), Array(%id = 36893488148212446020)]

 

[c0/c1, c0^2*c2/c1^3, 2*c0^3*c2^2/c1^5, 5*c0^4*c2^3/c1^7, 14*c0^5*c2^4/c1^9, 330*c0^7*c2^4*c3/c1^12, 84*c0^6*c2^3*c3/c1^10, 21*c0^5*c2^2*c3/c1^8, 5*c0^4*c2*c3/c1^6, c0^3*c3/c1^4, 3*c0^5*c3^2/c1^7, 28*c0^6*c2*c3^2/c1^9, 180*c0^7*c2^2*c3^2/c1^11, 990*c0^8*c2^3*c3^2/c1^13, 5005*c0^9*c2^4*c3^2/c1^15, 61880*c0^11*c2^4*c3^3/c1^18, 10010*c0^10*c2^3*c3^3/c1^16, 1430*c0^9*c2^2*c3^3/c1^14, 165*c0^8*c2*c3^3/c1^12, 12*c0^7*c3^3/c1^10, 55*c0^9*c3^4/c1^13, 1001*c0^10*c2*c3^4/c1^15, 10920*c0^11*c2^2*c3^4/c1^17, 92820*c0^12*c2^3*c3^4/c1^19, 678300*c0^13*c2^4*c3^4/c1^21]

 

330*c0^7*c2^4*c3/c1^12+84*c0^6*c2^3*c3/c1^10+21*c0^5*c2^2*c3/c1^8+5*c0^4*c2*c3/c1^6+28*c0^6*c2*c3^2/c1^9+180*c0^7*c2^2*c3^2/c1^11+990*c0^8*c2^3*c3^2/c1^13+5005*c0^9*c2^4*c3^2/c1^15+61880*c0^11*c2^4*c3^3/c1^18+10010*c0^10*c2^3*c3^3/c1^16+1430*c0^9*c2^2*c3^3/c1^14+165*c0^8*c2*c3^3/c1^12+1001*c0^10*c2*c3^4/c1^15+10920*c0^11*c2^2*c3^4/c1^17+92820*c0^12*c2^3*c3^4/c1^19+678300*c0^13*c2^4*c3^4/c1^21+12*c0^7*c3^3/c1^10+5*c0^4*c2^3/c1^7+2*c0^3*c2^2/c1^5+3*c0^5*c3^2/c1^7+14*c0^5*c2^4/c1^9+55*c0^9*c3^4/c1^13+c0^3*c3/c1^4+c0^2*c2/c1^3+c0/c1

(2)

#
# All of the above steps can be combined to a single
# which is what I did in my original code line
#
  add(A~([seq(v[], v = Iterator:-CartesianProduct([$ (0 .. 4)] $ 2))]));

330*c0^7*c2^4*c3/c1^12+84*c0^6*c2^3*c3/c1^10+21*c0^5*c2^2*c3/c1^8+5*c0^4*c2*c3/c1^6+28*c0^6*c2*c3^2/c1^9+180*c0^7*c2^2*c3^2/c1^11+990*c0^8*c2^3*c3^2/c1^13+5005*c0^9*c2^4*c3^2/c1^15+61880*c0^11*c2^4*c3^3/c1^18+10010*c0^10*c2^3*c3^3/c1^16+1430*c0^9*c2^2*c3^3/c1^14+165*c0^8*c2*c3^3/c1^12+1001*c0^10*c2*c3^4/c1^15+10920*c0^11*c2^2*c3^4/c1^17+92820*c0^12*c2^3*c3^4/c1^19+678300*c0^13*c2^4*c3^4/c1^21+12*c0^7*c3^3/c1^10+5*c0^4*c2^3/c1^7+2*c0^3*c2^2/c1^5+3*c0^5*c3^2/c1^7+14*c0^5*c2^4/c1^9+55*c0^9*c3^4/c1^13+c0^3*c3/c1^4+c0^2*c2/c1^3+c0/c1

(3)

 

moreSums2.mw

Third Question

I see the Iterator:-CartesianProduct is very fast. I gather  this auto compiles which causes some bit of a delay 1st time. Question here. Coud auto compile type routines be added to start up code so restart doesn't affect this?

From the help page for restart

Note that any existing start up code will also be re-executed.

 

@pik1432 

In the final animation of the attached, the little green "balls" shpw the value of i__fd2 plotted in two ways, firstly as a simple plot of [Q__t, i__fd2], but also along the x-axis.

The little black balls show the the value of i_armature2, also plotted in two ways firstly as a simple plot of [Q__t,  i_armature2] but also as  [ i__fd2,  i_armature2] .

Understanding this animation may help to convince you that the parametric plot is correct

restart;

with(LinearAlgebra):

Digits := 6:

j := I:

L__adpu := 1.66;
L__aqpu := 1.61;
L__lpu := 0.15;
R__apu := 0.003;
E__tpu := 1.0;
MVA := 555;

1.66

 

1.61

 

.15

 

0.3e-2

 

1.0

 

555

(1)

A__sat := 0.0312500:
B__sat := 6.93147:

I__tpu_compare := (P__t - j* Q__t) / E__tpu;

-(1.00000*I)*Q__t+1.00000*P__t

(2)

I__tpu_a := abs(I__tpu_compare);

abs(-(1.00000*I)*Q__t+1.00000*P__t)

(3)

Phi := arccos(P__t / (I__tpu_a * E__tpu));

arccos(1.00000*P__t/abs(-(1.00000*I)*Q__t+1.00000*P__t))

(4)

E__a__tilde := E__tpu + (R__apu + j * L__lpu) * I__tpu_compare;

1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t)

(5)

psi__at := abs(E__a__tilde);

abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))

(6)

psi__I := A__sat * exp(B__sat * (psi__at - 0.8));

0.312500e-1*exp(6.93147*abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))-5.54518)

(7)

K__sd := psi__at / (psi__at + psi__I);

abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))/(abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))+0.312500e-1*exp(6.93147*abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))-5.54518))

(8)

K__sq := K__sd;

abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))/(abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))+0.312500e-1*exp(6.93147*abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))-5.54518))

(9)

X__ad := K__sd * L__adpu:

X__d := X__ad + L__lpu:

X__aq := K__sq * L__aqpu:

X__q := X__aq + L__lpu:

delta__i := arctan((X__q * I__tpu_a * cos(Phi) - R__apu * I__tpu_a * sin(Phi))/(E__tpu + R__apu * I__tpu_a * cos(Phi) + X__q * I__tpu_a * sin(Phi))):

e__q := E__tpu * cos(delta__i):

i__d := I__tpu_a * sin(delta__i + Phi):

i__q := I__tpu_a * cos(delta__i + Phi):

i__fd := (e__q + R__apu * i__q + X__d * i__d)/(X__ad):

i_armature := sqrt(i__d^2 + i__q^2):

i_armature2 := subs(P__t = 0, i_armature):

i_armature3 := subs(P__t = 0.5, i_armature):

i_armature4 := subs(P__t = 1.0, i_armature):

plotA := plot(i_armature2, Q__t = -0.6..0.6):

plotB := plot(i_armature3, Q__t = -0.6..0.6):

plotC := plot(i_armature4, Q__t = -0.6..0.6):

plots:-display([plotA, plotB, plotC]);

 

i__fd2 := subs(P__t = 0, i__fd):

i__fd3 := subs(P__t = 0.5, i__fd):

i__fd4 := subs(P__t = 1.0, i__fd):

 

plotD := plot(i__fd2, Q__t = -0.6..0.6):

plotE := plot(i__fd3, Q__t = -0.6..0.6):

plotF := plot(i__fd4, Q__t = -0.6..0.6):

plots:-display([plotD, plotE, plotF]);

 

p1:=plots:-display( [ plot([i__fd2, i_armature2, Q__t = -0.6..0.6], color=red),
                      plot( i__fd2, Q__t=-0.6..0.6, color=green),
                      plot( i_armature2, Q__t=-0.6..0.6, color=blue)
                    ]
                  ):
plots:-animate( plots:-pointplot,
                [ [ [ Q__t,   i__fd2],
                    [ i__fd2, 0],
                    [ Q__t,   i_armature2],
                    [ i__fd2,   i_armature2]
                  ],
                  symbol=solidcircle,
                  symbolsize=20,
                  color=[green, green, black, black]
                ],
                Q__t=-0.6..0.6,
                frames=50,
                background=p1)

 

 


 

Download oddplt2.mw

 

 

@Rouben Rostamian  

in the  command

f := VectorField([cos(theta__1),sin(theta__1),0,0,0,0],'cartesian ??? '[x__1,y__1,z__1,x__2,y__2,z__2])

Ignoring the "obvious" typos, OP has defined the basis vectors as  [x__1,y__1,z__1,x__2,y__2,z__2]

@datokala 

find the following helpful - it solves your inequality symbolically for positive 'm'

  restart;
  expr:= sqrt(7)*tan( sqrt(7)*(m+1)/2)/4+1/4:
  sol:= [solve( [expr>0, m>0])];

[{0 < m, m < (1/7)*(Pi-7^(1/2))*7^(1/2)}, {m < -(1/7)*(-3*Pi+7^(1/2))*7^(1/2), -(1/7)*(7^(1/2)+2*arctan((1/7)*7^(1/2))-2*Pi)*7^(1/2) < m}, {m < -(1/7)*(-5*Pi+7^(1/2))*7^(1/2), -(1/7)*(7^(1/2)+2*arctan((1/7)*7^(1/2))-4*Pi)*7^(1/2) < m}]

(1)

#
# "Generalise" the above solution to display a few more regions where the
# inequalities hold. Note that the first entry in the above list
# is a slight "exception"
#
  seq( { -((-(2*j+1)*Pi + sqrt(7))*sqrt(7))/7,
         -((sqrt(7) + 2*arctan(sqrt(7)/7) - 2*j*Pi)*sqrt(7))/7
       },
       j=1..5
     );

{-(1/7)*(-3*Pi+7^(1/2))*7^(1/2), -(1/7)*(7^(1/2)+2*arctan((1/7)*7^(1/2))-2*Pi)*7^(1/2)}, {-(1/7)*(-5*Pi+7^(1/2))*7^(1/2), -(1/7)*(7^(1/2)+2*arctan((1/7)*7^(1/2))-4*Pi)*7^(1/2)}, {-(1/7)*(-7*Pi+7^(1/2))*7^(1/2), -(1/7)*(7^(1/2)+2*arctan((1/7)*7^(1/2))-6*Pi)*7^(1/2)}, {-(1/7)*(-9*Pi+7^(1/2))*7^(1/2), -(1/7)*(7^(1/2)+2*arctan((1/7)*7^(1/2))-8*Pi)*7^(1/2)}, {-(1/7)*(-11*Pi+7^(1/2))*7^(1/2), -(1/7)*(7^(1/2)+2*arctan((1/7)*7^(1/2))-10*Pi)*7^(1/2)}

(2)

#
# Plot the first 10 regions where the inequalities are positive
#
  plots:-display( [ plot(expr, m=lhs(sol[1][1])..rhs(sol[1][2])),
                    seq( plot
                         ( expr,
                           m=-((-(2*j+1)*Pi + sqrt(7))*sqrt(7))/7..-((sqrt(7) + 2*arctan(sqrt(7)/7) - 2*j*Pi)*sqrt(7))/7
                         ),
                         j=1..10
                       )
                  ]
                 );

 

 


 

Download ineqalplt.mw

 

First 34 35 36 37 38 39 40 Last Page 36 of 207