tomleslie

8117 Reputation

17 Badges

11 years, 81 days

MaplePrimes Activity


These are answers submitted by tomleslie

If you have a mixture of "type" in the file to be read then ImportMatrix(fileName, source=csv) does different things depending on whether fields in the file are separated by a comma character, or comma+whitespace.

The first of these exhibits the behaviour which you are seeing, ie a number is returned where you expect a string. In the second case, a string field is returned, containing a string, so you get ""0"" Yikes!!!!

In the second case it is relatively simple to "strip" the extra level of quotation marks, where these occur. Alternatively one could write a fairly simple procedure to perform the operation you require. See the attached


 

  restart;

  currentdir("D:/Users/TomLeslie/myMaple"):
#
# Separator in data1.txt is ',' (no whitespace)
# Separator in data2.txt is ', ' (ie comma+space)
#
  A:=ImportMatrix("data1.txt", source=csv);
  B:=ImportMatrix("data2.txt", source=csv);
#
# Strip one level of quotes from entries in
# matrix 'A' when possible)
#
  f:=x->`if`(type(x,string),parse(x),x):
  f~(A);

_rtable[18446744074331554030]

 

_rtable[18446744074335969278]

 

Matrix(%id = 18446744074335971078)

(1)

#
# Define a procedure to work around this problem
#
  myRead:= proc( fname::string)
                 local l, p,
                       k:= 1,
                       res:= Array():
                 uses StringTools:
                 while true do
                       l:=  readline(fname);
                       if   l=0
                       then return convert(res, Matrix);
                       else p:= Array(parse~(Split(l, ",")));
                            res(k,1..numelems(p)):=p;
                            k:=k+1;
                       fi;
                 od:
          end proc:
A:=myRead("data1.txt");
B:=myRead("data2.txt");

_rtable[18446744074335973494]

 

Matrix(%id = 18446744074335975894)

(2)

 


 

Download readProb.mw

 

Obvious you will have to change the currentdir() setting. I am also attaching the two data files which I used

data1.txt

data2.txt

but for the second one, see the help at (my emphasis)

?Arrange Open Windows

In the Standard worksheet interface, Maple worksheets and documents can be set to open in a new tab. For details, see Tab Panes. You can change this setting so worksheets are opened in a new window from the Tools menu, through the Options>Interface tab.
If your session is set to open worksheets and documents in a new window, you can arrange open windows in several different ways.

By default(?) Maple opens worksheets in a new tab, so you can't 'tile' these. You can change this default using the

Tools->Options->Interface->Open worksheets in

menu entry

I have added some comments to the latest worksheet you provided so that you can see where your (many) problems lie.

The only excutable command I have added is to show that the number of equations you will generate from this code confirms my analysis of the code and will in fact be 21, because it will be

3*nx+ny+nx*ny

which with nx=ny=3 will result in 3*3+3+3*3 - ie 21

matgen.mw

If you have a function of the form

where g(z) has an asymptotic expansion then g(z)/exp(z) is (pretty much) guaranteed to have an asymptotic expansion since exp(z) will head towards infinity faster than most functions, so g(z)/exp(z) will" generally" head for zero

Now consider the function g(1/z)/exp(1/z): g(1/z) may (or may not) have an asymptotic expansion, but exp(1/z) will head for zero faster than"most" possible numerator functions g(1/z), so g(1/z)/exp(1/z) will head for infinity, and thus not have a sensible asymptote.

Can I think of counterexamples - yes obviously, eg g(z)=exp(z). In this case g(z) would not have an asymptotic expansion, but g(z)/exp(z) would asymptote to 1 and g(1/z)/exp(1/z) would also asymptote to 1 - and many other such counterexamples exist

 

My need :
A MAPLE code has to be run from an ECLIPSE session (through a cmaple MyCode).
In this ECLIPSE session the user chooses a data file among many, and ECLIPSE then has to tell MyCode what file it has to read.

So the obvious answer is for your ECLIPSE session to write a simple text file with a defined name (lets call it foo.bar, because everyone does) to a defined location. For the latter C;/users/Username/ would be a reasonable choice.

The contents of C;/users/Username/foo.bar is a sring which is the name of the file you actually want your Maple script to read - you might want to make this a full path.

So your maple script MyCode contains a read() statement, which reads the (hard-wired) filename C:/users/Username/foo.bar, from which it get the (preferably full path) name of the file it really needs to read - and a second read() statement will read this file

you could use implicitplot3d() to plot the solution surface of the equation over three variable ranges as in

   restart;
   with(plots):
   p: .2: # this is nonsense! why does it exist????
   omega[0] := 1:
   epsilon[1] := 1.04493:
   epsilon[2] := .93259:
   delta := 0.2e-1:
   eq:= (omega[0]*a-a*Omega^2+(3/4)*epsilon[2]*a^3)^2+(delta*Omega*a)^2 = p^2;
#
# Use implicitplot3d to allow for three variable ranges.
# Delete plot options which don't make much sense - such
# as gridrefine (NB not 'gridrefin') since this is an option
# for implicitplot() but not implictplot3d(). Also 'thickness',
# which is valid - but just why??????
#
# Correct a variable range definition from 'omega=' to
# 'Omega='
#
   implicitplot3d( eq, Omega=.5..2, a=0..5, p=0..1);

 

