panke

70 Reputation

5 Badges

3 years, 245 days

MaplePrimes Activity


These are questions asked by panke

I have this list

L := {a = b, e = f};

I want to extract b and f

How can i do it ?

Way i get this error

 

plot([x, cos(x), x = -Pi .. Pi, y = -.5 .. .5])

Error, (in plot) incorrect first argument [x, cos(x), x = -Pi .. Pi, y = -.5 .. .5]
 

I want to fetch the trigger time.
I use rhs function.
 

restart; ode := diff(y(x), x) = 1/(y(x)+1); event := [[abs(y(x)+1)-0.1e-1, halt]]

SOL := dsolve([ode, y(0) = 0], numeric, output = listprocedure, range = -10 .. 10, events = event):

Warning, cannot evaluate the solution further left of -.49995006, event #1 triggered a halt

 

``

tlast := rhs(SOL[1](last));

10.

(1)

NULL

x = proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _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) else _xout := evalf(x) end if; _dat := eval(`dsolve/numeric/data/modules`[1]); _solnproc := _dat:-Get("soln_procedure"); _pars := map(rhs, _dat:-Get("params")); if not type(_xout, 'numeric') then if member(x, ["start", 'start', "method", 'method', "left", 'left', "right", 'right', "leftdata", "rightdata", "enginedata", "eventstop", 'eventstop', "eventclear", 'eventclear', "eventstatus", 'eventstatus', "laxtol", 'laxtol', "numfun", 'numfun', NULL]) then _res := _solnproc(convert(x, '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, ["last", 'last', "initial", 'initial', NULL]) then _res := _solnproc(convert(x, 'string')); if type(_res, 'list') then return _res[1] else return NULL end if elif member(x, ["parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(x, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[1], seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] 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), 'string') = rhs(x); if lhs(_xout) = "initial" then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc("initial" = ["single", 1, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error "initial and/or parameter values must be specified in a list" elif lhs(_xout) = "initial_and_parameters" and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = ["single", 1, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = "initial" then return _res[1] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[1], 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), 'string') = rhs(x)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _dat:-Get("sysvars") end if; if procname <> unknown then return ('procname')(x) else _ndsol := `tools/gensym`("x"); eval(FromInert(_Inert_FUNCTION(_Inert_NAME("assign"), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat:-Get("soln_procedures")[1])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(x)))) end if end if; try _res := _solnproc(_xout); _res[1] catch: error  end try end proc

(2)

``


 

Download RHS_TEST.mw


 

restart

`ode&lambda;` := diff(lambda(tau), tau, tau)+2*a*Ep(tau)*(diff(lambda(tau), tau))/(Xi(tau)*a+1) = 0:

th := algsubs((diff(lambda(tau), tau))^2 = (-1-(diff(xi(tau), tau))^2)/(-(xi(tau)*a+1)^2), `ode&xi;`):

a*(diff(xi(tau), tau))^2/(xi(tau)*a+1)+diff(diff(xi(tau), tau), tau)+a/(xi(tau)*a+1) = 0

 

a*(diff(xi(tau), tau))^2/(xi(tau)*a+1)+diff(diff(xi(tau), tau), tau)-a/(xi(tau)*a+1) = 0

(1)

ds2 := -(xi(tau)*a+1)^2*(diff(lambda(tau), tau))^2+(diff(xi(tau), tau))^2:

`&lambda;p1` := 1:

`ics&lambda;1` := lambda(0) = 0, (D(lambda))(0) = `&lambda;p1`:

xi(0) = (-1+2^(1/2))/a, (D(xi))(0) = 1

 

xi(0) = 1/a, (D(xi))(0) = 2

(2)

`lp&xi;1` := dsolve([`ode&xi;1`, `ics&xi;1`], numeric, output = listprocedure, range = teu .. te, events = event1); Xi := eval(xi(tau), `lp&xi;1`); `&Xi;p` := eval(diff(xi(tau), tau), `lp&xi;1`); `ode&lambda;`; `lp&lambda;1` := dsolve([`ode&lambda;`, `ics&lambda;1`], numeric, output = listprocedure, range = teu .. te, events = event1)

diff(diff(lambda(tau), tau), tau)+.6*Ep(tau)*(diff(lambda(tau), tau))/(.3*Xi(tau)+1) = 0

 

Error, (in dsolve/numeric/DAE/make_proc) number of unknown functions and equations must match, got 3 functions {Ep, Xi, lambda}, and 1 equations

 

`lp&xi;1`(1)

[tau(1) = 1., (xi(tau))(1) = 2.20293901854199481, (diff(xi(tau), tau))(1) = .670856526448510904]

(3)

`&lambda;ep1` := eval(diff(lambda(tau), tau), lp1); `&xi;ep1` := eval(diff(xi(tau), tau), lp1); `&lambda;e1` := eval(lambda(tau), lp1); `&xi;e1` := eval(xi(tau), lp1)

proc (tau) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _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](tau) else _xout := evalf(tau) end if; _dat := eval(`dsolve/numeric/data/modules`[1]); _solnproc := _dat:-Get("soln_procedure"); _pars := map(rhs, _dat:-Get("params")); if not type(_xout, 'numeric') then if member(tau, ["start", 'start', "method", 'method', "left", 'left', "right", 'right', "leftdata", "rightdata", "enginedata", "eventstop", 'eventstop', "eventclear", 'eventclear', "eventstatus", 'eventstatus', "laxtol", 'laxtol', "numfun", 'numfun', NULL]) then _res := _solnproc(convert(tau, '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(tau, ["last", 'last', "initial", 'initial', NULL]) then _res := _solnproc(convert(tau, 'string')); if type(_res, 'list') then return _res[4] else return NULL end if elif member(tau, ["parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(tau, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[4], seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(tau), 'string') = rhs(tau); if lhs(_xout) = "initial" then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc("initial" = ["single", 4, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error "initial and/or parameter values must be specified in a list" elif lhs(_xout) = "initial_and_parameters" and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = ["single", 4, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = "initial" then return _res[4] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[4], 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(tau), 'string') = rhs(tau)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _dat:-Get("sysvars") end if; if procname <> unknown then return ('procname')(tau) else _ndsol := `tools/gensym`("xi(tau)"); eval(FromInert(_Inert_FUNCTION(_Inert_NAME("assign"), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat:-Get("soln_procedures")[4])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(tau)))) end if end if; try _res := _solnproc(_xout); _res[4] catch: error  end try end proc

(4)

`&lambda;ep2` := eval(diff(lambda(tau), tau), lp2); `&xi;ep2` := eval(diff(xi(tau), tau), lp2); `&lambda;e2` := eval(lambda(tau), lp2); `&xi;e2` := eval(xi(tau), lp2)

proc (tau) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _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](tau) else _xout := evalf(tau) end if; _dat := eval(`dsolve/numeric/data/modules`[2]); _solnproc := _dat:-Get("soln_procedure"); _pars := map(rhs, _dat:-Get("params")); if not type(_xout, 'numeric') then if member(tau, ["start", 'start', "method", 'method', "left", 'left', "right", 'right', "leftdata", "rightdata", "enginedata", "eventstop", 'eventstop', "eventclear", 'eventclear', "eventstatus", 'eventstatus', "laxtol", 'laxtol', "numfun", 'numfun', NULL]) then _res := _solnproc(convert(tau, '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(tau, ["last", 'last', "initial", 'initial', NULL]) then _res := _solnproc(convert(tau, 'string')); if type(_res, 'list') then return _res[4] else return NULL end if elif member(tau, ["parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(tau, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[4], seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(tau), 'string') = rhs(tau); if lhs(_xout) = "initial" then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc("initial" = ["single", 4, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error "initial and/or parameter values must be specified in a list" elif lhs(_xout) = "initial_and_parameters" and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = ["single", 4, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = "initial" then return _res[4] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[4], 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(tau), 'string') = rhs(tau)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _dat:-Get("sysvars") end if; if procname <> unknown then return ('procname')(tau) else _ndsol := `tools/gensym`("xi(tau)"); eval(FromInert(_Inert_FUNCTION(_Inert_NAME("assign"), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat:-Get("soln_procedures")[4])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(tau)))) end if end if; try _res := _solnproc(_xout); _res[4] catch: error  end try end proc

(5)

ds2h1 := subs([lambda(tau) = `&lambda;e1`(tau), xi(tau) = `&xi;e1`(tau), diff(lambda(tau), tau) = `&lambda;ep1`(tau), diff(xi(tau), tau) = `&xi;ep1`(tau)], ds2); dse1 := unapply(ds2h1, tau); ds2h2 := subs([lambda(tau) = `&lambda;e2`(tau), xi(tau) = `&xi;e2`(tau), diff(lambda(tau), tau) = `&lambda;ep2`(tau), diff(xi(tau), tau) = `&xi;ep2`(tau)], ds2); dse2 := unapply(ds2h2, tau)

dse1(0); dse2(0)

-.999999999

 

1.000000000

(6)

``

t := proc (xi, lambda) options operator, arrow; (xi+1/a)*sinh(a*lambda) end proc; x := proc (xi, lambda) options operator, arrow; (xi+1/a)*cosh(a*lambda) end proc; xi0 := 1; teg := 7

1

 

7

(7)

p1 := plot([[x(xi0, `&lambda;e1`(tau)), t(xi0, `&lambda;e1`(tau)), tau = teu .. te]], legend = ['ds' = -1], color = ["red"]); p2 := plot([[t(xi0, `&lambda;e2`(tau)), x(xi0, `&lambda;e2`(tau)), tau = teu .. te]], legend = ['ds' = 1], color = ["blue"]); p3 := plot([[tau, tau, tau = -teg .. teg], [tau, -tau, tau = -teg .. teg]], color = ["black", "black"], legend = ['ds' = 0, 'ds' = 0])

with(plots); display([p1, p2, p3])

 

NULL

``


 

Download Rindler_simulation_v2.mw

1) How can i get the event time. This example 0.69313.

2) I don't want to see the Warning.How can i do it? 

 

Warning, cannot evaluate the solution further right of .69314729, event #1 triggered a halt
1 2 3 4 5 Page 2 of 5