acer

32617 Reputation

29 Badges

20 years, 42 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Why are you trying for output=Array(...)? And why with so few points? (With more points you could get a much smoother piecewise spline as an interpolation.)

restart;

sol := dsolve([-diff(F(x), x$2)+F(x) = x*sin(5*x),
              F(0)=0.2, F(1)=1],
              numeric, 'output' = listprocedure);

[x = proc (x) local _res, _dat, _solnproc; option `Copyright (c) 1993 by the University of Waterloo. All rights reserved.`; _dat := 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .2, (1, 2) = .6355472386901964, (2, 1) = .28679901058587776, (2, 2) = .6642172351157226, (3, 1) = .4026629349647905, (3, 2) = .6898565048786539, (4, 1) = .5191388059317775, (4, 2) = .7087686351481234, (5, 1) = .6327422107075403, (5, 2) = .7672375606410581, (6, 1) = .745854892367845, (6, 2) = .8933518491303937, (7, 1) = .8652730228741763, (7, 2) = 1.0741950607628237, (8, 1) = 1.0, (8, 2) = 1.2869514632712835}, datatype = float[8], order = C_order); YP := Matrix(8, 2, {(1, 1) = .6355472386901964, (1, 2) = .2, (2, 1) = .6642172351157226, (2, 2) = .2040819987788216, (3, 1) = .6898565048786539, (3, 2) = 0.987321747068094e-1, (4, 1) = .7087686351481234, (4, 2) = .18582163798963208, (5, 1) = .7672375606410581, (5, 2) = .6263258981104891, (6, 1) = .8933518491303937, (6, 2) = 1.2240154135287016, (7, 1) = 1.0741950607628237, (7, 2) = 1.7154194632259072, (8, 1) = 1.2869514632712835, (8, 2) = 1.9589242746631386}, 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .0, (1, 2) = 0.13030464384801514e-6, (2, 1) = 0.1302535103026619e-7, (2, 2) = 0.14221614646911444e-6, (3, 1) = -0.4128469958203856e-7, (3, 2) = 0.15918945269923148e-6, (4, 1) = -0.7225809617070991e-7, (4, 2) = 0.11203207102741712e-6, (5, 1) = -0.5203959916725329e-7, (5, 2) = 0.648213485009814e-7, (6, 1) = -0.26104233388354814e-7, (6, 2) = 0.4841390359814309e-7, (7, 1) = -0.10238961917655763e-7, (7, 2) = 0.4628901322935305e-7, (8, 1) = .0, (8, 2) = 0.48876597274231683e-7}, 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 8, [F(x), diff(F(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x)]'[i] = yout[i], i = 1 .. 2)] 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 8, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] 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(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(8, 2, 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(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(8, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446883866908093534, (2) = 18446883866908094062, (3) = 18446883866908094238}), (3) = [x, F(x), diff(F(x), x)], (4) = 0}); _solnproc := _dat[1]; if member(x, ["last", 'last']) then _res := _solnproc("last"); if type(_res, 'list') then return _res[1] end if elif type(x, `=`) and member(lhs(x), ["initial", 'initial']) then if type(rhs(x), 'list') then _res := _solnproc("initial" = [0, op(rhs(x))]) else _res := _solnproc("initial" = [1, rhs(x)]) end if; if type(_res, 'list') then return _res[1] end if elif x = "sysvars" then return _dat[3] end if; x end proc, F(x) = proc (x) local res, data, solnproc, `F(x)`, outpoint; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x) else outpoint := evalf(x) 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .2, (1, 2) = .6355472386901964, (2, 1) = .28679901058587776, (2, 2) = .6642172351157226, (3, 1) = .4026629349647905, (3, 2) = .6898565048786539, (4, 1) = .5191388059317775, (4, 2) = .7087686351481234, (5, 1) = .6327422107075403, (5, 2) = .7672375606410581, (6, 1) = .745854892367845, (6, 2) = .8933518491303937, (7, 1) = .8652730228741763, (7, 2) = 1.0741950607628237, (8, 1) = 1.0, (8, 2) = 1.2869514632712835}, datatype = float[8], order = C_order); YP := Matrix(8, 2, {(1, 1) = .6355472386901964, (1, 2) = .2, (2, 1) = .6642172351157226, (2, 2) = .2040819987788216, (3, 1) = .6898565048786539, (3, 2) = 0.987321747068094e-1, (4, 1) = .7087686351481234, (4, 2) = .18582163798963208, (5, 1) = .7672375606410581, (5, 2) = .6263258981104891, (6, 1) = .8933518491303937, (6, 2) = 1.2240154135287016, (7, 1) = 1.0741950607628237, (7, 2) = 1.7154194632259072, (8, 1) = 1.2869514632712835, (8, 2) = 1.9589242746631386}, 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .0, (1, 2) = 0.13030464384801514e-6, (2, 1) = 0.1302535103026619e-7, (2, 2) = 0.14221614646911444e-6, (3, 1) = -0.4128469958203856e-7, (3, 2) = 0.15918945269923148e-6, (4, 1) = -0.7225809617070991e-7, (4, 2) = 0.11203207102741712e-6, (5, 1) = -0.5203959916725329e-7, (5, 2) = 0.648213485009814e-7, (6, 1) = -0.26104233388354814e-7, (6, 2) = 0.4841390359814309e-7, (7, 1) = -0.10238961917655763e-7, (7, 2) = 0.4628901322935305e-7, (8, 1) = .0, (8, 2) = 0.48876597274231683e-7}, 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 8, [F(x), diff(F(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x)]'[i] = yout[i], i = 1 .. 2)] 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 8, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] 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(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(8, 2, 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(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(8, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446883866908093534, (2) = 18446883866908094062, (3) = 18446883866908094238}), (3) = [x, F(x), diff(F(x), x)], (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) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x) else `F(x)` := pointto(data[2][2]); return ('`F(x)`')(x) end if end if; try res := solnproc(outpoint); res[2] catch: error  end try end proc, diff(F(x), x) = proc (x) local res, data, solnproc, `diff(F(x),x)`, outpoint; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x) else outpoint := evalf(x) 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .2, (1, 2) = .6355472386901964, (2, 1) = .28679901058587776, (2, 2) = .6642172351157226, (3, 1) = .4026629349647905, (3, 2) = .6898565048786539, (4, 1) = .5191388059317775, (4, 2) = .7087686351481234, (5, 1) = .6327422107075403, (5, 2) = .7672375606410581, (6, 1) = .745854892367845, (6, 2) = .8933518491303937, (7, 1) = .8652730228741763, (7, 2) = 1.0741950607628237, (8, 1) = 1.0, (8, 2) = 1.2869514632712835}, datatype = float[8], order = C_order); YP := Matrix(8, 2, {(1, 1) = .6355472386901964, (1, 2) = .2, (2, 1) = .6642172351157226, (2, 2) = .2040819987788216, (3, 1) = .6898565048786539, (3, 2) = 0.987321747068094e-1, (4, 1) = .7087686351481234, (4, 2) = .18582163798963208, (5, 1) = .7672375606410581, (5, 2) = .6263258981104891, (6, 1) = .8933518491303937, (6, 2) = 1.2240154135287016, (7, 1) = 1.0741950607628237, (7, 2) = 1.7154194632259072, (8, 1) = 1.2869514632712835, (8, 2) = 1.9589242746631386}, 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .0, (1, 2) = 0.13030464384801514e-6, (2, 1) = 0.1302535103026619e-7, (2, 2) = 0.14221614646911444e-6, (3, 1) = -0.4128469958203856e-7, (3, 2) = 0.15918945269923148e-6, (4, 1) = -0.7225809617070991e-7, (4, 2) = 0.11203207102741712e-6, (5, 1) = -0.5203959916725329e-7, (5, 2) = 0.648213485009814e-7, (6, 1) = -0.26104233388354814e-7, (6, 2) = 0.4841390359814309e-7, (7, 1) = -0.10238961917655763e-7, (7, 2) = 0.4628901322935305e-7, (8, 1) = .0, (8, 2) = 0.48876597274231683e-7}, 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 8, [F(x), diff(F(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x)]'[i] = yout[i], i = 1 .. 2)] 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 8, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] 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(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(8, 2, 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(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(8, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446883866908093534, (2) = 18446883866908094062, (3) = 18446883866908094238}), (3) = [x, F(x), diff(F(x), x)], (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) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x) else `diff(F(x),x)` := pointto(data[2][3]); return ('`diff(F(x),x)`')(x) end if end if; try res := solnproc(outpoint); res[3] catch: error  end try end proc]

(1)

f := eval(F(x),sol);

proc (x) local res, data, solnproc, `F(x)`, outpoint; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x) else outpoint := evalf(x) 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .2, (1, 2) = .6355472386901964, (2, 1) = .28679901058587776, (2, 2) = .6642172351157226, (3, 1) = .4026629349647905, (3, 2) = .6898565048786539, (4, 1) = .5191388059317775, (4, 2) = .7087686351481234, (5, 1) = .6327422107075403, (5, 2) = .7672375606410581, (6, 1) = .745854892367845, (6, 2) = .8933518491303937, (7, 1) = .8652730228741763, (7, 2) = 1.0741950607628237, (8, 1) = 1.0, (8, 2) = 1.2869514632712835}, datatype = float[8], order = C_order); YP := Matrix(8, 2, {(1, 1) = .6355472386901964, (1, 2) = .2, (2, 1) = .6642172351157226, (2, 2) = .2040819987788216, (3, 1) = .6898565048786539, (3, 2) = 0.987321747068094e-1, (4, 1) = .7087686351481234, (4, 2) = .18582163798963208, (5, 1) = .7672375606410581, (5, 2) = .6263258981104891, (6, 1) = .8933518491303937, (6, 2) = 1.2240154135287016, (7, 1) = 1.0741950607628237, (7, 2) = 1.7154194632259072, (8, 1) = 1.2869514632712835, (8, 2) = 1.9589242746631386}, 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .0, (1, 2) = 0.13030464384801514e-6, (2, 1) = 0.1302535103026619e-7, (2, 2) = 0.14221614646911444e-6, (3, 1) = -0.4128469958203856e-7, (3, 2) = 0.15918945269923148e-6, (4, 1) = -0.7225809617070991e-7, (4, 2) = 0.11203207102741712e-6, (5, 1) = -0.5203959916725329e-7, (5, 2) = 0.648213485009814e-7, (6, 1) = -0.26104233388354814e-7, (6, 2) = 0.4841390359814309e-7, (7, 1) = -0.10238961917655763e-7, (7, 2) = 0.4628901322935305e-7, (8, 1) = .0, (8, 2) = 0.48876597274231683e-7}, 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 8, [F(x), diff(F(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x)]'[i] = yout[i], i = 1 .. 2)] 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 8, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] 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(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(8, 2, 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(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(8, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446883866908093534, (2) = 18446883866908094062, (3) = 18446883866908094238}), (3) = [x, F(x), diff(F(x), x)], (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) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x) else `F(x)` := pointto(data[2][2]); return ('`F(x)`')(x) end if end if; try res := solnproc(outpoint); res[2] catch: error  end try end proc

(2)

fdx := eval(diff(F(x),x),sol);

proc (x) local res, data, solnproc, `diff(F(x),x)`, outpoint; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x) else outpoint := evalf(x) 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .2, (1, 2) = .6355472386901964, (2, 1) = .28679901058587776, (2, 2) = .6642172351157226, (3, 1) = .4026629349647905, (3, 2) = .6898565048786539, (4, 1) = .5191388059317775, (4, 2) = .7087686351481234, (5, 1) = .6327422107075403, (5, 2) = .7672375606410581, (6, 1) = .745854892367845, (6, 2) = .8933518491303937, (7, 1) = .8652730228741763, (7, 2) = 1.0741950607628237, (8, 1) = 1.0, (8, 2) = 1.2869514632712835}, datatype = float[8], order = C_order); YP := Matrix(8, 2, {(1, 1) = .6355472386901964, (1, 2) = .2, (2, 1) = .6642172351157226, (2, 2) = .2040819987788216, (3, 1) = .6898565048786539, (3, 2) = 0.987321747068094e-1, (4, 1) = .7087686351481234, (4, 2) = .18582163798963208, (5, 1) = .7672375606410581, (5, 2) = .6263258981104891, (6, 1) = .8933518491303937, (6, 2) = 1.2240154135287016, (7, 1) = 1.0741950607628237, (7, 2) = 1.7154194632259072, (8, 1) = 1.2869514632712835, (8, 2) = 1.9589242746631386}, 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .0, (1, 2) = 0.13030464384801514e-6, (2, 1) = 0.1302535103026619e-7, (2, 2) = 0.14221614646911444e-6, (3, 1) = -0.4128469958203856e-7, (3, 2) = 0.15918945269923148e-6, (4, 1) = -0.7225809617070991e-7, (4, 2) = 0.11203207102741712e-6, (5, 1) = -0.5203959916725329e-7, (5, 2) = 0.648213485009814e-7, (6, 1) = -0.26104233388354814e-7, (6, 2) = 0.4841390359814309e-7, (7, 1) = -0.10238961917655763e-7, (7, 2) = 0.4628901322935305e-7, (8, 1) = .0, (8, 2) = 0.48876597274231683e-7}, 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 8, [F(x), diff(F(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x)]'[i] = yout[i], i = 1 .. 2)] 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 8, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] 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(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(8, 2, 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(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(8, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446883866908093534, (2) = 18446883866908094062, (3) = 18446883866908094238}), (3) = [x, F(x), diff(F(x), x)], (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) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x) else `diff(F(x),x)` := pointto(data[2][3]); return ('`diff(F(x),x)`')(x) end if end if; try res := solnproc(outpoint); res[3] catch: error  end try end proc

(3)

fd2x := D(eval(diff(F(x),x),sol));

D(proc (x) local res, data, solnproc, `diff(F(x),x)`, outpoint; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x) else outpoint := evalf(x) 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .2, (1, 2) = .6355472386901964, (2, 1) = .28679901058587776, (2, 2) = .6642172351157226, (3, 1) = .4026629349647905, (3, 2) = .6898565048786539, (4, 1) = .5191388059317775, (4, 2) = .7087686351481234, (5, 1) = .6327422107075403, (5, 2) = .7672375606410581, (6, 1) = .745854892367845, (6, 2) = .8933518491303937, (7, 1) = .8652730228741763, (7, 2) = 1.0741950607628237, (8, 1) = 1.0, (8, 2) = 1.2869514632712835}, datatype = float[8], order = C_order); YP := Matrix(8, 2, {(1, 1) = .6355472386901964, (1, 2) = .2, (2, 1) = .6642172351157226, (2, 2) = .2040819987788216, (3, 1) = .6898565048786539, (3, 2) = 0.987321747068094e-1, (4, 1) = .7087686351481234, (4, 2) = .18582163798963208, (5, 1) = .7672375606410581, (5, 2) = .6263258981104891, (6, 1) = .8933518491303937, (6, 2) = 1.2240154135287016, (7, 1) = 1.0741950607628237, (7, 2) = 1.7154194632259072, (8, 1) = 1.2869514632712835, (8, 2) = 1.9589242746631386}, 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(8, {(1) = .0, (2) = .13356755121790845, (3) = .30430039984542584, (4) = .4711335427102931, (5) = .6262694366777036, (6) = .7636417442240576, (7) = .8856536401001731, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .0, (1, 2) = 0.13030464384801514e-6, (2, 1) = 0.1302535103026619e-7, (2, 2) = 0.14221614646911444e-6, (3, 1) = -0.4128469958203856e-7, (3, 2) = 0.15918945269923148e-6, (4, 1) = -0.7225809617070991e-7, (4, 2) = 0.11203207102741712e-6, (5, 1) = -0.5203959916725329e-7, (5, 2) = 0.648213485009814e-7, (6, 1) = -0.26104233388354814e-7, (6, 2) = 0.4841390359814309e-7, (7, 1) = -0.10238961917655763e-7, (7, 2) = 0.4628901322935305e-7, (8, 1) = .0, (8, 2) = 0.48876597274231683e-7}, 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 8, [F(x), diff(F(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(8, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[F(x), diff(F(x), x)]'[i] = yout[i], i = 1 .. 2)] 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[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(1.5918945269923148e-7) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 8, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] 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(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(8, 2, 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(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(8, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446883866908093534, (2) = 18446883866908094062, (3) = 18446883866908094238}), (3) = [x, F(x), diff(F(x), x)], (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) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x) else `diff(F(x),x)` := pointto(data[2][3]); return ('`diff(F(x),x)`')(x) end if end if; try res := solnproc(outpoint); res[3] catch: error  end try end proc)

(4)

plot( f, 0 .. 1, view=0 .. 1, size=[600,200] );

 

plot( fdx, 0 .. 1, view=0 .. 1.5, size=[600,200] );

 

plot( fd2x, 0 .. 1, view=0 .. 3, size=[600,200] );

 

 

Download fd2x_bvp.mw

This question has come up several times before, and you can find several old posts about it by entering the word colorbar in the Mapleprimes search.

One can manually edit the properties of the GUI Table inserted by plots:-display (to remove borders), and re-size it by dragging the borders. But such edits are lost upon re-execution.

Another possibility is to use the DocumentTools:-Tabulate command. Here is a variant on Adri's pointplot3d example.

tabulate_colorbar.mw

Unfortunately the worksheet renderer of this site is unable to inline the worksheet so that it's properly visible here.

For example here is an old post where I used Tabulate to align a 3d surface and a 2d densityplot for the colorbar. It's also possible to orient the colorbar horizontally, and locate it below/above the 3d plot. Using a 2d densityplot has the advantage that it can be constructed using the size option. However using a 2d densityplot can get tricky since one end of the hue rolls back to red. This may not match that of the 3d plot created with shading=zhue, with hue ending around magenta. So in that post I used,
    color=[f,1,1,colortype=HSV]
instead of
   shading=zhue
for the 3d surface plot.

Using the main menubar you can toggle off the item View -> Status Bar . That removes the status bar, in which the button appears (along with everything else in that bar). This aspect of the GUI's "View" is saved as a preference when the GUI is fully closed.

But I'm unaware of any way only to disable that "editable" button.

Your code assigns a value to Ha, but it appears as if you wanted the ode sys to vary with Ha=L[k].

[edit] Even if I've misunderstood the role you intend for Ha, or whether you still intend on looping, you might still utilize the visual labelling of the curves and a legend as below. [end of edit]

I'm not sure what you mean by "contour" here. Do you mean that you want to distinguish between the curves, say by color and a legend?

restart;

with(plots):

R1 := .1; R0 := .1; m := .1; a := .1;
#Ha := .1;
Nt := .1; Nb := .1; Pr := 6.2; Le := .6; Bi := 1; Ec := .1; k := 1; r := .1; A := 1; fcns := {C(y), T(y), U(y), W(y)}; sys := diff(U(y), `$`(y, 2))+(R1*(diff(U(y), y))-2*R0*W(y))*exp(a*T(y))-a*(diff(U(y), y))*(diff(T(y), y))-Ha*(U(y)+m*W(y))*exp(a*T(y))/(m^2+1)-U(y)/k+A*exp(a*T(y)) = 0, diff(W(y), `$`(y, 2))+(R1*(diff(W(y), y))+2*R0*U(y))*exp(a*T(y))-a*(diff(W(y), y))*(diff(T(y), y))-Ha*(W(y)-m*U(y))*exp(a*T(y))/(m^2+1)-W(y)/k = 0, diff(T(y), `$`(y, 2))+R1*Pr*(diff(T(y), y))+Pr*Ec*exp(-a*T(y))*((diff(U(y), y))*(diff(U(y), y))+(diff(W(y), y))*(diff(W(y), y)))+Nt*(diff(T(y), y))*(diff(T(y), y))+Pr*Ec*(U(y)*U(y)+W(y)*W(y))*exp(-a*T(y))/k = 0, diff(C(y), `$`(y, 2))+Pr*Le*R1*(diff(C(y), y))+Nt*(diff(C(y), `$`(y, 2)))/Nb-r*C(y) = 0; bc := U(0) = 0, W(0) = 0, C(0) = 0, (D(T))(0) = Bi*(T(0)-1), U(1) = 0, W(1) = 0, C(1) = 1, T(1) = 0;

.1

 

.1

 

.1

 

.1

 

.1

 

.1

 

6.2

 

.6

 

1

 

.1

 

1

 

.1

 

1

 

{C(y), T(y), U(y), W(y)}

 

diff(diff(U(y), y), y)+(.1*(diff(U(y), y))-.2*W(y))*exp(.1*T(y))-.1*(diff(U(y), y))*(diff(T(y), y))-.9900990099*Ha*(U(y)+.1*W(y))*exp(.1*T(y))-U(y)+exp(.1*T(y)) = 0, diff(diff(W(y), y), y)+(.1*(diff(W(y), y))+.2*U(y))*exp(.1*T(y))-.1*(diff(W(y), y))*(diff(T(y), y))-.9900990099*Ha*(W(y)-.1*U(y))*exp(.1*T(y))-W(y) = 0, diff(diff(T(y), y), y)+.62*(diff(T(y), y))+.62*exp(-.1*T(y))*((diff(U(y), y))^2+(diff(W(y), y))^2)+.1*(diff(T(y), y))^2+.62*(U(y)^2+W(y)^2)*exp(-.1*T(y)) = 0, 2.000000000*(diff(diff(C(y), y), y))+.372*(diff(C(y), y))-.1*C(y) = 0

 

U(0) = 0, W(0) = 0, C(0) = 0, (D(T))(0) = T(0)-1, U(1) = 0, W(1) = 0, C(1) = 1, T(1) = 0

(1)

L := [seq(0.5 .. 2.0, 0.25)]; AP := NULL;

[.5, .75, 1.00, 1.25, 1.50, 1.75, 2.00]

 

(2)

NN := nops(L);
for k to NN do
 R := dsolve(eval({bc, sys}, Ha = L[k]), fcns, type = numeric, method = bvp[midrich], AP);
 AP := approxsoln = R;
 p1u[k] := odeplot(R, [y, U(y)], 0 .. 1, numpoints = 100, labels = ["y", "U"], linestyle = dash,
                   color = ColorTools:-Color("HSV",[(k-1)/(NN),1.0,1.0]), legend=[typeset(''Ha''=L[k])]);
end do:

7

(3)

display([seq(p1u[i], i=1..NN)], legendstyle=[location=right], size=[600,400]);

 

 

Download odelegend.mw

The differences in the Matrix between k=0.001 and k=0.0001 is on the order of 10^(-6), while the values themselves range from 0 to about 1.8. So you don't see the difference between frames.

I'm presuming that the computation of the data is doing what you intend.

How about plotting the difference instead?

ps. I don't see why you'd want to set Digits to 5.

restart; Digits := 15; with(plots); with(LinearAlgebra)

NULL

a := 0; b := 1; N := 9; h := (b-a)/(N+1); phi := .5; K := 10^(-6); mu := 1.67; alpha := K/(phi*mu); lambda := alpha*k/h^2

0.119760479041916e-3*k

(1)

NULL

for i from 0 while i <= N do u[i, 0] := h*i+1 end do

NULL

for j from 0 while j <= N+1 do u[0, j] := .1; u[N+1, j] := .5 end do

NULL

printlevel := 2; for i while i <= N do for j from 0 while j <= N do eq[i, j] := lambda*u[i-1, j]+(2-2*lambda)*u[i, j]+lambda*u[i+1, j] = -lambda*u[i-1, j+1]+(2+2*lambda)*u[i, j+1]-lambda*u[i+1, j+1] end do end do; for i while i <= N do for j from 0 while j <= N do eq[i, j] := lambda*u[i-1, j]+(2-2*lambda)*u[i, j]+lambda*u[i+1, j] = -lambda*u[i-1, j+1]+(2+2*lambda)*u[i, j+1]-lambda*u[i+1, j+1] end do end do

``

``

sys := ([seq])(seq(eq[i, j], j = 0 .. N), i = 1 .. N):

nops(sys);

vars:=indets(sys) minus {k}:

nn := Matrix(N+1, N+1,(i, j)-> u[i-1, j-1]):

##

p:=proc(kk) local u_res,A;

  u_res:=solve(eval(sys,k=kk),vars);

  A:=eval(nn,u_res);

  #plots:-matrixplot(A)

end proc:

90

(2)

## Testing p for k=0.001:

plots:-matrixplot(p(0.0001)-p(0.001));

 

## Animating the plot for k=0.0001..0.001:

plots:-animate(K->plots:-matrixplot(p(0.0001)-p(K)),[k],k=0.0001..0.001);

 

 

 

NULL


Download Crank_scheme_4a.mw

I have a suspicion that this is a consequence of normal (as called by simplify) using the sign of the rational polynomial according to the lexicographic ordering of the variables.

Contrast these two cases, where variables are r and b versus r and s.

restart;
sign( (1-b/r)^(-1) );
                       -1

normal( sqrt((1-b/r)^(-1)) );
                    /    r   \1/2
                    |- ------|
                    \  -r + b/

restart;
sign( (1-s/r)^(-1) );
                        1

normal( sqrt((1-s/r)^(-1)) );
                     /  r  \1/2
                     |-----|
                     \r - s/

But, even if that speculation if correct, I'm not aware of a way to instruct kernel builtin normal to use a specific ordering for ascertaining the sign (or to enforce it somehow).

Which leaves "fixing up" the result, as recourse. One possibility here is:

H := u->simplify(sign(u)*numer(u))
        /simplify(sign(u)*denom(u)):

foo := sqrt((1-b/r)^(-1));

                      /   1   \1/2
               foo := |-------|
                      \1 - b/r/

evalindets(foo,ratpoly,H);

                       /  r  \1/2
                       |-----|
                       \r - b/

# or,

HH := u->simplify(sign(numer(u))*numer(u))
        /simplify(sign(numer(u))*denom(u)):

evalindets(foo,ratpoly,HH);

                       /  r  \1/2
                       |-----|
                       \r - b/

 

These aren't nearly as neat and quick as Axel's suggestion to turn the MeijerG call into a Sum.

kernelopts(version);

`Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750`

(1)

restart;

ig:=(-5*ln(x)^4*Pi^4-20*ln(x)^2*Pi^4-8*Pi^4+120
    *MeijerG([[0, 0], [1, 1, 1]], [[0, 0, 0, 0, 0], []], x^Pi))
    /(120*Pi^4*(-1+x)^2):

fig := proc(X) option remember, system;
         if not X::numeric then return 'procname'(args); end if;
         NumericEventHandler(division_by_zero=default):
         evalf(eval(ig,x=X));
       end proc:

H:=IntegrationTools:-Expand(Int( (Re+I*Im)(fig(x)), x=4/10 .. 6/10,
                                 method=_d01ajc )):

CodeTools:-Usage( evalf(H) );

memory used=3.09GiB, alloc change=142.57MiB, cpu time=19.63s, real time=17.75s, gc time=3.46s

 

-0.5551687694e-2+0.8100967140e-40*I

(2)

restart;

ig:=(-5*ln(x)^4*Pi^4-20*ln(x)^2*Pi^4-8*Pi^4+120
    *MeijerG([[0, 0], [1, 1, 1]], [[0, 0, 0, 0, 0], []], x^Pi))
    /(120*Pi^4*(-1+x)^2):

fig := proc(X) option remember, system;
         if not X::numeric then return 'procname'(args); end if;
         NumericEventHandler(division_by_zero=default):
         evalf(eval(ig,x=X));
       end proc:

CodeTools:-Usage( evalf(Int( fig(x), x=4/10 .. 6/10, method=_Gquad )) );

memory used=1.39GiB, alloc change=142.57MiB, cpu time=8.97s, real time=8.16s, gc time=1.47s

 

-0.5551687694e-2+0.4526240059e-31*I

(3)

 

Download MI_int.mw

You don't need to introduce a second plot, in order to utilize plots:-display.

restart;

ode:= diff(y(x),x)=2*x:

p1:=DEtools:-DEplot(ode,y(x),x = -2 .. 2,y = -2 .. 2, [[0.1,0]],
               labels=["",""],
               linecolour = red, thickness=1,
               color = "#00ccff",
               'arrows' = 'medium'                    
               ):

plots:-display(p1, axis=[tickmarks=[color=red]],
               font=["Lucida Sans",bold,12]);

If you really are seeing a colored axis on your machine with the above code, then it's still possible to get the effect using custom tickmarks and Typesetting to color them.

The solve command is not supposed to emit an error. Your example is a bug. I will submit a bug report.

From the help page ?solve,details ,

  "If the solve command does not find any solutions, then it returns the empty
   sequence (NULL) (instead of an expression sequence or sets) or empty list
   (instead of a list of lists). This means that there are no solutions or the solve
   command cannot find the solutions."

and,

  "If the solve command cannot confirm that the solution set returned is complete,
   it sets the global variable _SolutionsMayBeLost to true and issues a warning."

So, no, it's not supposed to use an error to denote failure to find a solution. Nor is it supposed to return unevaluated.

I have reported quite a few similar bugs. There is some lack of defensive programming in the dispatch mechanism.

FWIW, turning the abs into (a multiplication by) signum can sometimes help, eg,

restart;
r:=evalc(Im(1/ln(x))):
solve(convert(r,signum),{x});
                            {0 < x}

And sure, you are free to wrap your solve calls in try..catch . In doing so you could even turn the error message into a WARNING. and/or set your own flag. Ie,

restart;

r:=evalc(Im(1/ln(x))):

solve(convert(r,signum),{x});

{0 < x}

(1)

solve_wrap:=proc()
  global SolveErrorFlag;
  try
    SolveErrorFlag:=false;
    solve(args);
  catch:
    SolveErrorFlag:=true;
    WARNING(cat(sprintf("%a : ",lastexception[1]),
                StringTools:-FormatMessage(lastexception[2..-1])));
  end try;
end proc:

solve_wrap( r, {x} );

Warning, SolveTools:-Inequality:-LinearUnivariateSystem : invalid input: member received FAIL, which is not valid for its 2nd argument, s

 

SolveErrorFlag;

true

(2)

solve_wrap( convert(r,signum), {x} );

{0 < x}

(3)

SolveErrorFlag;

false

(4)

 

 


Download solve_wrap.mw

restart;
                
A:=Matrix([[1,2,3,4],[5,6,7,8]]);
X:=Vector(4,symbol=x);
B:=Vector([10,10]);

# general solution
G:=LinearAlgebra:-LinearSolve(A,B);

# free parameters in G
params:=indets(G,name);

# generate ten of them
sols:={seq(eval(G,[params[1]=0,params[2]=i]),i=0..9)};

# check them
seq(LinearAlgebra:-Norm(A.s-B), s=sols);
simplify( exp(LambertW(1, Z)) - Z/LambertW(1, Z) ); # ok
                               0

simplify( exp(LambertW(1, Z)/2) - sqrt(Z/LambertW(1, Z)) ); # oops
                               0

The kernel can only respect the timelimit when it polls the elapsed time and the internal state is safe to return from.

Both of those things can only occur at discrete intervals. The granularity affects overall performance. But the internal state issue can, almost of necessity, sometimes be very coarse. There are kernel builtins which have to finish.

Sometimes clear examples can lead to tweaking of the mechanism, in my experience.

Have you tried to find the successive statements on your code where the timelimit is overrun, but not interrupted?

If you Matrix equation has the form A.x=b (where A is a Matrix and b is a Vector) then see the LinearAlgebra:-GenerateEquations command.

Otherwise, show us the form of the Matrix equation.

One of the calls to writeto is inside GTS2Usage and the other is at the top-level.

So you are redirecting to MyFile, and then not reverting to terminal (unless you successfully call GTS2Usage, which I don't see anywhere in the sheet). That's probably why you're not seeing the later output in the sheet.

Perhaps you intended something like the following, instead. Note that the finally clause is there so that, regardless of whether an error occurs, the writeto(terminal) will execute.

GTS2Usage := proc(H, F, Na, Nd)
  try
    MyFile := "C:/Users/Moshe/Desktop/Usage";
    writeto(MyFile)
    CodeTools:-Usage(GTS2(H, F, Na, Nd));
  catch:
    error;
  finally
    writeto(terminal);
  end try;
end proc;

The try..catch can trap most errors, but not infinite recursion (just so you are aware).

Also, even though you haven't yet shown how you plan to use GTS2timer yet, that proc looks suspect. It only returns the time() difference, and the results from GTS2 would be discarded. And GTS2 returns its results and doesn't act in-place on anything. Perhaps you intended it more like this:

GTS2timer := proc(H, F, Na, Nd)
  local res, st;
  st := time();
  res := GTS2(H, F, Na, Nd);
  print( out = time()-st );
  return res;
end proc;

Do you really need individual timings for each GTS2 call? Are you trying to figure out why it sometimes consumes much resources for specific inputs, or are you also interested in how its internals are consuming resources for general inputs? I'm just wondering whether profiling GTS2 might also be of interest to you.

Note that the value of your Fcn1 is not sqrt(a), because the call to sqrt has evaluated.

Fcn1 := sqrt(a):

lprint(Fcn1);
  a^(1/2)

You can delay evaluation when assigning to Fcn1, and then pass to codegen[cost] with only 1-level evaluation of its argument.

restart;              
Fcn1 := 'sqrt(a)';

                  Fcn1 := sqrt(a)

codegen[cost]( eval(Fcn1, 1) );

                     functions

Fcn2 := 'sin(sqrt(a))';

                Fcn2 := sin(sqrt(a))

codegen[cost]( eval(Fcn2, 1) );

                    2 functions

But this approach may not help much if the expressions your trying to measure are the result of some computation. Another approach might be be to have your computations done by procedure(s), and then measure their cost(s). Eg,

restart;
f := proc() sin(sqrt(a)); end proc;

        f := proc() sin(sqrt(a)) end proc

codegen[cost]( f );
                  2 functions

It's difficult to suggest an approach without knowing more about where your target expressions come from. Are they the result of a separate computation? Or is it their computation/production that you are trying to measure?

As a side note (possibly not relevant to you), even using a procedure will not prevent automatic simplification, since that also occurs during the interal re-writing of the statement sequences in the procedure body. (A more modern implementation might make use of ToInert, but that's another story.) For example,

restart;

'2*(x+y)';  # automatic simplification cannot be prevented by uneval quotes

                      2 x + 2 y

codegen[cost]( '2*(x+y)' );

            additions + 2 multiplications

codegen[cost]( proc() 2*(x+y); end proc );

            additions + 2 multiplications

# internally, this happened
`intrep/makeintrep`( proc() 2*(x+y); end proc );

     Proc(Name(nam .. float), Parameters(), Options(),
          Description(), Locals(), Globals(),
          StatSeq(2 x + 2 y))
First 177 178 179 180 181 182 183 Last Page 179 of 339