is to use the StateSpace() command from the DynamicSystems() package. This accepts input in a variety of forms (pole-zero, transfer function, ODE(s), or state matrices.

Check the help at

?DynamicSystems[StateSpace]

For future reference when uploading code here, use the big green up-arrow in the toolbar. No-one here is going to retype your code from a "picture"

 

by defining the amplitude function A(z,t) as the sum of real and imaginary parts as AR(z,t)+I*AI(z,t)

Then splitting your original PDE into real and imaginary parts - thus generating a system of two PDEs - and solving this system.

As a check the attached plots

  1. the real part of the amplitude function
  2. the imaginary part of the amplitude function
  3. the magnitude of the amplitude function

You should read the comments in the attached very carefully in case I have done anything you disagree with

complexPDE.mw

 

  1. Prim's algorithm is already implemented in Maple see the help at ?GraphTheory/PrimsAlgorithm
  2. If you want to know the code whhc Maple is using for Prim's algorithm then try showstat(GraphTheory:-PrimsAlgorithm). The first dozen or so lines are about argument checking and output options - but after that, you can read how Prim;'s algorithm is actually implemented

     

Consider (as an example) the system of PDEs given as

pdesys:=[-diff(F(r,s),r$2)+diff(F(r,s), s$2)+diff(H(r),r)+diff(G(s),s)+s = 0,
                diff(F(r,s),r$2)+diff(F(r,s),r,s)+diff(F(r,s),s$2)-diff(H(r),r)+diff(G(s),s)-r = 0
              ]

Then

pdsolve(pdesys) will return


{F(r, s) = _F2(s)+_F3(r)+(1/6)*r^2*s+(1/6)*(6*_C1*s+s^2+6*_C2)*r, G(s) = -(1/3)*s^2-(diff(_F2(s), s))-(1/2)*_C1*s+_C4, H(r) = -(1/6)*r^2+diff(_F3(r), r)+(1/2)*_C1*r+_C3}

which is a solution, albeit with quite a few arbitrary functions and constants. Provision of boundary/initial conditions will resolve many/all of these arbitrary functins/constants

It is probably worth bearing in mind that most ODEs (ODEsystems) or PDEs (PDEsystems) cannot be solved analytically. Textbooks tend to give a misleading impresion because they focus on the (very limited) cases where analyic solutions are possible

 

I thought Id' solve this problem by tightening up the accuracy on pdsolve(), reducing the time range and then using the returned solution module's 'value' method as input to a straightforwar numerical integration.

The value() method seems to correctly return numeric values for u(0.5,t) over the complete time range which I specified. However the Int() calculation returns 'unevaluated' when the integration range is much more than 0..0.1.

So in the following, why does

evalf(Int(g, 0..0.1)); #work, but
evalf(Int(g, 0..0.2)); #returns unevaluated


 

restart:k:=5;

5

(1)

EQ:=diff(u(x,t),t)=k*diff(u(x,t),x$2);

diff(u(x, t), t) = 5*(diff(diff(u(x, t), x), x))

(2)

ibc:=u(0,t)=0,u(1,t)=0, u(x,0) = x;

u(0, t) = 0, u(1, t) = 0, u(x, 0) = x

(3)

sol:=pdsolve({EQ},{ibc},numeric, timestep = 0.001, spacestep = 0.005);

_m751900608

(4)

p1:=sol:-plot(u,x=0.5,t=0...10,style = line,color = "Blue",legend = "heat Plot",axes=boxed);

 

 

#
# Define a function using the 'value' method
# whihc will return the value of u(0.5,t) for
# any supplied value of 't'
#
  f:=sol:-value(x=0.5, t=0..0.5);
  g:=z->op([3,2], f(z)):
#
# Generate u(x,t) for x=0.5 and t=0..0.5 by 0.05, just
# as a check on the above
#
  seq( g(j), j=0..0.5,0.05);
#
# Integrate the procedure g() over the required
# range
#
# For reasons which are a bit of mystery to me,
# this returns 'unevaluated' if the upper
# integration limit is much more than ~0.1. This
# can't(?) be a problem with the 'value' method
# because the above seq() command works all the
# way to t=0.5
#
  evalf(Int(g, 0..0.1));
  evalf(Int(g, 0..0.2));

proc (x_pde) local res, solnproc, outpoint, ndsol, stype, i; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; Digits := trunc(evalhf(Digits)); outpoint := evalf(x_pde); solnproc := proc (outpoint) local indepvals, depvals, vary, ndep, i; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; table( [( "soln_procedures" ) = array( 0 .. 0, [( 0 ) = (18446744074403161910)  ] ) ] ) indepvals := Vector(501, {(1) = .0, (2) = 0.10e-2, (3) = 0.20e-2, (4) = 0.30e-2, (5) = 0.40e-2, (6) = 0.50e-2, (7) = 0.60e-2, (8) = 0.70e-2, (9) = 0.80e-2, (10) = 0.90e-2, (11) = 0.1e-1, (12) = 0.11e-1, (13) = 0.12e-1, (14) = 0.13e-1, (15) = 0.14e-1, (16) = 0.15e-1, (17) = 0.16e-1, (18) = 0.17e-1, (19) = 0.18e-1, (20) = 0.19e-1, (21) = 0.2e-1, (22) = 0.21e-1, (23) = 0.22e-1, (24) = 0.23e-1, (25) = 0.24e-1, (26) = 0.25e-1, (27) = 0.26e-1, (28) = 0.27e-1, (29) = 0.28e-1, (30) = 0.29e-1, (31) = 0.3e-1, (32) = 0.31e-1, (33) = 0.32e-1, (34) = 0.33e-1, (35) = 0.34e-1, (36) = 0.35e-1, (37) = 0.36e-1, (38) = 0.37e-1, (39) = 0.38e-1, (40) = 0.39e-1, (41) = 0.4e-1, (42) = 0.41e-1, (43) = 0.42e-1, (44) = 0.43e-1, (45) = 0.44e-1, (46) = 0.45e-1, (47) = 0.46e-1, (48) = 0.47e-1, (49) = 0.48e-1, (50) = 0.49e-1, (51) = 0.5e-1, (52) = 0.51e-1, (53) = 0.52e-1, (54) = 0.53e-1, (55) = 0.54e-1, (56) = 0.55e-1, (57) = 0.56e-1, (58) = 0.57e-1, (59) = 0.58e-1, (60) = 0.59e-1, (61) = 0.6e-1, (62) = 0.61e-1, (63) = 0.62e-1, (64) = 0.63e-1, (65) = 0.64e-1, (66) = 0.65e-1, (67) = 0.66e-1, (68) = 0.67e-1, (69) = 0.68e-1, (70) = 0.69e-1, (71) = 0.7e-1, (72) = 0.71e-1, (73) = 0.72e-1, (74) = 0.73e-1, (75) = 0.74e-1, (76) = 0.75e-1, (77) = 0.76e-1, (78) = 0.77e-1, (79) = 0.78e-1, (80) = 0.79e-1, (81) = 0.8e-1, (82) = 0.81e-1, (83) = 0.82e-1, (84) = 0.83e-1, (85) = 0.84e-1, (86) = 0.85e-1, (87) = 0.86e-1, (88) = 0.87e-1, (89) = 0.88e-1, (90) = 0.89e-1, (91) = 0.9e-1, (92) = 0.91e-1, (93) = 0.92e-1, (94) = 0.93e-1, (95) = 0.94e-1, (96) = 0.95e-1, (97) = 0.96e-1, (98) = 0.97e-1, (99) = 0.98e-1, (100) = 0.99e-1, (101) = .1, (102) = .101, (103) = .102, (104) = .103, (105) = .104, (106) = .105, (107) = .106, (108) = .107, (109) = .108, (110) = .109, (111) = .11, (112) = .111, (113) = .112, (114) = .113, (115) = .114, (116) = .115, (117) = .116, (118) = .117, (119) = .118, (120) = .119, (121) = .12, (122) = .121, (123) = .122, (124) = .123, (125) = .124, (126) = .125, (127) = .126, (128) = .127, (129) = .128, (130) = .129, (131) = .13, (132) = .131, (133) = .132, (134) = .133, (135) = .134, (136) = .135, (137) = .136, (138) = .137, (139) = .138, (140) = .139, (141) = .14, (142) = .141, (143) = .142, (144) = .143, (145) = .144, (146) = .145, (147) = .146, (148) = .147, (149) = .148, (150) = .149, (151) = .15, (152) = .151, (153) = .152, (154) = .153, (155) = .154, (156) = .155, (157) = .156, (158) = .157, (159) = .158, (160) = .159, (161) = .16, (162) = .161, (163) = .162, (164) = .163, (165) = .164, (166) = .165, (167) = .166, (168) = .167, (169) = .168, (170) = .169, (171) = .17, (172) = .171, (173) = .172, (174) = .173, (175) = .174, (176) = .175, (177) = .176, (178) = .177, (179) = .178, (180) = .179, (181) = .18, (182) = .181, (183) = .182, (184) = .183, (185) = .184, (186) = .185, (187) = .186, (188) = .187, (189) = .188, (190) = .189, (191) = .19, (192) = .191, (193) = .192, (194) = .193, (195) = .194, (196) = .195, (197) = .196, (198) = .197, (199) = .198, (200) = .199, (201) = .2, (202) = .201, (203) = .202, (204) = .203, (205) = .204, (206) = .205, (207) = .206, (208) = .207, (209) = .208, (210) = .209, (211) = .21, (212) = .211, (213) = .212, (214) = .213, (215) = .214, (216) = .215, (217) = .216, (218) = .217, (219) = .218, (220) = .219, (221) = .22, (222) = .221, (223) = .222, (224) = .223, (225) = .224, (226) = .225, (227) = .226, (228) = .227, (229) = .228, (230) = .229, (231) = .23, (232) = .231, (233) = .232, (234) = .233, (235) = .234, (236) = .235, (237) = .236, (238) = .237, (239) = .238, (240) = .239, (241) = .24, (242) = .241, (243) = .242, (244) = .243, (245) = .244, (246) = .245, (247) = .246, (248) = .247, (249) = .248, (250) = .249, (251) = .25, (252) = .251, (253) = .252, (254) = .253, (255) = .254, (256) = .255, (257) = .256, (258) = .257, (259) = .258, (260) = .259, (261) = .26, (262) = .261, (263) = .262, (264) = .263, (265) = .264, (266) = .265, (267) = .266, (268) = .267, (269) = .268, (270) = .269, (271) = .27, (272) = .271, (273) = .272, (274) = .273, (275) = .274, (276) = .275, (277) = .276, (278) = .277, (279) = .278, (280) = .279, (281) = .28, (282) = .281, (283) = .282, (284) = .283, (285) = .284, (286) = .285, (287) = .286, (288) = .287, (289) = .288, (290) = .289, (291) = .29, (292) = .291, (293) = .292, (294) = .293, (295) = .294, (296) = .295, (297) = .296, (298) = .297, (299) = .298, (300) = .299, (301) = .3, (302) = .301, (303) = .302, (304) = .303, (305) = .304, (306) = .305, (307) = .306, (308) = .307, (309) = .308, (310) = .309, (311) = .31, (312) = .311, (313) = .312, (314) = .313, (315) = .314, (316) = .315, (317) = .316, (318) = .317, (319) = .318, (320) = .319, (321) = .32, (322) = .321, (323) = .322, (324) = .323, (325) = .324, (326) = .325, (327) = .326, (328) = .327, (329) = .328, (330) = .329, (331) = .33, (332) = .331, (333) = .332, (334) = .333, (335) = .334, (336) = .335, (337) = .336, (338) = .337, (339) = .338, (340) = .339, (341) = .34, (342) = .341, (343) = .342, (344) = .343, (345) = .344, (346) = .345, (347) = .346, (348) = .347, (349) = .348, (350) = .349, (351) = .35, (352) = .351, (353) = .352, (354) = .353, (355) = .354, (356) = .355, (357) = .356, (358) = .357, (359) = .358, (360) = .359, (361) = .36, (362) = .361, (363) = .362, (364) = .363, (365) = .364, (366) = .365, (367) = .366, (368) = .367, (369) = .368, (370) = .369, (371) = .37, (372) = .371, (373) = .372, (374) = .373, (375) = .374, (376) = .375, (377) = .376, (378) = .377, (379) = .378, (380) = .379, (381) = .38, (382) = .381, (383) = .382, (384) = .383, (385) = .384, (386) = .385, (387) = .386, (388) = .387, (389) = .388, (390) = .389, (391) = .39, (392) = .391, (393) = .392, (394) = .393, (395) = .394, (396) = .395, (397) = .396, (398) = .397, (399) = .398, (400) = .399, (401) = .4, (402) = .401, (403) = .402, (404) = .403, (405) = .404, (406) = .405, (407) = .406, (408) = .407, (409) = .408, (410) = .409, (411) = .41, (412) = .411, (413) = .412, (414) = .413, (415) = .414, (416) = .415, (417) = .416, (418) = .417, (419) = .418, (420) = .419, (421) = .42, (422) = .421, (423) = .422, (424) = .423, (425) = .424, (426) = .425, (427) = .426, (428) = .427, (429) = .428, (430) = .429, (431) = .43, (432) = .431, (433) = .432, (434) = .433, (435) = .434, (436) = .435, (437) = .436, (438) = .437, (439) = .438, (440) = .439, (441) = .44, (442) = .441, (443) = .442, (444) = .443, (445) = .444, (446) = .445, (447) = .446, (448) = .447, (449) = .448, (450) = .449, (451) = .45, (452) = .451, (453) = .452, (454) = .453, (455) = .454, (456) = .455, (457) = .456, (458) = .457, (459) = .458, (460) = .459, (461) = .46, (462) = .461, (463) = .462, (464) = .463, (465) = .464, (466) = .465, (467) = .466, (468) = .467, (469) = .468, (470) = .469, (471) = .47, (472) = .471, (473) = .472, (474) = .473, (475) = .474, (476) = .475, (477) = .476, (478) = .477, (479) = .478, (480) = .479, (481) = .48, (482) = .481, (483) = .482, (484) = .483, (485) = .484, (486) = .485, (487) = .486, (488) = .487, (489) = .488, (490) = .489, (491) = .49, (492) = .491, (493) = .492, (494) = .493, (495) = .494, (496) = .495, (497) = .496, (498) = .497, (499) = .498, (500) = .499, (501) = .5}, datatype = float[8]); if outpoint = "left" then return indepvals[1] elif outpoint = "right" then return indepvals[501] elif outpoint = "start" then return 0. elif not type(outpoint, 'numeric') then error "non-numeric input" end if; if outpoint < indepvals[1] or indepvals[501] < outpoint then error "requested %1 value must be in the range %2..%3", t, indepvals[1], indepvals[501] end if; depvals := Matrix(501, 1, {(1, 1) = .5, (2, 1) = .4999544107227156, (3, 1) = .4994990867512817, (4, 1) = .4974524016225735, (5, 1) = .49192379634883304, (6, 1) = .48168719564308854, (7, 1) = .4673301178157086, (8, 1) = .4504802910814855, (9, 1) = .432427851051871, (10, 1) = .4139195336631002, (11, 1) = .39545973449581573, (12, 1) = .3773566898499253, (13, 1) = .35978110428755045, (14, 1) = .34283584031677994, (15, 1) = .3265678919544868, (16, 1) = .3109950314184855, (17, 1) = .29611639362498876, (18, 1) = .2819182421296733, (19, 1) = .2683813355239012, (20, 1) = .255481754474412, (21, 1) = .24319422141137928, (22, 1) = .23149258341897563, (23, 1) = .22035071237377712, (24, 1) = .2097430810778592, (25, 1) = .19964475094862033, (26, 1) = .19003180661172828, (27, 1) = .1808811787703935, (28, 1) = .17217085239854937, (29, 1) = .16387975279032252, (30, 1) = .15598778287693774, (31, 1) = .14847578306933712, (32, 1) = .14132548331025277, (33, 1) = .13451949671879587, (34, 1) = .1280412480835538, (35, 1) = .12187497045674371, (36, 1) = .11600564031598705, (37, 1) = .11041896459814515, (38, 1) = .10510133121626977, (39, 1) = .10003978600235733, (40, 1) = 0.9522199693717519e-1, (41, 1) = 0.9063622515684143e-1, (42, 1) = 0.862712982637069e-1, (43, 1) = 0.8211657985914785e-1, (44, 1) = 0.7816194778647204e-1, (45, 1) = 0.7439776525222687e-1, (46, 1) = 0.708148613607933e-1, (47, 1) = 0.6740450530918872e-1, (48, 1) = 0.6415838795516504e-1, (49, 1) = 0.61068599420651085e-1, (50, 1) = 0.5812761133720683e-1, (51, 1) = 0.55328257558693215e-1, (52, 1) = 0.52663717173828145e-1, (53, 1) = 0.501274977883816e-1, (54, 1) = 0.47713419529991016e-1, (55, 1) = 0.4541560035419814e-1, (56, 1) = 0.4322844123695271e-1, (57, 1) = 0.4114661305871249e-1, (58, 1) = 0.3916504308869119e-1, (59, 1) = 0.3727890312608476e-1, (60, 1) = 0.3548359728609714e-1, (61, 1) = 0.3377475118632052e-1, (62, 1) = 0.3214820097370435e-1, (63, 1) = 0.30599983423044916e-1, (64, 1) = 0.29126326102057024e-1, (65, 1) = 0.2772363829824006e-1, (66, 1) = 0.2638850220192111e-1, (67, 1) = 0.25117664604041468e-1, (68, 1) = 0.23908028977007518e-1, (69, 1) = 0.22756647897005565e-1, (70, 1) = 0.21660715912451178e-1, (71, 1) = 0.20617562646991817e-1, (72, 1) = 0.1962464635965761e-1, (73, 1) = 0.18679547683557205e-1, (74, 1) = 0.17779963796790903e-1, (75, 1) = 0.1692370274995727e-1, (76, 1) = 0.1610867818042754e-1, (77, 1) = 0.15332904180690625e-1, (78, 1) = 0.14594490499833654e-1, (79, 1) = 0.1389163790501822e-1, (80, 1) = 0.13222633822843723e-1, (81, 1) = 0.12585848147853384e-1, (82, 1) = 0.11979729283153733e-1, (83, 1) = 0.11402800352502195e-1, (84, 1) = 0.10853655604558424e-1, (85, 1) = 0.1033095698842768e-1, (86, 1) = 0.9833430889681784e-2, (87, 1) = 0.9359865032869319e-2, (88, 1) = 0.8909105520358961e-2, (89, 1) = 0.8480054028996242e-2, (90, 1) = 0.8071665125193694e-2, (91, 1) = 0.7682943726418257e-2, (92, 1) = 0.7312942667994558e-2, (93, 1) = 0.6960760403329459e-2, (94, 1) = 0.66255387997436336e-2, (95, 1) = 0.6306461054225652e-2, (96, 1) = 0.600274969734047e-2, (97, 1) = 0.5713664703845014e-2, (98, 1) = 0.5438501685377711e-2, (99, 1) = 0.517659017747909e-2, (100, 1) = 0.4927292003355584e-2, (101, 1) = 0.4689999720766375e-2, (102, 1) = 0.4464135140674892e-2, (103, 1) = 0.4249147919127103e-2, (104, 1) = 0.4044514216047103e-2, (105, 1) = 0.38497354186821636e-2, (106, 1) = 0.36643369271552326e-2, (107, 1) = 0.34878669973249215e-2, (108, 1) = 0.33198956409699783e-2, (109, 1) = 0.31600135770391167e-2, (110, 1) = 0.30078312355066037e-2, (111, 1) = 0.28629778069926247e-2, (112, 1) = 0.2725100340393848e-2, (113, 1) = 0.2593862881760322e-2, (114, 1) = 0.24689456567722986e-2, (115, 1) = 0.2350044290579617e-2, (116, 1) = 0.22368690670706783e-2, (117, 1) = 0.2129144222126691e-2, (118, 1) = 0.20266072724163405e-2, (119, 1) = 0.19290083751991136e-2, (120, 1) = 0.18361097200867724e-2, (121, 1) = 0.17476849491538842e-2, (122, 1) = 0.16635186057421928e-2, (123, 1) = 0.15834056092076743e-2, (124, 1) = 0.15071507554134682e-2, (125, 1) = 0.14345682409656656e-2, (126, 1) = 0.13654812105515879e-2, (127, 1) = 0.12997213259946256e-2, (128, 1) = 0.12371283560538863e-2, (129, 1) = 0.11775497860649093e-2, (130, 1) = 0.11208404462298845e-2, (131, 1) = 0.1066862158009026e-2, (132, 1) = 0.1015483397302855e-2, (133, 1) = 0.9665789741211783e-3, (134, 1) = 0.9200297273949745e-3, (135, 1) = 0.8757222347789932e-3, (136, 1) = 0.8335485361345848e-3, (137, 1) = 0.7934058706204756e-3, (138, 1) = 0.7551964261629123e-3, (139, 1) = 0.7188271012597086e-3, (140, 1) = 0.6842092780033331e-3, (141, 1) = 0.6512586062682261e-3, (142, 1) = 0.6198947980785933e-3, (143, 1) = 0.5900414320704988e-3, (144, 1) = 0.5616257672014181e-3, (145, 1) = 0.5345785655788801e-3, (146, 1) = 0.5088339236952483e-3, (147, 1) = 0.48432911189568074e-3, (148, 1) = 0.46100442149096083e-3, (149, 1) = 0.43880301930109363e-3, (150, 1) = 0.41767080915284063e-3, (151, 1) = 0.397556300083069e-3, (152, 1) = 0.37841048086736646e-3, (153, 1) = 0.3601867006008519e-3, (154, 1) = 0.3428405550311208e-3, (155, 1) = 0.3263297783550011e-3, (156, 1) = 0.31061414024425606e-3, (157, 1) = 0.29565534780599334e-3, (158, 1) = 0.2814169522940696e-3, (159, 1) = 0.2678642602796826e-3, (160, 1) = 0.2549642491362268e-3, (161, 1) = 0.24268548655603653e-3, (162, 1) = 0.23099805398240999e-3, (163, 1) = 0.21987347368944838e-3, (164, 1) = 0.20928463941288916e-3, (165, 1) = 0.19920575028333195e-3, (166, 1) = 0.18961224797812794e-3, (167, 1) = 0.18048075686473355e-3, (168, 1) = 0.17178902705986687e-3, (169, 1) = 0.1635158801999487e-3, (170, 1) = 0.15564115785166637e-3, (171, 1) = 0.14814567238104608e-3, (172, 1) = 0.14101116021201872e-3, (173, 1) = 0.1342202373151546e-3, (174, 1) = 0.12775635685831425e-3, (175, 1) = 0.12160376888094579e-3, (176, 1) = 0.11574748192389775e-3, (177, 1) = 0.11017322649586089e-3, (178, 1) = 0.10486742030833871e-3, (179, 1) = 0.9981713517770898e-4, (180, 1) = 0.9501006552657761e-4, (181, 1) = 0.9043449839838494e-4, (182, 1) = 0.8607928491826381e-4, (183, 1) = 0.8193381312744392e-4, (184, 1) = 0.7798798212561163e-4, (185, 1) = 0.7423217745986296e-4, (186, 1) = 0.7065724769670519e-4, (187, 1) = 0.6725448212523827e-4, (188, 1) = 0.6401558953061172e-4, (189, 1) = 0.6093267799370938e-4, (190, 1) = 0.5799823565931381e-4, (191, 1) = 0.55205112435049976e-4, (192, 1) = 0.5254650256692525e-4, (193, 1) = 0.50015928058847865e-4, (194, 1) = 0.47607222885799234e-4, (195, 1) = 0.4531451797206035e-4, (196, 1) = 0.4313222688820581e-4, (197, 1) = 0.4105503224141025e-4, (198, 1) = 0.39077872716887884e-4, (199, 1) = 0.37195930747456726e-4, (200, 1) = 0.3540462077312639e-4, (201, 1) = 0.336995780696043e-4, (202, 1) = 0.32076648111585825e-4, (203, 1) = 0.30531876451215216e-4, (204, 1) = 0.29061499081372182e-4, (205, 1) = 0.27661933265361626e-4, (206, 1) = 0.26329768806222953e-4, (207, 1) = 0.2506175973821757e-4, (208, 1) = 0.23854816417007525e-4, (209, 1) = 0.2270599799192742e-4, (210, 1) = 0.21612505239873067e-4, (211, 1) = 0.20571673744968802e-4, (212, 1) = 0.19580967406251764e-4, (213, 1) = 0.18637972258250635e-4, (214, 1) = 0.17740390589117337e-4, (215, 1) = 0.16886035341887488e-4, (216, 1) = 0.16072824785661848e-4, (217, 1) = 0.15298777442983476e-4, (218, 1) = 0.145620072620642e-4, (219, 1) = 0.13860719020844029e-4, (220, 1) = 0.13193203953145328e-4, (221, 1) = 0.1255783558462732e-4, (222, 1) = 0.11953065770179519e-4, (223, 1) = 0.11377420921193557e-4, (224, 1) = 0.1082949841552105e-4, (225, 1) = 0.10307963179298005e-4, (226, 1) = 0.9811544434429065e-5, (227, 1) = 0.9339032601653983e-5, (228, 1) = 0.8889276353815441e-5, (229, 1) = 0.8461179809986313e-5, (230, 1) = 0.8053699865764096e-5, (231, 1) = 0.7665843651112539e-5, (232, 1) = 0.7296666111630866e-5, (233, 1) = 0.6945267705331883e-5, (234, 1) = 0.6610792211285061e-5, (235, 1) = 0.6292424642880198e-5, (236, 1) = 0.5989389262463911e-5, (237, 1) = 0.5700947690746345e-5, (238, 1) = 0.5426397108062171e-5, (239, 1) = 0.5165068541488362e-5, (240, 1) = 0.4916325235182932e-5, (241, 1) = 0.4679561098512822e-5, (242, 1) = 0.4454199229574575e-5, (243, 1) = 0.4239690509199813e-5, (244, 1) = 0.4035512263257414e-5, (245, 1) = 0.38411669888254114e-5, (246, 1) = 0.36561811422288783e-5, (247, 1) = 0.3480103984954974e-5, (248, 1) = 0.33125064856078344e-5, (249, 1) = 0.31529802743105565e-5, (250, 1) = 0.3001136647869946e-5, (251, 1) = 0.2856605622466751e-5, (252, 1) = 0.27190350323300504e-5, (253, 1) = 0.2588089671475295e-5, (254, 1) = 0.24634504771002464e-5, (255, 1) = 0.2344813751998731e-5, (256, 1) = 0.22318904247162944e-5, (257, 1) = 0.21244053450543983e-5, (258, 1) = 0.20220966137724165e-5, (259, 1) = 0.19247149443099878e-5, (260, 1) = 0.18320230555000405e-5, (261, 1) = 0.1743795093283003e-5, (262, 1) = 0.16598160805097917e-5, (263, 1) = 0.157988139300694e-5, (264, 1) = 0.1503796261104946e-5, (265, 1) = 0.14313752949437503e-5, (266, 1) = 0.13624420328659377e-5, (267, 1) = 0.12968285113325576e-5, (268, 1) = 0.1234374855777375e-5, (269, 1) = 0.11749288909384235e-5, (270, 1) = 0.11183457701832623e-5, (271, 1) = 0.10644876224561234e-5, (272, 1) = 0.10132232164590057e-5, (273, 1) = 0.9644276407716696e-6, (274, 1) = 0.9179819996130259e-6, (275, 1) = 0.8737731230150432e-6, (276, 1) = 0.8316932911965937e-6, (277, 1) = 0.7916399719656775e-6, (278, 1) = 0.7535155710167104e-6, (279, 1) = 0.7172271940012312e-6, (280, 1) = 0.6826864203122083e-6, (281, 1) = 0.6498090875041671e-6, (282, 1) = 0.6185150863569849e-6, (283, 1) = 0.5887281655444893e-6, (284, 1) = 0.5603757459775841e-6, (285, 1) = 0.5333887438179722e-6, (286, 1) = 0.5077014022883793e-6, (287, 1) = 0.4832511313070361e-6, (288, 1) = 0.45997835512302797e-6, (289, 1) = 0.43782636700936056e-6, (290, 1) = 0.41674119123572217e-6, (291, 1) = 0.39667145140485e-6, (292, 1) = 0.3775682454147956e-6, (293, 1) = 0.35938502615638727e-6, (294, 1) = 0.34207748824374384e-6, (295, 1) = 0.32560345991119215e-6, (296, 1) = 0.30992280040554323e-6, (297, 1) = 0.2949973020300346e-6, (298, 1) = 0.28079059719587294e-6, (299, 1) = 0.26726806965971645e-6, (300, 1) = 0.254396770326209e-6, (301, 1) = 0.24214533681514565e-6, (302, 1) = 0.2304839171921016e-6, (303, 1) = 0.21938409708262183e-6, (304, 1) = 0.20881883058540538e-6, (305, 1) = 0.19876237422441929e-6, (306, 1) = 0.18919022436918755e-6, (307, 1) = 0.180079057382374e-6, (308, 1) = 0.17140667293522922e-6, (309, 1) = 0.16315193976856153e-6, (310, 1) = 0.1552947443489323e-6, (311, 1) = 0.14781594171563344e-6, (312, 1) = 0.1406973089753521e-6, (313, 1) = 0.13392150075732735e-6, (314, 1) = 0.12747200709143717e-6, (315, 1) = 0.12133311303860388e-6, (316, 1) = 0.11548986054004771e-6, (317, 1) = 0.1099280118306875e-6, (318, 1) = 0.10463401488607539e-6, (319, 1) = 0.99594970263391e-7, (320, 1) = 0.9479859980769727e-7, (321, 1) = 0.9023321659851633e-7, (322, 1) = 0.8588769660886738e-7, (323, 1) = 0.8175145146566543e-7, (324, 1) = 0.7781440278383274e-7, (325, 1) = 0.7406695747617152e-7, (326, 1) = 0.7049998451095726e-7, (327, 1) = 0.6710479253177148e-7, (328, 1) = 0.6387310881064849e-7, (329, 1) = 0.6079705896085583e-7, (330, 1) = 0.5786914787910135e-7, (331, 1) = 0.55082241354637466e-7, (332, 1) = 0.524295488134561e-7, (333, 1) = 0.4990460664556636e-7, (334, 1) = 0.4750126258169609e-7, (335, 1) = 0.45213660577330524e-7, (336, 1) = 0.43036226668378566e-7, (337, 1) = 0.4096365526572667e-7, (338, 1) = 0.38990896350764974e-7, (339, 1) = 0.37113143047952585e-7, (340, 1) = 0.35325820034179166e-7, (341, 1) = 0.3362457226928866e-7, (342, 1) = 0.3200525450510177e-7, (343, 1) = 0.3046392106512676e-7, (344, 1) = 0.28996816349803205e-7, (345, 1) = 0.27600365566850733e-7, (346, 1) = 0.2627116613901841e-7, (347, 1) = 0.25005979295784794e-7, (348, 1) = 0.23801722298709244e-7, (349, 1) = 0.22655460813587283e-7, (350, 1) = 0.21564401876480206e-7, (351, 1) = 0.20525886973034556e-7, (352, 1) = 0.19537385675497494e-7, (353, 1) = 0.18596489362799045e-7, (354, 1) = 0.17700905465410568e-7, (355, 1) = 0.1684845176603002e-7, (356, 1) = 0.16037051195076528e-7, (357, 1) = 0.15264726657474382e-7, (358, 1) = 0.14529596326952655e-7, (359, 1) = 0.13829868949548162e-7, (360, 1) = 0.13163839589750724e-7, (361, 1) = 0.12529885365987543e-7, (362, 1) = 0.11926461606067213e-7, (363, 1) = 0.11352097974114846e-7, (364, 1) = 0.10805394996766324e-7, (365, 1) = 0.1028502054483377e-7, (366, 1) = 0.9789706695324108e-8, (367, 1) = 0.931824653456807e-8, (368, 1) = 0.8869491324418904e-8, (369, 1) = 0.844234759670495e-8, (370, 1) = 0.8035774594938106e-8, (371, 1) = 0.7648781632784851e-8, (372, 1) = 0.72804257853081785e-8, (373, 1) = 0.69298094867189936e-8, (374, 1) = 0.6596078447616071e-8, (375, 1) = 0.6278419469605838e-8, (376, 1) = 0.5976058567216734e-8, (377, 1) = 0.56882589790827985e-8, (378, 1) = 0.5414319475212558e-8, (379, 1) = 0.5153572546340481e-8, (380, 1) = 0.4905382879046423e-8, (381, 1) = 0.4669145706608829e-8, (382, 1) = 0.444428543611575e-8, (383, 1) = 0.4230254145720183e-8, (384, 1) = 0.4026530349374282e-8, (385, 1) = 0.3832617626806793e-8, (386, 1) = 0.36480435128626896e-8, (387, 1) = 0.34723582478083573e-8, (388, 1) = 0.33051337794827317e-8, (389, 1) = 0.31459626227008976e-8, (390, 1) = 0.29944569635315435e-8, (391, 1) = 0.28502476176247582e-8, (392, 1) = 0.27129832269353086e-8, (393, 1) = 0.25823293077565527e-8, (394, 1) = 0.2457967531119676e-8, (395, 1) = 0.23395948521814362e-8, (396, 1) = 0.22269228663537363e-8, (397, 1) = 0.2119677012477889e-8, (398, 1) = 0.20175959974871503e-8, (399, 1) = 0.1920431066510637e-8, (400, 1) = 0.18279454895477707e-8, (401, 1) = 0.17399138922887997e-8, (402, 1) = 0.16561217988941863e-8, (403, 1) = 0.15763650179025216e-8, (404, 1) = 0.15004492357638652e-8, (405, 1) = 0.14281894527336645e-8, (406, 1) = 0.13594096223123771e-8, (407, 1) = 0.1293942132503203e-8, (408, 1) = 0.12316274867671257e-8, (409, 1) = 0.11723138264559878e-8, (410, 1) = 0.11158566493053625e-8, (411, 1) = 0.10621183692470469e-8, (412, 1) = 0.10109680688367588e-8, (413, 1) = 0.962281093006822e-9, (414, 1) = 0.9159388321655597e-9, (415, 1) = 0.8718283467727635e-9, (416, 1) = 0.8298421781544999e-9, (417, 1) = 0.7898780010766752e-9, (418, 1) = 0.7518384595983192e-9, (419, 1) = 0.7156308450830675e-9, (420, 1) = 0.6811669546658694e-9, (421, 1) = 0.6483627923822522e-9, (422, 1) = 0.6171384480524459e-9, (423, 1) = 0.5874178194254431e-9, (424, 1) = 0.5591285094914339e-9, (425, 1) = 0.5322015677346938e-9, (426, 1) = 0.5065714040732117e-9, (427, 1) = 0.4821755474930071e-9, (428, 1) = 0.45895457498367447e-9, (429, 1) = 0.4368518859879838e-9, (430, 1) = 0.4158136448561961e-9, (431, 1) = 0.3957885696918547e-9, (432, 1) = 0.37672788698725054e-9, (433, 1) = 0.3585851335783868e-9, (434, 1) = 0.3413161222504766e-9, (435, 1) = 0.32487875563599235e-9, (436, 1) = 0.3092330016933504e-9, (437, 1) = 0.2943407184902987e-9, (438, 1) = 0.28016563856314234e-9, (439, 1) = 0.26667320362703226e-9, (440, 1) = 0.2538305569165337e-9, (441, 1) = 0.2416063869534408e-9, (442, 1) = 0.22997092705500302e-9, (443, 1) = 0.21889580737121175e-9, (444, 1) = 0.20835406082403412e-9, (445, 1) = 0.19831998269942437e-9, (446, 1) = 0.18876914235051576e-9, (447, 1) = 0.17967824969634792e-9, (448, 1) = 0.1710251720857307e-9, (449, 1) = 0.162788807114915e-9, (450, 1) = 0.15494910410565383e-9, (451, 1) = 0.14748694270868002e-9, (452, 1) = 0.14038415850173872e-9, (453, 1) = 0.1336234268954241e-9, (454, 1) = 0.1271882924038161e-9, (455, 1) = 0.12106305741388012e-9, (456, 1) = 0.11523281472408309e-9, (457, 1) = 0.10968334077957481e-9, (458, 1) = 0.10440113111256577e-9, (459, 1) = 0.9937329768206435e-10, (460, 1) = 0.9458760688497882e-10, (461, 1) = 0.9003238067272698e-10, (462, 1) = 0.8569653683336507e-10, (463, 1) = 0.8156949358778418e-10, (464, 1) = 0.7764121187226941e-10, (465, 1) = 0.7390210314411839e-10, (466, 1) = 0.703430734195478e-10, (467, 1) = 0.6695543404374481e-10, (468, 1) = 0.6373094726293636e-10, (469, 1) = 0.6066173973627636e-10, (470, 1) = 0.5774034944201846e-10, (471, 1) = 0.54959641729009147e-10, (472, 1) = 0.5231285737624476e-10, (473, 1) = 0.49793531000419173e-10, (474, 1) = 0.4739554010569246e-10, (475, 1) = 0.4511302568025577e-10, (476, 1) = 0.42940442088794775e-10, (477, 1) = 0.4087247970647332e-10, (478, 1) = 0.38904115521182645e-10, (479, 1) = 0.37030537666989125e-10, (480, 1) = 0.3524719661609394e-10, (481, 1) = 0.3354973148630388e-10, (482, 1) = 0.3193402171434091e-10, (483, 1) = 0.3039611502309015e-10, (484, 1) = 0.28932279478703623e-10, (485, 1) = 0.27538933013942996e-10, (486, 1) = 0.26212695781137197e-10, (487, 1) = 0.24950321136762788e-10, (488, 1) = 0.23748748210930103e-10, (489, 1) = 0.2260503426722205e-10, (490, 1) = 0.2151640741752758e-10, (491, 1) = 0.20480200278464843e-10, (492, 1) = 0.19493902767364093e-10, (493, 1) = 0.18555096983683632e-10, (494, 1) = 0.17661510028510062e-10, (495, 1) = 0.1681095004557865e-10, (496, 1) = 0.16001359012558737e-10, (497, 1) = 0.15230749881985598e-10, (498, 1) = 0.1449725929787519e-10, (499, 1) = 0.13799085781976945e-10, (500, 1) = 0.1313454233416273e-10, (501, 1) = 0.12501995614273475e-10}, datatype = float[8], order = C_order); vary := Array(1..2, {(1) = .0, (2) = -0.10e-2}, datatype = float[8]); ndep := 1; if vary[ndep+1]-outpoint <> 0. then `pdsolve/interp1dto0d`(501, indepvals, 1, depvals, true, outpoint, vary); vary[ndep+1] := outpoint end if; [seq(vary[i], i = 1 .. ndep)] end proc; if not type(outpoint, 'numeric') then if member(outpoint, ["start", "left", "right"]) then return solnproc(x_pde) elif outpoint = "solnprocedure" then return eval(solnproc) elif procname <> unknown then return ('procname')(x_pde) else ndsol := pointto(solnproc("soln_procedures")[0]); return ('ndsol')(x_pde) end if end if; stype := "2nd"; try res := solnproc(outpoint); if stype = "1st" then [x = outpoint, t = .5, seq([u(x, t)][i] = res[i], i = 1 .. 1)] else [x = .5, t = outpoint, seq([u(x, t)][i] = res[i], i = 1 .. 1)] end if catch: error  end try end proc

 

HFloat(0.5), HFloat(0.055328257558693215), HFloat(0.004689999720766375), HFloat(3.97556300083069e-4), HFloat(3.36995780696043e-5), HFloat(2.856605622466751e-6), HFloat(2.4214533681514565e-7), HFloat(2.0525886973034556e-8), HFloat(1.7399138922887997e-9), HFloat(1.4748694270868002e-10), HFloat(1.2501995614273475e-11)

 

HFloat(0.012655008900973756)

 

Int(g, 0. .. .2)

(5)

#
# Note that pdsolve will return the
# 'textbook' power series answer
#
  sol:=pdsolve({EQ,ibc});

u(x, t) = Sum(2*(-1)^(1+_Z2)*sin(_Z2*Pi*x)*exp(-5*Pi^2*_Z2^2*t)/(Pi*_Z2), _Z2 = 1 .. infinity)

(6)

 

 

 


 

Download heatPDE.mw

for n positive, the term 1+1/n is a;ways more tham 1.

So (1+1/n)^n is always more than 1^n ------ and 1^n is always 1

So if I perform the sum(`1, n=0..infinity), then the amswer will be infinity

Therefore the sum( 1+1/n)^n , n=0..infinity) will be rather more than infinity

Is this response useful?

 

You seem to think that the Kronecker Delta function and the Dirac Delta function are synonymous - Errrrrrr No

The Kronecker Delta function is a function of two variables, defined as f(x,y)=piecewise( x=y,1,0).

So you can justifiably expect that f(x,0)=1 if x=0 (or f(0,y)=1 if y=0). However the integral of the Kronecker Delta function is always zero -because (sloppy mathematics!) it has no spatial extent. Think of its integral as a rectangle whose "height\" is 1 and whose "base" is 0 - what is the area? A similar (sloppy) argument will convince you that the product of a |Kronecker Delta and any "sensible" function will always be zero.

Now the (rather naive) definition of the Dirac Delta function is that it is infinite when x=0, and zero otherwise. With this simple-minded definition (sloppy mathematics again), its integral is a rectangle of infinite "height" and zero "base", so its area is zero*infinity - and you get to take your pick what value that should be.

A "more careful" definition of the Dirac Delta function is as the limit as eps->0 of the function which extends from -eps/2 to eps/2 and has height eps. Notice that the "area" of this function is always 1
 

For instance, in the example you provide

define U(x,t)=diff(C(x,t),x) and substitute in the original PDE

then essentially rinse and repeat

At the end you will have four first order PDEs in four dependent functions.. For your example, you could use, the attached. Obviously this code would have to be improvedextended to handle derivatives wrt all variables, mixed derivatives, etc, but so far as I know, this approach always works

restart;
names:=[ C(x,t), U(x,t),V(x,t),W(x,t) ]:
pdeSys:=[ seq(diff(names[j], x)=names[j+1], j=1..3),
         A*diff(C(x,t),t)=-Q*diff(C(x,t),x)+A*E__x*diff(C(x,t),x$2)+epsilon*diff(C(x,t),x$4)
       ];
for j from 1 by 1 to numelems(pdeSys) do
    pdeSys[4]:=subs(pdeSys[j], pdeSys[4]);
od:
pdeSys;

[diff(C(x, t), x) = U(x, t), diff(U(x, t), x) = V(x, t), diff(V(x, t), x) = W(x, t), A*(diff(C(x, t), t)) = -Q*(diff(C(x, t), x))+A*E__x*(diff(diff(C(x, t), x), x))+epsilon*(diff(diff(diff(diff(C(x, t), x), x), x), x))]

 

[diff(C(x, t), x) = U(x, t), diff(U(x, t), x) = V(x, t), diff(V(x, t), x) = W(x, t), -Q*U(x, t)+A*E__x*V(x, t)+epsilon*(diff(W(x, t), x)) = -Q*U(x, t)+A*E__x*V(x, t)+epsilon*(diff(W(x, t), x))]

(1)

 

 


 

Download pdeSub.mw

I'm pretty sure that the attached does what you want, but it wasn't exactly clear in what form you wanted the output - so I guessed.

This will generate an array of plots, and an array of 'integral sums' which yu can access in any appropriate way

loop.mw

 

First 114 115 116 117 118 119 120 Last Page 116 of 157