Rouben Rostamian

MaplePrimes Activity


These are answers submitted by Rouben Rostamian

As an alternative to mmcdara's solution, here is an approach
via differential equations.
Let's write g(x) for the integrand and let f(a) = int(g(x), x = 0 .. a).
You wish to determine a so that the integral evaluates to 0.5.
From the definition of f we have diff(f(x), x) = g(x), f(0) = 0. We may
view this as an initial value problem, and use dsolve()'s  events
option to stop the integration when the integral reaches 0.5.

restart;

g := x -> sqrt(1+(-5.557990765*sin(5.557990765*x)-7.3*cos(5.557990765*x)-5.6*sinh(5.557990765*x)+7.3*cosh(5.557990765*x))^2):

de := diff(f(x),x) = g(x);

diff(f(x), x) = (1+(-5.557990765*sin(5.557990765*x)-7.3*cos(5.557990765*x)-5.6*sinh(5.557990765*x)+7.3*cosh(5.557990765*x))^2)^(1/2)

dsol := dsolve({de,f(0)=0}, numeric, events=[[f(x)=0.5, halt]]);

proc (x_rkf45) local _res, _dat, _vars, _solnproc, _xout, _ndsol, _pars, _n, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 < nargs then error "invalid input: too many arguments" end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x_rkf45) else _xout := evalf(x_rkf45) end if; _dat := Array(1..4, {(1) = proc (_xin) local _xout, _dtbl, _dat, _vmap, _x0, _y0, _val, _dig, _n, _ne, _nd, _nv, _pars, _ini, _par, _i, _j, _k, _src; option `Copyright (c) 2002 by Waterloo Maple Inc. All rights reserved.`; table( [( "complex" ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 26, [( 1 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 2 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 3 ) = ([Array(1..2, 1..21, {(1, 1) = 1.0, (1, 2) = .0, (1, 3) = 1.0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = 1.0, (1, 8) = undefined, (1, 9) = -.5, (1, 10) = 1.0, (1, 11) = undefined, (1, 12) = undefined, (1, 13) = undefined, (1, 14) = undefined, (1, 15) = undefined, (1, 16) = undefined, (1, 17) = undefined, (1, 18) = undefined, (1, 19) = undefined, (1, 20) = undefined, (1, 21) = undefined, (2, 1) = 1.0, (2, 2) = .0, (2, 3) = 100.0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (2, 8) = undefined, (2, 9) = undefined, (2, 10) = 0.10e-6, (2, 11) = undefined, (2, 12) = .0, (2, 13) = undefined, (2, 14) = .0, (2, 15) = .0, (2, 16) = undefined, (2, 17) = undefined, (2, 18) = undefined, (2, 19) = undefined, (2, 20) = undefined, (2, 21) = undefined}, datatype = float[8], order = C_order), proc (x, Y, Ypre, n, EA) EA[1, 7+2*n] := Y[1]-.5; EA[1, 8+2*n] := 1; 0 end proc, proc (e, x, Y, Ypre) return 0 end proc, Array(1..1, 1..2, {(1, 1) = undefined, (1, 2) = undefined}, datatype = float[8], order = C_order)]), ( 4 ) = (Array(1..63, {(1) = 1, (2) = 1, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 1, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0, (50) = 50, (51) = 1, (52) = 0, (53) = 0, (54) = 0, (55) = 0, (56) = 0, (57) = 0, (58) = 0, (59) = 10000, (60) = 0, (61) = 1000, (62) = 0, (63) = 0}, datatype = integer[8])), ( 5 ) = (Array(1..28, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = 0.5047658755841546e-2, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .49999999999999, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = 0.10e-14, (26) = .0, (27) = .0, (28) = .0}, datatype = float[8], order = C_order)), ( 6 ) = (Array(1..1, {(1) = .0}, datatype = float[8], order = C_order)), ( 7 ) = ([Array(1..4, 1..7, {(1, 1) = .0, (1, 2) = .203125, (1, 3) = .3046875, (1, 4) = .75, (1, 5) = .8125, (1, 6) = .40625, (1, 7) = .8125, (2, 1) = 0.6378173828125e-1, (2, 2) = .0, (2, 3) = .279296875, (2, 4) = .27237892150878906, (2, 5) = -0.9686851501464844e-1, (2, 6) = 0.1956939697265625e-1, (2, 7) = .5381584167480469, (3, 1) = 0.31890869140625e-1, (3, 2) = .0, (3, 3) = -.34375, (3, 4) = -.335235595703125, (3, 5) = .2296142578125, (3, 6) = .41748046875, (3, 7) = 11.480712890625, (4, 1) = 0.9710520505905151e-1, (4, 2) = .0, (4, 3) = .40350341796875, (4, 4) = 0.20297467708587646e-1, (4, 5) = -0.6054282188415527e-2, (4, 6) = -0.4770040512084961e-1, (4, 7) = .77858567237854}, datatype = float[8], order = C_order), Array(1..6, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = 1.0, (2, 1) = .25, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = 1.0, (3, 1) = .1875, (3, 2) = .5625, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = 2.0, (4, 1) = .23583984375, (4, 2) = -.87890625, (4, 3) = .890625, (4, 4) = .0, (4, 5) = .0, (4, 6) = .2681884765625, (5, 1) = .1272735595703125, (5, 2) = -.5009765625, (5, 3) = .44921875, (5, 4) = -0.128936767578125e-1, (5, 5) = .0, (5, 6) = 0.626220703125e-1, (6, 1) = -0.927734375e-1, (6, 2) = .626220703125, (6, 3) = -.4326171875, (6, 4) = .1418304443359375, (6, 5) = -0.861053466796875e-1, (6, 6) = .3131103515625}, datatype = float[8], order = C_order), Array(1..6, {(1) = .0, (2) = .386, (3) = .21, (4) = .63, (5) = 1.0, (6) = 1.0}, datatype = float[8], order = C_order), Array(1..6, {(1) = .25, (2) = -.1043, (3) = .1035, (4) = -0.362e-1, (5) = .0, (6) = .0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 1.544, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = .9466785280815533, (3, 2) = .25570116989825814, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = 3.3148251870684886, (4, 2) = 2.896124015972123, (4, 3) = .9986419139977808, (4, 4) = .0, (4, 5) = .0, (5, 1) = 1.2212245092262748, (5, 2) = 6.019134481287752, (5, 3) = 12.537083329320874, (5, 4) = -.687886036105895, (5, 5) = .0, (6, 1) = 1.2212245092262748, (6, 2) = 6.019134481287752, (6, 3) = 12.537083329320874, (6, 4) = -.687886036105895, (6, 5) = 1.0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = -5.6688, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = -2.4300933568337584, (3, 2) = -.20635991570891224, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = -.10735290581452621, (4, 2) = -9.594562251021896, (4, 3) = -20.470286148096154, (4, 4) = .0, (4, 5) = .0, (5, 1) = 7.496443313968615, (5, 2) = -10.246804314641219, (5, 3) = -33.99990352819906, (5, 4) = 11.708908932061595, (5, 5) = .0, (6, 1) = 8.083246795922411, (6, 2) = -7.981132988062785, (6, 3) = -31.52159432874373, (6, 4) = 16.319305431231363, (6, 5) = -6.0588182388340535}, datatype = float[8], order = C_order), Array(1..3, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 10.126235083446911, (2, 2) = -7.487995877607633, (2, 3) = -34.800918615557414, (2, 4) = -7.9927717075687275, (2, 5) = 1.0251377232956207, (3, 1) = -.6762803392806898, (3, 2) = 6.087714651678606, (3, 3) = 16.43084320892463, (3, 4) = 24.767225114183653, (3, 5) = -6.5943891257167815}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..1, {(1) = .1}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, 1..1, {(1, 1) = .0}, datatype = float[8], order = C_order), Array(1..1, 1..1, {(1, 1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, 1..1, {(1, 1) = .0}, datatype = float[8], order = C_order), Array(1..1, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = 0}, datatype = integer[8]), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = 0}, datatype = integer[8])]), ( 8 ) = ([Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = .0}, datatype = float[8], order = C_order), Array(1..1, {(1) = 1.0}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..1, {(1, 1) = .0, (2, 0) = .0, (2, 1) = .0, (3, 0) = .0, (3, 1) = .0, (4, 0) = .0, (4, 1) = .0, (5, 0) = .0, (5, 1) = .0, (6, 0) = .0, (6, 1) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = f(x)]`; YP[1] := evalf((1+(-5.557990765*sin(5.557990765*X)-7.3*cos(5.557990765*X)-5.6*sinh(5.557990765*X)+7.3*cosh(5.557990765*X))^2)^(1/2)); 0 end proc, -1, 0, 0, 0, 0, proc (x, Y, Ypre, n, EA) EA[1, 7+2*n] := Y[1]-.5; EA[1, 8+2*n] := 1; 0 end proc, proc (e, x, Y, Ypre) return 0 end proc, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rkf45"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([0, 0, 0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = f(x)]`; YP[1] := evalf((1+(-5.557990765*sin(5.557990765*X)-7.3*cos(5.557990765*X)-5.6*sinh(5.557990765*X)+7.3*cosh(5.557990765*X))^2)^(1/2)); 0 end proc, -1, 0, 0, 0, 0, proc (x, Y, Ypre, n, EA) EA[1, 7+2*n] := Y[1]-.5; EA[1, 8+2*n] := 1; 0 end proc, proc (e, x, Y, Ypre) return 0 end proc, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 26 ) = (Array(1..0, {})), ( 25 ) = (Array(1..0, {})), ( 24 ) = (0)  ] ))  ] ); _y0 := Array(0..1, {(1) = 0.}); _vmap := array( 1 .. 1, [( 1 ) = (1)  ] ); _x0 := _dtbl[1][5][5]; _n := _dtbl[1][4][1]; _ne := _dtbl[1][4][3]; _nd := _dtbl[1][4][4]; _nv := _dtbl[1][4][16]; if not type(_xout, 'numeric') then if member(_xout, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = "left" then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = "right" then if type(_dtbl[3], 'table') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _xout = "method" then return _dtbl[1][15] elif _xout = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _xout = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = "enginedata" then return eval(_dtbl[1]) elif _xout = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = "initial" then return procname(_y0[0]) elif _xout = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "last" then if _dtbl[4] <> 2 and _dtbl[4] <> 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error "no information is available on last computed point" else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = "function" then if _dtbl[1][4][33]-2. = 0 then return eval(_dtbl[1][10], 1) else return eval(_dtbl[1][10][1], 1) end if elif _xout = "map" then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {"initial", "parameters", "initial_and_parameters"}) then _ini, _par := [], []; if lhs(_xin) = "initial" then _ini := rhs(_xin) elif lhs(_xin) = "parameters" then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) <> [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) < nops(_pars)+1 then error "insufficient data for specification of initial and parameters" else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); _i := false; if _par <> [] then _i := `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini <> [] then _i := `dsolve/numeric/process_initial`(_n-_ne, _ini, _y0, _pars, _vmap) or _i end if; if _i then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, procname, _pars); if _Env_smart_dsolve_numeric = true and type(_y0[0], 'numeric') and _dtbl[1][4][10] <> 1 then procname("right") := _y0[0]; procname("left") := _y0[0] end if end if; if _xout = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)], [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] end if elif _xin = "eventstop" then if _nv = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 <= _dtbl[5-_i][4][9] then _i := 5-_i; _dtbl[4] := _i; _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) elif 100 <= _dtbl[_i][4][9] then _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) else return 0 end if elif _xin = "eventstatus" then if _nv = 0 then error "this solution has no events" end if; _i := [selectremove(proc (a) options operator, arrow; _dtbl[1][3][1][a, 7] = 1 end proc, {seq(_j, _j = 1 .. round(_dtbl[1][3][1][_nv+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _xin = "eventclear" then if _nv = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then error "no events to clear" end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 < _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] < 100 then error "no events to clear" elif _nv < _dtbl[_i][4][9]-100 then error "event error condition cannot be cleared" else _j := _dtbl[_i][4][9]-100; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error "retriggerable events cannot be cleared" end if; _j := round(_dtbl[_i][3][1][_j, 1]); for _k to _nv do if _dtbl[_i][3][1][_k, 1] = _j then if _dtbl[_i][3][1][_k, 2] = 3 then error "range events cannot be cleared" end if; _dtbl[_i][3][1][_k, 8] := _dtbl[_i][3][1][_nv+1, 8] end if end do; _dtbl[_i][4][17] := 0; _dtbl[_i][4][9] := 0; if _dtbl[1][4][10] = 1 then if _i = 2 then try procname(procname("left")) catch:  end try else try procname(procname("right")) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {"eventdisable", "eventenable"}) then if _nv = 0 then error "this solution has no events" end if; if type(rhs(_xin), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _k := {}; for _j to _nv do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_xin) = "eventdisable" then _dtbl[4] := 0; _j := [evalb(assigned(_dtbl[2]) and member(_dtbl[2][4][17], _i)), evalb(assigned(_dtbl[3]) and member(_dtbl[3][4][17], _i))]; for _k in _i do _dtbl[1][3][1][_k, 7] := 0; if assigned(_dtbl[2]) then _dtbl[2][3][1][_k, 7] := 0 end if; if assigned(_dtbl[3]) then _dtbl[3][3][1][_k, 7] := 0 end if end do; if _j[1] then for _k to _nv+1 do if _k <= _nv and not type(_dtbl[2][3][4][_k, 1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to defined init `, _dtbl[2][3][4][_k, 1]); _dtbl[2][3][1][_k, 8] := _dtbl[2][3][4][_k, 1] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to rate hysteresis init `, _dtbl[2][5][24]); _dtbl[2][3][1][_k, 8] := _dtbl[2][5][24] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to initial init `, _x0); _dtbl[2][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to fireinitial init `, _x0-1); _dtbl[2][3][1][_k, 8] := _x0-1 end if end do; _dtbl[2][4][17] := 0; _dtbl[2][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("left")) end if end if; if _j[2] then for _k to _nv+1 do if _k <= _nv and not type(_dtbl[3][3][4][_k, 2], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to defined init `, _dtbl[3][3][4][_k, 2]); _dtbl[3][3][1][_k, 8] := _dtbl[3][3][4][_k, 2] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to rate hysteresis init `, _dtbl[3][5][24]); _dtbl[3][3][1][_k, 8] := _dtbl[3][5][24] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to initial init `, _x0); _dtbl[3][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to fireinitial init `, _x0+1); _dtbl[3][3][1][_k, 8] := _x0+1 end if end do; _dtbl[3][4][17] := 0; _dtbl[3][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("right")) end if end if else for _k in _i do _dtbl[1][3][1][_k, 7] := 1 end do; _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); _dtbl[4] := 0; if _dtbl[1][4][10] = 1 then if _x0 <= procname("right") then try procname(procname("right")) catch:  end try end if; if procname("left") <= _x0 then try procname(procname("left")) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = "eventfired" then if not type(rhs(_xin), 'list') then error "'eventfired' must be specified as a list" end if; if _nv = 0 then error "this solution has no events" end if; if _dtbl[4] <> 2 and _dtbl[4] <> 3 then error "'direction' must be set prior to calling/setting 'eventfired'" end if; _i := _dtbl[4]; _val := NULL; if not assigned(_EnvEventRetriggerWarned) then _EnvEventRetriggerWarned := false end if; for _k in rhs(_xin) do if type(_k, 'integer') then _src := _k elif type(_k, 'integer' = 'anything') and type(evalf(rhs(_k)), 'numeric') then _k := lhs(_k) = evalf[max(Digits, 18)](rhs(_k)); _src := lhs(_k) else error "'eventfired' entry is not valid: %1", _k end if; if _src < 1 or round(_dtbl[1][3][1][_nv+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nv)}; if nops(_src) <> 1 then error "'eventfired' can only be set/queried for root-finding events and time/interval events" end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] <> 0. and _dtbl[1][3][1][_src, 2]-2. <> 0. then error "'eventfired' can only be set/queried for root-finding events and time/interval events" elif irem(round(_dtbl[1][3][1][_src, 4]), 2) = 1 then if _EnvEventRetriggerWarned = false then WARNING(`'eventfired' has no effect on events that retrigger`) end if; _EnvEventRetriggerWarned := true end if; if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then _val := _val, undefined elif type(_dtbl[_i][3][4][_src, _i-1], 'undefined') or _i = 2 and _dtbl[2][3][1][_src, 8] < _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] < _dtbl[3][3][1][_src, 8] then _val := _val, _dtbl[_i][3][1][_src, 8] else _val := _val, _dtbl[_i][3][4][_src, _i-1] end if; if type(_k, `=`) then if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then error "cannot set event code for a rate hysteresis event" end if; userinfo(3, {'events', 'eventreset'}, `manual set event code `, _src, ` to value `, rhs(_k)); _dtbl[_i][3][1][_src, 8] := rhs(_k); _dtbl[_i][3][4][_src, _i-1] := rhs(_k) end if end do; return [_val] elif type(_xin, `=`) and lhs(_xin) = "direction" then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error "'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)" end if; _src := `if`(_dtbl[4] = 2, -1, `if`(_dtbl[4] = 3, 1, undefined)); _i := `if`(member(rhs(_xin), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if; return _src elif _xin = "eventcount" then if _dtbl[1][3][1] = 0 or _dtbl[4] <> 2 and _dtbl[4] <> 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return "procname" end if end if; if _xout = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _n-_ne)] end if; _i := `if`(_x0 <= _xout, 3, 2); if _xin = "last" and 0 < _dtbl[_i][4][9] and _dtbl[_i][4][9] < 100 then _dat := eval(_dtbl[_i], 2); _j := _dat[4][20]; return [_dat[11][_j, 0], seq(_dat[11][_j, _vmap[_i]], _i = 1 .. _n-_ne-_nd), seq(_dat[8][1][_vmap[_i]], _i = _n-_ne-_nd+1 .. _n-_ne)] end if; if not type(_dtbl[_i], 'array') then _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if end if; if _xin <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _n, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, procname, _pars, _i) end if end if; if _dtbl[1][4][7] = 0 then error "parameters must be initialized before solution can be computed" end if end if; _dat := eval(_dtbl[_i], 2); _dtbl[4] := _i; try _src := `dsolve/numeric/SC/IVPrun`(_dat, _xout) catch: userinfo(2, `dsolve/debug`, print(`Exception in solnproc:`, [lastexception][2 .. -1])); error  end try; if _dat[17] <> _dtbl[1][17] then _dtbl[1][17] := _dat[17]; _dtbl[1][10] := _dat[10] end if; if _src = 0 and 100 < _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src <> 0 or _dat[4][9] <= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _xout then Rounding := -infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further right of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further right of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further right of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further right of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _xout < _val then Rounding := infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further left of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further left of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further left of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further left of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; if type(_EnvDSNumericSaveDigits, 'posint') then _dat[4][26] := _EnvDSNumericSaveDigits else _dat[4][26] := Digits end if; _Env_dsolve_SC_native := true; if _dat[4][25] = 1 then _i := 1; _dat[4][25] := 2 else _i := _dat[4][25] end if; _val := `dsolve/numeric/SC/IVPval`(_dat, _xout, _src); _dat[4][25] := _i; _dat[4][26] := _dig; [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _xout, _src); [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] end if end proc, (2) = Array(0..0, {}), (3) = [x, f(x)], (4) = []}); _vars := _dat[3]; _pars := map(rhs, _dat[4]); _n := nops(_vars)-1; _solnproc := _dat[1]; if not type(_xout, 'numeric') then if member(x_rkf45, ["start", 'start', "method", 'method', "left", 'left', "right", 'right', "leftdata", "rightdata", "enginedata", "eventstop", 'eventstop', "eventclear", 'eventclear', "eventstatus", 'eventstatus', "eventcount", 'eventcount', "laxtol", 'laxtol', "numfun", 'numfun', NULL]) then _res := _solnproc(convert(x_rkf45, 'string')); if 1 < nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res <> "procname" then return _res end if elif member(x_rkf45, ["last", 'last', "initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(x_rkf45, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(x_rkf45), 'string') = rhs(x_rkf45); if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else error "initial and/or parameter values must be specified in a list" end if; if lhs(_xout) = "initial" then return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["eventdisable", 'eventdisable', "eventenable", 'eventenable', "eventfired", 'eventfired', "direction", 'direction', NULL]) then return _solnproc(convert(lhs(x_rkf45), 'string') = rhs(x_rkf45)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _vars end if; if procname <> unknown then return ('procname')(x_rkf45) else _ndsol := 1; _ndsol := _ndsol; _ndsol := pointto(_dat[2][0]); return ('_ndsol')(x_rkf45) end if end if; try _res := _solnproc(_xout); [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] catch: error  end try end proc

plots:-odeplot(dsol, x=0..1):

Warning, cannot evaluate the solution further right of .15500879, event #1 triggered a halt

So at x = .155 .. () we hit the target.  Let's verify that indeed the integral reaches 0.5
at that point:

evalf(Int(g(x), x=0 .. 0.15500879));

.4999999462


 

Download mw.mw

This question has been answered before.  See:

https://www.mapleprimes.com/questions/227376-Imaginary-To-Real

I can tell you how things work under Linux.  They should not be very different under Windows.

Maple's system() and ssystem() functions pass their arguments as commands to the underlying operating system for execution. System() returns the command's exit status (usually 0 for success), while ssystem() returns to command's output as a Maple string. If I understand you correctly, you are interested in system(), or rather more specifically, in system[launch](), where the launch option spawns a new process, and therefore Maple does not wait for the command's termination.

For instance, to open a new terminal and set its title to "My title", I would type on the Linux commandline (not in Maple) the command:

xterm -title "My title"

To do the same from within Maple, I would do:

system[launch]("xterm", "-title", "My title");

The first argument (xterm) is the command to be executed.  The remaining arguments are options passed to that command.

Things should work similarly under Windows but note that system()'s help page says that under Windows "The given command should specify an application or executable file, not a shell or DOS command". See what you can do.

 

Your conjecture is almost correct, but not quite.

 

I will paraphrase your statement and show how to analyze it.

 

You have a system of differential equations:

restart;

[-p[1]*x[1]^2+x[2], -2*p[1]^2*x[1]^3+2*p[1]*x[1]*x[2]+x[1]+1]:
f := unapply(%, [x[1],x[2]]):
diff~([x[1](t), x[2](t)], t) =~ f(x[1](t), x[2](t)):
sys := %[];

diff(x[1](t), t) = -x[1](t)^2*p[1]+x[2](t), diff(x[2](t), t) = -2*x[1](t)^3*p[1]^2+2*x[1](t)*x[2](t)*p[1]+x[1](t)+1

and initial conditions

ic := x[1](0) = p[2], x[2](0) = p[3];

x[1](0) = p[2], x[2](0) = p[3]

The system may be solved symbolically.  We don't need numerics:

dsolve({sys, ic}, {x[1](t), x[2](t)}):
dsol := convert(%, trigh);

{x[1](t) = (p[2]+1)*cosh(t)-1+(-p[1]*p[2]^2+p[3])*sinh(t), x[2](t) = (p[2]+1)^2*p[1]*cosh(t)^2+(-2*(p[1]*p[2]^2-p[3])*(p[2]+1)*p[1]*sinh(t)-p[2]^2*p[1]-2*p[1]*p[2]-2*p[1]+p[3])*cosh(t)+(p[1]*p[2]^2-p[3])^2*p[1]*sinh(t)^2+(2*p[1]^2*p[2]^2-2*p[1]*p[3]+p[2]+1)*sinh(t)+p[1]}

You are interested in the following special choice of parameters,
where k is a positive integer:

params := p[1]=k, p[2]=2, p[3]=4*k-1;

p[1] = k, p[2] = 2, p[3] = 4*k-1

so we evaluate the solution with those parameters:

mydsol := eval(dsol, [p[1]=k, p[2]=2, p[3]=4*k-1]);

{x[1](t) = 3*cosh(t)-1-sinh(t), x[2](t) = 9*k*cosh(t)^2+(-6*k*sinh(t)-6*k-1)*cosh(t)+k*sinh(t)^2+(8*k^2-2*k*(4*k-1)+3)*sinh(t)+k}

 

As you have conjectured correctly, x1(t) is independent of k.  That's good!

You have also conjectured that

x__2(t)*`|at any k` = k*x__2(t)*`|at k=1`

That conjecture is true asymptotically for large values of t but it
breaks down for small .

To see that, we calculate:

B := eval(x[2](t), mydsol):  # x[2](t) at any k
A := eval(B, k=1):           # x[2](t) at k=1
R := unapply(B/A, k);        # their ratio

 

 

proc (k) options operator, arrow; (9*k*cosh(t)^2+(-6*k*sinh(t)-6*k-1)*cosh(t)+k*sinh(t)^2+(8*k^2-2*k*(4*k-1)+3)*sinh(t)+k)/(9*cosh(t)^2+(-6*sinh(t)-7)*cosh(t)+sinh(t)^2+5*sinh(t)+1) end proc

For large t the ratio approaches k, so the conjecture is almost true in that sense:

limit(R(k), t=infinity);

k

but for small k the ratio is different fromk -- it oscillates a little before it approaches k

plot([seq(R(k), k=1..5)], t=0..8, view=0..7);


 

Download mw.mw

Increase computational accuracy by specifying a larger value for Digits, as in:
 

Digits := 20;

The the result will be 9.96087e+16.both in GUI and terminal.

In the absence of further information, this is the best that can be done.  A good answer can be very different depending on how you want to use the result.

# returns 0 if b is even, else 1
if_odd := b -> `if`(type(b,even),0,1):
# answer
ans := 4*theta[j]/N*Sum(Sum('if_odd(n+l)'*n*theta[n]/c[l]*T[n](x[j])*T[l](x[k]),
   l=0..n-1), n=0..N);

 

This is pretty much like Kitonum's but just a little more compact:

Eq := v1(t) - R1*(-i3(t)/n13 - i2(t)/n12) - L1*diff(-i3(t)/n13 - i2(t)/n12, t) = n12*(v2(t) - R2*i2(t) - L2*diff(i2(t), t));
expand(lhs(Eq) - rhs(Eq)):
select(has, %, diff) = -remove(has, %, diff):
collect(%, diff);

 

Plot EQ:

plot(EQ, x=0.9e8..1.1e8, discont=true);

We see that the graph jumps from a negative value to a positive value at 1e8.  There is no intersection with the x axis, therefore no root.

Depending on your application, there may be reason to take 1e8 as a root, but that justification, if there is one, is external to mathematics.

 

The functions Q(x, z, t) and W(x, z, t) satisfy your PDEs.  Let's introduce the
auxiliary functions phi(x, z, t) and psi(x, z, t) as the laplacians of Q and W:
"phi(x,z,t)=((&PartialD;)^(2 )W)/((&PartialD;)^( )x^2)+((&PartialD;)^(2 )W)/((&PartialD;)^( )z^2)",
"psi(x,z,t)=((&PartialD;)^(2 )Q)/((&PartialD;)^( )x^2)+((&PartialD;)^(2 )Q)/((&PartialD;)^( )z^2)".
I will show that phi and psi satisfy the wave equations
"((&PartialD;)^2phi)/((&PartialD;)^( )t^2)=mu/(rho)(((&PartialD;)^2phi)/((&PartialD;)^( )x^2)+((&PartialD;)^2phi)/((&PartialD;)^( )z^2)),"
"((&PartialD;)^2psi)/((&PartialD;)^( )t^2)=(lambda+2 mu)/(rho)(((&PartialD;)^2psi)/((&PartialD;)^( )x^2)+((&PartialD;)^2psi)/((&PartialD;)^( )z^2)),"
Here is how.

restart;

pde1 := rho*(diff(diff(Q(x,z,t),t,t),x)) + rho*(diff(diff(W(x,z,t),t,t),z))
      - (lambda+2*mu)*(diff(diff(Q(x,z,t),x,x) + diff(Q(x,z,t),z,z),x))
      -            mu*(diff(diff(W(x,z,t),x,x) + diff(W(x,z,t),z,z),z)) = 0;

rho*(diff(diff(diff(Q(x, z, t), t), t), x))+rho*(diff(diff(diff(W(x, z, t), t), t), z))-(lambda+2*mu)*(diff(diff(diff(Q(x, z, t), x), x), x)+diff(diff(diff(Q(x, z, t), x), z), z))-mu*(diff(diff(diff(W(x, z, t), x), x), z)+diff(diff(diff(W(x, z, t), z), z), z)) = 0

pde2 := rho*(diff(diff(Q(x,z,t),t,t),z)) - rho*(diff(diff(W(x,z,t),t,t), x))
      - (lambda+2*mu)*(diff(diff(Q(x,z,t),x,x) + diff(Q(x,z,t),z,z),z))
      +            mu*(diff(diff(W(x,z,t),x,x) + diff(W(x,z,t),z,z),x)) = 0;

rho*(diff(diff(diff(Q(x, z, t), t), t), z))-rho*(diff(diff(diff(W(x, z, t), t), t), x))-(lambda+2*mu)*(diff(diff(diff(Q(x, z, t), x), x), z)+diff(diff(diff(Q(x, z, t), z), z), z))+mu*(diff(diff(diff(W(x, z, t), x), x), x)+diff(diff(diff(W(x, z, t), x), z), z)) = 0

Following Edgardo's tip we apply casesplit() with the optional argument [Q,W]:

casesplit1 := PDEtools:-casesplit([pde1,pde2], [Q,W]);

`casesplit/ans`([diff(diff(diff(Q(x, z, t), x), x), x) = (-lambda*(diff(diff(diff(Q(x, z, t), x), z), z))-2*mu*(diff(diff(diff(Q(x, z, t), x), z), z))-mu*(diff(diff(diff(W(x, z, t), x), x), z))-mu*(diff(diff(diff(W(x, z, t), z), z), z))+rho*(diff(diff(diff(Q(x, z, t), t), t), x))+rho*(diff(diff(diff(W(x, z, t), t), t), z)))/(lambda+2*mu), diff(diff(diff(Q(x, z, t), x), x), z) = (rho*(diff(diff(diff(Q(x, z, t), t), t), z))-rho*(diff(diff(diff(W(x, z, t), t), t), x))-lambda*(diff(diff(diff(Q(x, z, t), z), z), z))-2*mu*(diff(diff(diff(Q(x, z, t), z), z), z))+mu*(diff(diff(diff(W(x, z, t), x), x), x))+mu*(diff(diff(diff(W(x, z, t), x), z), z)))/(lambda+2*mu), diff(diff(diff(diff(W(x, z, t), x), x), x), x) = (rho*(diff(diff(diff(diff(W(x, z, t), t), t), x), x))-2*mu*(diff(diff(diff(diff(W(x, z, t), x), x), z), z))-mu*(diff(diff(diff(diff(W(x, z, t), z), z), z), z))+rho*(diff(diff(diff(diff(W(x, z, t), t), t), z), z)))/mu], [])

Pick the last equation returned by casesplit:

op([1,-1],casesplit1):
rhs(%) - lhs(%):
Eq1_tmp := expand(%*mu/rho);

diff(diff(diff(diff(W(x, z, t), t), t), x), x)-2*mu*(diff(diff(diff(diff(W(x, z, t), x), x), z), z))/rho-mu*(diff(diff(diff(diff(W(x, z, t), z), z), z), z))/rho+diff(diff(diff(diff(W(x, z, t), t), t), z), z)-mu*(diff(diff(diff(diff(W(x, z, t), x), x), x), x))/rho

In terms of the function "phi, "the above leads to the following wave equation with the wave speed sqrt(mu/rho):

Eq1 := diff(phi(x,z,t), t,t) = mu/rho * (diff(phi(x,z,t),x,x) +diff(phi(x,z,t),z,z));

diff(diff(phi(x, z, t), t), t) = mu*(diff(diff(phi(x, z, t), x), x)+diff(diff(phi(x, z, t), z), z))/rho

Let's verify that Eq1_tmp and Eq1 are equivalent:

lhs(Eq1)-rhs(Eq1) - Eq1_tmp:
simplify(%, {phi(x,z,t)=diff(W(x,z,t),x,x) + diff(W(x,z,t),z,z)});

0

OK, they are.  Now apply casesplit() once again, but this time with the reversed optional argument:

casesplit2 := PDEtools:-casesplit([pde1,pde2], [W,Q]);

`casesplit/ans`([diff(diff(diff(W(x, z, t), x), x), x) = (-rho*(diff(diff(diff(Q(x, z, t), t), t), z))+rho*(diff(diff(diff(W(x, z, t), t), t), x))+lambda*(diff(diff(diff(Q(x, z, t), x), x), z))+2*mu*(diff(diff(diff(Q(x, z, t), x), x), z))+lambda*(diff(diff(diff(Q(x, z, t), z), z), z))+2*mu*(diff(diff(diff(Q(x, z, t), z), z), z))-mu*(diff(diff(diff(W(x, z, t), x), z), z)))/mu, diff(diff(diff(W(x, z, t), x), x), z) = (rho*(diff(diff(diff(W(x, z, t), t), t), z))+rho*(diff(diff(diff(Q(x, z, t), t), t), x))-mu*(diff(diff(diff(W(x, z, t), z), z), z))-lambda*(diff(diff(diff(Q(x, z, t), x), x), x))-2*mu*(diff(diff(diff(Q(x, z, t), x), x), x))-lambda*(diff(diff(diff(Q(x, z, t), x), z), z))-2*mu*(diff(diff(diff(Q(x, z, t), x), z), z)))/mu, diff(diff(diff(diff(Q(x, z, t), x), x), x), x) = (rho*(diff(diff(diff(diff(Q(x, z, t), t), t), x), x))-2*lambda*(diff(diff(diff(diff(Q(x, z, t), x), x), z), z))-4*mu*(diff(diff(diff(diff(Q(x, z, t), x), x), z), z))-lambda*(diff(diff(diff(diff(Q(x, z, t), z), z), z), z))-2*mu*(diff(diff(diff(diff(Q(x, z, t), z), z), z), z))+rho*(diff(diff(diff(diff(Q(x, z, t), t), t), z), z)))/(lambda+2*mu)], [])

Pick the last equation returned by casesplit:

op([1,-1],casesplit2):
rhs(%) - lhs(%):
%*(lambda+2*mu):
Eq2_tmp := simplify(%, size);

(-lambda-2*mu)*(diff(diff(diff(diff(Q(x, z, t), x), x), x), x))+(-4*mu-2*lambda)*(diff(diff(diff(diff(Q(x, z, t), x), x), z), z))+(-lambda-2*mu)*(diff(diff(diff(diff(Q(x, z, t), z), z), z), z))+rho*(diff(diff(diff(diff(Q(x, z, t), t), t), x), x)+diff(diff(diff(diff(Q(x, z, t), t), t), z), z))

In terms of the function psi the above leads to the following wave equation with the wave speed sqrt((lambda+2*mu)/rho):

Eq2 := diff(psi(x,z,t), t,t) = (lambda+2*mu)/rho * (diff(psi(x,z,t),x,x) +diff(psi(x,z,t),z,z));

diff(diff(psi(x, z, t), t), t) = (lambda+2*mu)*(diff(diff(psi(x, z, t), x), x)+diff(diff(psi(x, z, t), z), z))/rho

Let's verify that Eq2_tmp and Eq2 are equivalent:

lhs(Eq2)-rhs(Eq2) - Eq2_tmp/rho:
simplify(%, {psi(x,z,t)=diff(Q(x,z,t),x,x) + diff(Q(x,z,t),z,z)});

0


 

Download mw.mw

You may view (but not edit) the HTML code of any web page (not only MaplePrimes) by pressing Ctrl and U keys simultaneously.  This works on Firefox and Chromebrowser.  I suspect that it will work similarly on other browsers.

Beware that the code shown is that of the complete web page, including the navigation bar and the side boxes.  The text of your message would be a very small part of the whole thing.  You may search for an identifiable string within that page to locate your message within it.  In viewing the source code of your current message, I searched for "observe" and located the message part immediately.  It reads:

<span id="ctl00_MainContent_body" class="mainBody document"><p>When writing a post on MaplePrimes it is possible to access the source code, which allows to introduce/edit many attributes. Is it possible to observe the source of another post?</p>

 

While I was writing my solution, Carl Love posted his.  I am posing my writeup anyway since its comments may be helpful to you.

You have this initial-boundary-value problem in the unknown u(t, x):
"(&PartialD; u)/(&PartialD; t)=-(&PartialD; u)/(&PartialD; x)+g(t,x)",
"u(0,x)=f(x), u(t,0) = alpha(t),"
which you wish to solve it through Picard iterations.  To do that, we
integrate the PDE with respect to t

"u(t,x)=f(x)-(&int;)[0]^(t)(&PartialD; u(s,x))/(&PartialD; x)- g(s,x) &DifferentialD;s, "
and then set up the following two-step Picard iteration scheme
step 1:   u__n(t, x) = f(x)-(int(`&PartialD;`(`u__n-1`(s, x))/`&PartialD;`(x)-g(s, x), s = 0 .. t))
step 2:   u__n(t, x) = u__n(t, x)-u__n(t, 0)+alpha(t)
with "n=1,2,..., "and an arbitrary initial guess u__0(x).

Important!  This iteration scheme implies that "`u__n`(t,0)=alpha(t),"
which is good, but u__n(0, x) = f(x)-f(0)+alpha(0), which is not good.
Getting the desired initial condition u__n(0, x) = f(x) requires
the compatibility condition f(0) = alpha(0) to hold!

The proc doit()  implements the iteration scheme.  It receives a u
and returns the next u.

restart;

doit := proc(u::procedure)
  # next line needs to be fixed.  See note at the bottom.

  f(x) - int(D[2](u[n-1])(s,x) - g(s,x), s=0..t);
  eval(%, x=0) - alpha(t);
  return unapply(%%-%, [t,x]);
end proc:

Let's apply this to your specific problem with an arbitrarily picked

initial guess of u__0(t, x) = t*x^4.

g := (t,x) -> 2 + t + x;

proc (t, x) options operator, arrow; 2+t+x end proc

f := x -> 1 + x;

proc (x) options operator, arrow; x+1 end proc

alpha := t -> 1 + t;

proc (t) options operator, arrow; t+1 end proc

Verify compatibility:

is(f(0)=alpha(0));

true

Now iterate:

u[0] := (t,x) -> t*x^4;
for n from 1 to 5 do
  u[n] := doit(u[n-1]);
end do;

proc (t, x) options operator, arrow; t*x^4 end proc

proc (t, x) options operator, arrow; x+1-(1/2)*(4*x^3-1)*t^2+x*t+t-(1/2)*t^2 end proc

proc (t, x) options operator, arrow; 2*t^3*x^2+x*t+t+x+1 end proc

proc (t, x) options operator, arrow; -t^4*x+x*t+t+x+1 end proc

proc (t, x) options operator, arrow; x*t+t+x+1 end proc

proc (t, x) options operator, arrow; x*t+t+x+1 end proc

In this particular case the iteration arrives at the exact answer
at step u__4 since u__5 = u__4.

You should be able to verify by hand that u__4 satisfies the PDE as well
as the initial and boundary conditions.

 

Note added later:
The line printed in green is wrong -- it produces the correct result purely by accident.  It should have been:
f(x) - int(D[2](u)(s,x) - g(s,x), s=0..t);
You will need to fix that line in the attached worksheet.

 

Download picard-for-pde.mw

restart;

with(PDEtools):

The original PDE

pde := diff(c(z,t),t) + diff(w*c(z,t),z) = diff(c(z,t),z,z);

diff(c(z, t), t)+w*(diff(c(z, t), z)) = diff(diff(c(z, t), z), z)

The space domain is the shrinking interval w*t, h.

ibc := { c(z,0)=0, c(w*t,t)=cs, D[1](c)(h,t)=0 };

{c(z, 0) = 0, c(w*t, t) = cs, (D[1](c))(h, t) = 0}

Change the space variable from z to Z, where Z lives in the fixed interval 0, 1.
The transformation is "z=Z*h + (1-Z)*w*t."
Then Z = 0 corresponds to z = w*t,  and Z = 1 corresponds to z = h.

change_of_vars := {z=Z*h+(1-Z)*w*t, c(z,t)=C(Z,t)};

{z = Z*h+(1-Z)*w*t, c(z, t) = C(Z, t)}

Here is the transformed PDE

PDE := dchange(change_of_vars, pde, [C(Z,t), Z]);

diff(C(Z, t), t)+w*(diff(C(Z, t), Z))/(-t*w+h) = (diff(diff(C(Z, t), Z), Z))/(-t*w+h)^2

and here are the transformed initial and boundary conditions:

IBC := dchange(change_of_vars, ibc, [C(Z,t), Z]);

{(D[1](C))(1, t)/(-t*w+h) = 0, C(0, t) = cs, C(Z, 0) = 0}

I pick some arbitrary values for the parameters.  Change as needed.

w := 0.5: h := 1:  cs := 1:
pdsol := pdsolve(PDE, IBC, numeric, spacestep=0.01):

Here is the plot of the concentration in the Z, t variables:

p := pdsol:-plot3d(C(Z,t), Z=0..1, t=0..1, orientation=[-45,60,0]);

Apply the transformation z = Z*h+(1-Z)*w*t to obtain the plot of the
concentration in the originalz, t variables.

plottools:-transform((Z,t,C)->[Z*h + (1-Z)*w*t, t, C])(p):
plots:-display(%, labels=[z,t,c],
    shading=zhue, style=surfacecontour, orientation=[-45,60,0]);


 

Download mw.mw

Consider an ODE of the form diff(x(t), t) = f(x(t), mu) for the unknown x(t), where mu is a parameter.
We wish to make a 3D plot of the solution x as a function of t and mu.

To do that, view the ODE as a PDE in the unknown x(t, mu), that is, "(&PartialD; x)/(&PartialD; t)=f(x,mu)".  Solve that
PDE, and then 3D-plot the solution "x(t,mu)."  Here is how it works.

restart;

Your ODE is

diff(B[1](t),t) = piecewise(t < 1000, kaC*(R-B[1](t)) - kd1*B[1](t), -kd1*B[1](t));

diff(B[1](t), t) = piecewise(t < 1000, kaC*(R-B[1](t))-kd1*B[1](t), -kd1*B[1](t))

Arrange the right-hand side of the ODE into the form A__1(t)+A__2(t)*B__1(t) because
that's what pdsolve() prefers.

de := diff(B[1](t,kd1),t) = piecewise(t<1000, kaC*R,0)
                           -piecewise(t<1000, kaC+kd1, kd1)*B[1](t,kd1);

de := diff(B[1](t, kd1), t) = piecewise(t < 1000, kaC*R, 0)-piecewise(t < 1000, kaC+kd1, kd1)*B[1](t, kd1)

Pick your initial condition.  Change as needed..

ic := B[1](0,kd1) = 0;

B[1](0, kd1) = 0

Fix the values of R and kaC:

myde := eval(de, {R=1, kaC=6e-1});

myde := diff(B[1](t, kd1), t) = piecewise(t < 1000, .6, 0)-piecewise(t < 1000, .6+kd1, kd1)*B[1](t, kd1)

Solve the PDE:

pdsol := pdsolve(myde, {ic}, numeric, time=0..2000, range=0..1);

_m139769764691840

pdsol:-plot3d(t=0..2000, kd1=0..1);


 

Download mw.mw

Looking at your maplee.docx file, it appears that you are
interested in solving

diff(f(eta), eta, eta, eta)+f(eta)*(diff(f(eta), eta, eta)) = 0, where f = f(eta),

with the boundary conditions
"(lim)f '(eta)=0",  "  (lim)f '(eta)=1",     limit(-eta*f+eta, eta = infinity) = 0.

If so, then there is no reason to appeal to shooting.
Let Maple's dsolve() do the work.

restart;

de := diff(f(eta), eta$3) + diff(f(eta), eta$2)*f(eta) = 0;

diff(diff(diff(f(eta), eta), eta), eta)+(diff(diff(f(eta), eta), eta))*f(eta) = 0

a := 10;  # surrogate for infinity

10

dsol := dsolve({de, D(f)(-a)=0, D(f)(a)=1, f(a)=a}, numeric);

proc (x_bvp) local res, data, solnproc, _ndsol, outpoint, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x_bvp) else outpoint := evalf(x_bvp) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(27, {(1) = -10.0, (2) = -9.232690925174811, (3) = -8.400948293356127, (4) = -7.568968590305362, (5) = -6.737727888889229, (6) = -5.907313057964531, (7) = -5.078204592534601, (8) = -4.251594150448721, (9) = -3.429391562535225, (10) = -2.6141287117372447, (11) = -1.8085471664745767, (12) = -1.0149443418684818, (13) = -.23460448462138273, (14) = .5322867133237555, (15) = 1.286245362574061, (16) = 2.0299285351172367, (17) = 2.7657746379629105, (18) = 3.4960588686445333, (19) = 4.222709593140783, (20) = 4.9471575201173215, (21) = 5.670371337996262, (22) = 6.392927283827333, (23) = 7.1151455505991725, (24) = 7.8371254600843265, (25) = 8.558285432902858, (26) = 9.279151313463982, (27) = 10.0}, datatype = float[8], order = C_order); Y := Matrix(27, 3, {(1, 1) = -.8738699745131914, (1, 2) = .0, (1, 3) = 0.19453618355416916e-3, (2, 1) = -.8737974379458486, (2, 2) = 0.2126559515304102e-3, (2, 3) = 0.38036413282775076e-3, (3, 1) = -.8734503794278492, (3, 2) = 0.6777103278353436e-3, (3, 3) = 0.7866519226334487e-3, (4, 1) = -.8725343958452793, (4, 2) = 0.1639670425821428e-2, (4, 3) = 0.16264464956168914e-2, (5, 1) = -.8704450947492267, (5, 2) = 0.3624927883294863e-2, (5, 3) = 0.335660042998554e-2, (6, 1) = -.8659405026702968, (6, 2) = 0.7710994731576229e-2, (6, 3) = 0.6904143252000777e-2, (7, 1) = -.8564897103613516, (7, 2) = 0.16073894873647625e-1, (7, 3) = 0.14106526134330544e-1, (8, 1) = -.8370205542219876, (8, 2) = 0.3299189209715141e-1, (8, 3) = 0.2843241617985271e-1, (9, 1) = -.7976730782373457, (9, 2) = 0.6644809848653324e-1, (9, 3) = 0.557806032742662e-1, (10, 1) = -.7203134591786324, (10, 2) = .12985832536945638, (10, 3) = .10392802789486236, (11, 1) = -.5747724484150437, (11, 2) = .2412044745700165, (11, 3) = .17615298103946722, (12, 1) = -.31941706728599945, (12, 2) = .41268706362224855, (12, 3) = .253453131738646, (13, 1) = 0.8460907160454192e-1, (13, 2) = .6265186144300298, (13, 3) = .2808159637909694, (14, 1) = .6433980071002114, (14, 2) = .8221742083467642, (14, 3) = .21447524251902275, (15, 1) = 1.3137106766127817, (15, 2) = .9417404576451969, (15, 3) = .10313792024850699, (16, 1) = 2.034509148074173, (16, 2) = .9876095153044471, (16, 3) = 0.2975926876438234e-1, (17, 1) = 2.7662734631043637, (17, 2) = .9983401352762191, (17, 3) = 0.5090030834695261e-2, (18, 1) = 3.4960935964279356, (18, 2) = .9998619837867148, (18, 3) = 0.5172370314613091e-3, (19, 1) = 4.222711112789611, (19, 2) = .9999929502456798, (19, 3) = 0.31293924121315814e-4, (20, 1) = 4.947157561890147, (20, 2) = .999999778465008, (20, 3) = 0.1136651162622266e-5, (21, 1) = 5.670371338671851, (21, 2) = .9999999959678437, (21, 3) = 0.23487052888232733e-7, (22, 1) = 6.392927283836079, (22, 2) = .9999999999485296, (22, 3) = 0.3247918498716828e-9, (23, 1) = 7.115145550598878, (23, 2) = 1.0000000000040963, (23, 3) = -0.2718938301063687e-10, (24, 1) = 7.837125460084901, (24, 2) = .9999999999982201, (24, 3) = 0.1158736274671473e-10, (25, 1) = 8.558285432902982, (25, 2) = 1.0000000000005311, (25, 3) = -0.5177298091061657e-11, (26, 1) = 9.27915131346414, (26, 2) = .9999999999995605, (26, 3) = 0.2484296054720659e-11, (27, 1) = 10.0, (27, 2) = 1.0, (27, 3) = -0.12649772507404847e-11}, datatype = float[8], order = C_order); YP := Matrix(27, 3, {(1, 1) = .0, (1, 2) = 0.19453618355416916e-3, (1, 3) = 0.16999932976437534e-3, (2, 1) = 0.2126559515304102e-3, (2, 2) = 0.38036413282775076e-3, (2, 3) = 0.33236120475138304e-3, (3, 1) = 0.6777103278353436e-3, (3, 2) = 0.7866519226334487e-3, (3, 3) = 0.6871014203018328e-3, (4, 1) = 0.1639670425821428e-2, (4, 2) = 0.16264464956168914e-2, (4, 3) = 0.1419130510427756e-2, (5, 1) = 0.3624927883294863e-2, (5, 2) = 0.335660042998554e-2, (5, 3) = 0.29217363793140588e-2, (6, 1) = 0.7710994731576229e-2, (6, 2) = 0.6904143252000777e-2, (6, 3) = 0.597857727814529e-2, (7, 1) = 0.16073894873647625e-1, (7, 2) = 0.14106526134330544e-1, (7, 3) = 0.12082094482997605e-1, (8, 1) = 0.3299189209715141e-1, (8, 2) = 0.2843241617985271e-1, (8, 3) = 0.23798516748730524e-1, (9, 1) = 0.6644809848653324e-1, (9, 2) = 0.557806032742662e-1, (9, 3) = 0.4449468551972008e-1, (10, 1) = .12985832536945638, (10, 2) = .10392802789486236, (10, 3) = 0.7486075727856172e-1, (11, 1) = .2412044745700165, (11, 2) = .17615298103946722, (11, 3) = .10124788020766334, (12, 1) = .41268706362224855, (12, 2) = .253453131738646, (12, 3) = 0.8095725603441037e-1, (13, 1) = .6265186144300298, (13, 2) = .2808159637909694, (13, 3) = -0.23759577988088584e-1, (14, 1) = .8221742083467642, (14, 2) = .21447524251902275, (14, 3) = -.13799294360907377, (15, 1) = .9417404576451969, (15, 2) = .10313792024850699, (15, 3) = -.13549338699410124, (16, 1) = .9876095153044471, (16, 2) = 0.2975926876438234e-1, (16, 3) = -0.6054550454113386e-1, (17, 1) = .9983401352762191, (17, 2) = 0.5090030834695261e-2, (17, 3) = -0.14080417224400456e-1, (18, 1) = .9998619837867148, (18, 2) = 0.5172370314613091e-3, (18, 3) = -0.18083090735272773e-2, (19, 1) = .9999929502456798, (19, 2) = 0.31293924121315814e-4, (19, 3) = -0.13214520114987515e-3, (20, 1) = .999999778465008, (20, 2) = 0.1136651162622266e-5, (20, 3) = -0.562319239439797e-5, (21, 1) = .9999999959678437, (21, 2) = 0.23487052888232733e-7, (21, 3) = -0.1331803115273048e-6, (22, 1) = .9999999999485296, (22, 2) = 0.3247918498716828e-9, (22, 3) = -0.2076370678612273e-8, (23, 1) = 1.0000000000040963, (23, 2) = -0.2718938301063687e-10, (23, 3) = 0.19345641755166163e-9, (24, 1) = .9999999999982201, (24, 2) = 0.1158736274671473e-10, (24, 3) = -0.9081161559751732e-10, (25, 1) = 1.0000000000005311, (25, 2) = -0.5177298091061657e-11, (25, 3) = 0.44308794834529397e-10, (26, 1) = .9999999999995605, (26, 2) = 0.2484296054720659e-11, (26, 3) = -0.23052158999194988e-10, (27, 1) = 1.0, (27, 2) = -0.12649772507404847e-11, (27, 3) = 0.12649772507404847e-10}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(27, {(1) = -10.0, (2) = -9.232690925174811, (3) = -8.400948293356127, (4) = -7.568968590305362, (5) = -6.737727888889229, (6) = -5.907313057964531, (7) = -5.078204592534601, (8) = -4.251594150448721, (9) = -3.429391562535225, (10) = -2.6141287117372447, (11) = -1.8085471664745767, (12) = -1.0149443418684818, (13) = -.23460448462138273, (14) = .5322867133237555, (15) = 1.286245362574061, (16) = 2.0299285351172367, (17) = 2.7657746379629105, (18) = 3.4960588686445333, (19) = 4.222709593140783, (20) = 4.9471575201173215, (21) = 5.670371337996262, (22) = 6.392927283827333, (23) = 7.1151455505991725, (24) = 7.8371254600843265, (25) = 8.558285432902858, (26) = 9.279151313463982, (27) = 10.0}, datatype = float[8], order = C_order); Y := Matrix(27, 3, {(1, 1) = -0.8430463960375806e-10, (1, 2) = .0, (1, 3) = 0.6372865716221984e-11, (2, 1) = -0.7278369204253125e-10, (2, 2) = 0.1597206925078892e-10, (2, 3) = 0.24052089989356827e-10, (3, 1) = -0.53829300642653995e-10, (3, 2) = 0.3900449379747658e-10, (3, 3) = 0.4808201125108471e-10, (4, 1) = -0.4953774824535353e-10, (4, 2) = 0.45113087361062455e-10, (4, 3) = 0.5272889316948668e-10, (5, 1) = -0.12035755690995432e-9, (5, 2) = -0.27735040596012685e-10, (5, 3) = -0.2587682090031095e-10, (6, 1) = -0.3348786263069427e-9, (6, 2) = -0.2451273076111555e-9, (6, 3) = -0.25162616591548056e-9, (7, 1) = -0.5269956859085185e-9, (7, 2) = -0.42674669378525426e-9, (7, 3) = -0.4325686117487571e-9, (8, 1) = 0.20412785836243726e-9, (8, 2) = 0.296577932431626e-9, (8, 3) = 0.28017398315903054e-9, (9, 1) = 0.24926163090190593e-8, (9, 2) = 0.2127611241294755e-8, (9, 3) = 0.17897368469198382e-8, (10, 1) = 0.5632465773934123e-9, (10, 2) = -0.9260334379037399e-9, (10, 3) = -0.15545759151451124e-8, (11, 1) = -0.9881440672433423e-8, (11, 2) = -0.6775803922126295e-8, (11, 3) = -0.30684471502496324e-8, (12, 1) = 0.23811084513591336e-8, (12, 2) = 0.8938239872691941e-8, (12, 3) = 0.6981346856881195e-8, (13, 1) = 0.7361322206069884e-8, (13, 2) = -0.16006959885630092e-8, (13, 3) = -0.60954833295139e-8, (14, 1) = -0.8135577900607999e-9, (14, 2) = -0.5635256156486533e-8, (14, 3) = 0.6633628564464468e-8, (15, 1) = -0.7801726603638605e-8, (15, 2) = 0.8656969516773866e-8, (15, 3) = -0.8563833248490694e-8, (16, 1) = 0.5807906930124011e-8, (16, 2) = -0.4097918191400617e-8, (16, 3) = -0.33689146247052684e-9, (17, 1) = 0.45105985824776024e-9, (17, 2) = -0.5007083474759643e-8, (17, 3) = 0.18471029972130062e-7, (18, 1) = -0.29145669603870902e-8, (18, 2) = 0.8373496931255616e-8, (18, 3) = -0.26162309001022457e-7, (19, 1) = 0.1715569635685495e-8, (19, 2) = -0.535670525811051e-8, (19, 3) = 0.19030608416671472e-7, (20, 1) = -0.34977609660274384e-9, (20, 2) = 0.1474813130678135e-8, (20, 3) = -0.65215600082828415e-8, (21, 1) = 0.20443269195515585e-10, (21, 2) = -0.13984210716486318e-9, (21, 3) = 0.8613227459894349e-9, (22, 1) = -0.17789355570891232e-11, (22, 2) = 0.4736297077901396e-11, (22, 3) = -0.18903663780540682e-10, (23, 1) = 0.34855282413257125e-12, (23, 2) = -0.4570031050682057e-11, (23, 3) = 0.3051816454556092e-10, (24, 1) = -0.5988722303653391e-12, (24, 2) = 0.1853672208396266e-11, (24, 3) = -0.12062893365927572e-10, (25, 1) = -0.12720293841230909e-12, (25, 2) = -0.5532970050855484e-12, (25, 3) = 0.5393029277707399e-11, (26, 1) = -0.16725993567675494e-12, (26, 2) = 0.4580253496963815e-12, (26, 3) = -0.25878083851462074e-11, (27, 1) = .0, (27, 2) = .0, (27, 3) = 0.13176846361390094e-11}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[27] elif outpoint = "order" then return 8 elif outpoint = "error" then return HFloat(2.6162309001022457e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [3, 27, [f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[27] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[27] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(3, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(27, 3, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(3, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(27, 3, X, Y, outpoint, yout, L, V) end if; [eta = outpoint, seq('[f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta)]'[i] = yout[i], i = 1 .. 3)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[27] elif outpoint = "order" then return 8 elif outpoint = "error" then return HFloat(2.6162309001022457e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [3, 27, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[27] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[27] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(27, 3, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(3, {(1) = 0., (2) = 0., (3) = 0.}); `dsolve/numeric/hermite`(27, 3, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 3)] end proc, (2) = Array(0..0, {}), (3) = [eta, f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x_bvp) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x_bvp) else _ndsol := pointto(data[2][0]); return ('_ndsol')(x_bvp) end if end if; try res := solnproc(outpoint); [eta = res[1], seq('[f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta)]'[i] = res[i+1], i = 1 .. 3)] catch: error  end try end proc

plots:-odeplot(dsol);

If you change a = 10 to a = 20, you will see that we get pretty much the
same curve, so for all practical purposes, a = 10 is good enough approximation

for infinity.

 

Here are the solutions corresponding to the choices a=10 and a=20 shown together.

Download mw.mw

The sign of the second derivative term is certainly in error.  It should be negative.  A typo?

The easiest way to handle the integral is to introduce a new unknown, let's say v(x,t) defined by diff(v(x,t),t) = u(x,t) and v(x,0)=0.  Then the integral of u is v.

Call Maple's pdsolve() to solve two PDEs in the two unknowns u and v.  This is not done through Crank-Nicolson, but it gets the answer.  If you insist on Crank-Nicolson, then you will have to write the finite difference formulation yourself, although there is not much point to it other than for a programming exercise.  In any case, the introduction of the unknown v gets rid of the integral so you won't have to worry about integration at all.

Here is my worksheet.

restart;

pde1 := diff(u(x,t),t) - diff(u(x,t),x,x) + u(x,t) + v(x,t) = f(x,t);

diff(u(x, t), t)-(diff(diff(u(x, t), x), x))+u(x, t)+v(x, t) = f(x, t)

pde2 := diff(v(x,t),t) = u(x,t);

diff(v(x, t), t) = u(x, t)

f := (x,t) -> (x^3 + t^2*x^2 - t^2*x + 4*t*x - 2*t + 1)*exp(-x*t) - x + 1;

proc (x, t) options operator, arrow; (x^3+t^2*x^2-t^2*x+4*t*x-2*t+1)*exp(-t*x)-x+1 end proc

bc := u(0,t) = 0, u(1,t) = 0;

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

ic := u(x,0) = x*(1-x),  v(x,0) = 0;

u(x, 0) = x*(1-x), v(x, 0) = 0

pdsol := pdsolve({pde1,pde2}, {ic, bc}, numeric);

_m140212070567648

pdsol:-plot3d(u(x,t), x=0..1, t=0..10);


Download mw.mw

First 27 28 29 30 31 32 33 Last Page 29 of 58