Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Consider the following expression (omega being the socalled minimal spin connection in the vierbein formalism of general relativity):

with(Physics):
with(Tetrads):
omegaDef := omega[mu,c,d] = 1/2*(
   +e_[~rho,c]*(d_[mu](e_[rho,d]) - d_[rho](e_[mu,d]))
   -e_[~rho,d]*(d_[mu](e_[rho,c]) - d_[rho](e_[mu,c]))
)
-1/2*e_[~a,mu]*e_[~rho,c]*e_[~sigma,d]*(d_[rho](e_[sigma,a]) - d_[sigma](e_[rho,a]));
Define(omegaDef):

The Define command raises "Error, (in Physics:-Define) numeric exception: division by zero" in Schwarschild spacetime (loaded with g_[sc]), but not, say, in Tolman spacetime (loaded with g_[tolman]). Furthermore, if either the first two terms, or the last term, are/is removed in omega, then no error is raised in Schwarzschild spacetime. What is going on?

I need to evaluate a variable inside the function definition in the moment it is defined and not every time it is called. Is there a way around?

a:=3;
f := x-> a*x;
f(t);

a:=4;
f(t);

I want the function "f" to be 3*x even if "a" is modified after the declaration. In Mathematica I am used to the so called immediate assignmet(=) and delayed assignment(:=) for which I cannot find an equivalent command in Maple. 

Any help is appreciated!

Hi MaplePrimes Users!

It’s your friendly, neighborhood tech support team; here to share some tips and tricks from issues we help users with on a daily basis.

A customer contacted us through a Help Page feedback form, asking how to add a row or column in a Matrix. The form came from the Row Operations help page, but the wording of the message suggested that the customer actually wanted to insert a new row or column altogether. Such manipulations can often be accomplished by a command in the ArrayTools package, but the only Insert command currently available is the one for Vectors and 1-D Arrays. Using the Concatenate command from that package, and various commands from the LinearAlgebra package (including the SubMatrix command), we were able to write two custom procedures to perform these manipulations:

InsertRow := proc (A::rtable, n::integer, v::Vector[row])
    local R, C, top, bottom;
    uses LinearAlgebra;
    R := RowDimension(A); C := ColumnDimension(A);
    top := SubMatrix(A, [1 .. n-1], [1 .. C]);
    bottom := SubMatrix(A, [n .. R], [1 .. C]);
    return ArrayTools:-Concatenate(1, top, v, bottom);
end proc:

InsertColumn := proc (A::rtable, n::integer, v::Vector[column])
    local R, C, left, right;
    uses LinearAlgebra;
    R := RowDimension(A); C := ColumnDimension(A);
    left := SubMatrix(A, [1 .. R], [1 .. n-1]);
    right := SubMatrix(A, [1 .. R], [n .. C]);
    return ArrayTools:-Concatenate(2, left, v, right)
end proc:

# test cases:

M := Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]):
v := Vector[row]([2, 2, 2]):
v2 := Vector[column]([2, 2, 2]):
seq(InsertRow(M, i, v), i = 1 .. 4);
seq(InsertColumn(M, i, v2), i = 1 .. 4);

We then reworked this problem using some handy indexing and construction notation that allows our previous procedures to save on the variable constructions and syntax:

InsertRow := proc( A :: rtable, V :: Vector[row], r :: posint )
    return < A[1..r-1,..]; V; A[r..-1,..] >:
end proc:

InsertColumn := proc( A :: rtable, V :: Vector[column], c :: posint )
    return < A[..,1..c-1] | V | A[..,c..-1] >:
end proc:

M := Matrix(3, 3, [seq(i, i = 1 .. 9)]);
A := convert(M, Array);
U := Vector[row]( [ a, b, c ] );
V := convert( U, 'Vector[column]' );
seq(InsertRow( A, U, i ), i=1..4);
seq(InsertColumn( A, V, i ), i=1..4);
seq(InsertRow( M, U, i ), i=1..4);
seq(InsertColumn( M, V, i ), i=1..4);

Hi

For the data presented below, assuming a linear model yields to observe the great amounts of standard errors.

Is there a way (an appropriate command) to find the best statistical model?

 

Y := `<,>`(.2, .2, .2, .2, .2, .3, .3, .3, .3, .3, .3, .35, .35, .35, .35, .35, .35);

X := `<,>`(2, 2.2, 2.4, 2.6, 2.8, 2, 2.2, 2.4, 2.6, 2.8, 3, 2, 2.2, 2.4, 2.6, 2.8, 3);

Z := `<,>`(15, 33.7, 62.8, 188, 394, 5.47, 5.82, 6.21, 8.3, 11.5, 24.1, .372, .485, .675, 1.11, 1.27, 1.35);

Statistics:-Fit(add(add(a[k, n-k]*x^k*y^(n-k), k = 0 .. n), n = 0 .. 2), `<|>`(X, Y), Z, [x, y], summarize = embed)

 

 

I want the output from a line to be used for the definition of a function, but it doesn't work. What am I missing?

x^2;
f := X -> eval(%, x=X);
f(t);

Thank you, Ale

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

I want to find all complex numbers such that 
abs(z)*(z-4-I)+2*I = (5-I)*z.
I tried solve(abs(z)*(z-4-I)+2*I = (5-I)*z, z)
and got the answer is z = -1.
This is a question in a test with multiple choice. The key of question is three numbers.

Is my commant wrong? Where is wrong?

If I have an expression which contains an unknown function f(t) e.g.

ex:=1+exp(f(t))*f(t+1)+f(t/2)

how do I replace it with some defined function F(t)?

Do I need to work with ::anything, i.e. something like

subs(f(t::anything)=F(t::anything),ex)

?

However this doesn't work.


 

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

Dear Maple primes,

Could you, please, help me with numerical solution of an ODE?

The ODE looks like this

dz/dx = f1(x,z) + f2(z)

where f1(x,z) is some simple function of x and z (that does not create any problem), but f2(z) is given as

f2(z) = int(f3(t), t = z1..z2)

The problem appears, when the integral cannot be solved analytically.

Below is an example of the problem (here I chose the function f3(t)= tt as well as other functions, intervals and initial condition only for the sake of illustration of the problem):

restart; with(plots)

INT := Int(t^t, t = .1 .. z(x), method = _DEFAULT)

eq1 := {diff(z(x), x) = x+z(x)+INT, z(.1) = .1}

plot1 := dsolve(eq1, type = numeric, range = .1 .. 1)

odeplot(plot1)


Download z-for_primes_dsolve.mw

Thank you in advance!

Max

Hello!
I'm a beginner in Maple. My question is: is it possible to trim the surface along the intersection line in Maple? There is a problem - inclined surfaces are constructed along the contour of the triangle, they intersect. Is it possible to get a pyramid along the intersection lines?
Thank you!trimming_surfaces.mwtrimming_surfaces.mw
 

NULL

restart; with(plots), with(plottools); with(linalg)

Q1p := 45; Q1po := 75

Q2p := 110; Q2po := 84

Q3p := 63; Q3po := 120

NULL

NULL

NULL

XP := KTX1+(KTX2-KTX1)*t1

YP := KTY1+(KTY2-KTY1)*t1

NULL

NULL

x1 := subs({KTX1 = Q1p, KTX2 = Q2p, t1 = t1}, XP)

y1 := subs({KTY1 = Q1po, KTY2 = Q2po, t1 = t1}, YP)

NULL

x2 := subs({KTX1 = Q2p, KTX2 = Q3p, t1 = t2}, XP)

y2 := subs({KTY1 = Q2po, KTY2 = Q3po, t1 = t2}, YP)

``

NULL

x3 := subs({KTX1 = Q3p, KTX2 = Q1p, t1 = t3}, XP)

y3 := subs({KTY1 = Q3po, KTY2 = Q1po, t1 = t3}, YP)

NULL

za := 0

``

Kriv1 := spacecurve([x1, y1, za, t1 = 0 .. 1], color = brown, scaling = constrained, thickness = 4)

Kriv2 := spacecurve([x2, y2, za, t2 = 0 .. 1], color = green, scaling = constrained, thickness = 4)

Kriv3 := spacecurve([x3, y3, za, t3 = 0 .. 1], color = blue, scaling = constrained, thickness = 4)

NULL

display(Kriv1, Kriv2, Kriv3)

NULL

NULL

xE1 := x1-30*(diff(y1, t1))/sqrt((diff(x1, t1))^2+(diff(y1, t1))^2)

yE1 := y1+30*(diff(x1, t1))/sqrt((diff(x1, t1))^2+(diff(y1, t1))^2)

zE1 := 30

KrivE1 := spacecurve([xE1, yE1, zE1, t1 = 0 .. 1], color = blue, scaling = constrained, thickness = 4)

NULL

xP1 := simplify(xE1+l1*(x1-xE1))

yP1 := simplify(yE1+l1*(y1-yE1))

zP1 := simplify(zE1*(1-l1))

P1 := plot3d([xP1, yP1, zP1], t1 = 0 .. 1, l1 = 0 .. 1, transparency = 0)

display(KrivE1, Kriv1, P1, Kriv2, Kriv3)

``

NULL

xE2 := x2-30*(diff(y2, t2))/sqrt((diff(x2, t2))^2+(diff(y2, t2))^2)

yE2 := y2+30*(diff(x2, t2))/sqrt((diff(x2, t2))^2+(diff(y2, t2))^2)

zE2 := 30

KrivE2 := spacecurve([xE2, yE2, zE2, t2 = 0 .. 1], color = blue, scaling = constrained, thickness = 4)

NULL

xP2 := simplify(xE2+l2*(x2-xE2))

yP2 := simplify(yE2+l2*(y2-yE2))

zP2 := simplify(zE2*(1-l2))

P2 := plot3d([xP2, yP2, zP2], t2 = 0 .. 1, l2 = 0 .. 1, transparency = 0)

display(KrivE2, Kriv2, P2)

NULL

NULL

NULL

xE3 := x3-30*(diff(y3, t3))/sqrt((diff(x3, t3))^2+(diff(y3, t3))^2)

yE3 := y3+30*(diff(x3, t3))/sqrt((diff(x3, t3))^2+(diff(y3, t3))^2)

zE3 := 30

KrivE3 := spacecurve([xE3, yE3, zE3, t3 = 0 .. 1], color = blue, scaling = constrained, thickness = 4)

NULL

xP3 := simplify(xE3+l3*(x3-xE3))

yP3 := simplify(yE3+l3*(y3-yE3))

zP3 := simplify(zE3*(1-l3))

P3 := plot3d([xP3, yP3, zP3], t3 = 0 .. 1, l3 = 0 .. 1, transparency = 0)

display(KrivE3, Kriv3, P3)

NULL

NULL

NULL

L22 := solve(zP2 = zP1, l2)

L111 := solve(subs(l2 = L22, yP2 = yP1), l1)

L222 := subs(l1 = L111, L22)

T11 := solve(subs(l2 = L222, l1 = L111, xP2 = xP1), t1)

L2T := subs(t1 = T11, L222)

L1T := subs(t1 = T11, L111)

LP12 := spacecurve([XT12, YT12, ZT12, t2 = 0 .. 1], color = red, scaling = constrained, thickness = 1)

PLOT3D(CURVES([[110., 84., 0.], [108.7339864, 84.33411040, .5045906412], [107.4679728, 84.66822079, 1.009181282], [106.2019593, 85.00233119, 1.513771924], [104.9359457, 85.33644158, 2.018362565], [103.6699321, 85.67055198, 2.522953207], [102.4039185, 86.00466237, 3.027543849], [101.1379050, 86.33877277, 3.532134491], [99.87189139, 86.67288316, 4.036725133], [98.60587781, 87.00699356, 4.541315775], [97.33986423, 87.34110395, 5.045906417], [96.07385066, 87.67521435, 5.550497059], [94.80783708, 88.00932474, 6.055087701], [93.54182350, 88.34343514, 6.559678343], [92.27580993, 88.67754554, 7.064268985], [91.00979635, 89.01165593, 7.568859626], [89.74378277, 89.34576633, 8.073450268], [88.47776919, 89.67987672, 8.578040910], [87.21175562, 90.01398712, 9.082631552], [85.94574204, 90.34809751, 9.587222194], [84.67972846, 90.68220791, 10.09181284], [83.41371488, 91.01631830, 10.59640348], [82.14770131, 91.35042870, 11.10099412], [80.88168773, 91.68453909, 11.60558476], [79.61567415, 92.01864949, 12.11017540], [78.34966058, 92.35275989, 12.61476605], [77.08364700, 92.68687028, 13.11935669], [75.81763342, 93.02098068, 13.62394733], [74.55161984, 93.35509107, 14.12853797], [73.28560627, 93.68920147, 14.63312861], [72.01959269, 94.02331186, 15.13771926], [70.75357911, 94.35742226, 15.64230990], [69.48756554, 94.69153265, 16.14690054], [68.22155196, 95.02564305, 16.65149118], [66.95553838, 95.35975345, 17.15608182], [65.68952480, 95.69386384, 17.66067247], [64.42351123, 96.02797424, 18.16526311], [63.15749765, 96.36208463, 18.66985375], [61.89148407, 96.69619503, 19.17444439], [60.62547050, 97.03030542, 19.67903503], [59.35945692, 97.36441582, 20.18362567], [58.09344334, 97.69852621, 20.68821632], [56.82742976, 98.03263661, 21.19280696], [55.56141619, 98.36674700, 21.69739760], [54.29540261, 98.70085740, 22.20198824], [53.02938903, 99.03496780, 22.70657888], [51.76337545, 99.36907819, 23.21116953], [50.49736188, 99.70318859, 23.71576017], [49.23134830, 100.0372990, 24.22035081], [47.96533470, 100.3714094, 24.72494146]], COLOUR(RGB, 1.00000000, 0., 0.)), THICKNESS(1), SCALING(CONSTRAINED))

(1)

``

NULL

NULL``

L22 := solve(zP2 = zP3, l2)

L333 := solve(subs(l2 = L22, yP2 = yP3), l3)

L222 := subs(l3 = L333, L22)

T33 := solve(subs(l2 = L222, l3 = L333, xP2 = xP3), t3)

L2T := subs(t3 = T33, L222)

L3T := subs(t3 = T33, L333)

LP32 := spacecurve([XT32, YT32, ZT32, t2 = 0 .. 1], color = red, scaling = constrained, thickness = 3)

PLOT3D(CURVES([[82.69885121, 48.35683352, 44.89752824], [82.29683384, 49.81893896, 43.98125215], [81.89481646, 51.28104440, 43.06497607], [81.49279909, 52.74314984, 42.14869998], [81.09078172, 54.20525528, 41.23242389], [80.68876435, 55.66736072, 40.31614780], [80.28674698, 57.12946616, 39.39987171], [79.88472960, 58.59157160, 38.48359563], [79.48271223, 60.05367704, 37.56731954], [79.08069486, 61.51578248, 36.65104345], [78.67867749, 62.97788792, 35.73476736], [78.27666012, 64.43999336, 34.81849127], [77.87464274, 65.90209880, 33.90221519], [77.47262537, 67.36420425, 32.98593910], [77.07060800, 68.82630969, 32.06966301], [76.66859063, 70.28841513, 31.15338692], [76.26657325, 71.75052057, 30.23711083], [75.86455588, 73.21262601, 29.32083475], [75.46253851, 74.67473145, 28.40455866], [75.06052114, 76.13683689, 27.48828257], [74.65850376, 77.59894233, 26.57200648], [74.25648639, 79.06104777, 25.65573039], [73.85446902, 80.52315321, 24.73945431], [73.45245165, 81.98525865, 23.82317822], [73.05043428, 83.44736409, 22.90690213], [72.64841690, 84.90946954, 21.99062604], [72.24639953, 86.37157498, 21.07434995], [71.84438216, 87.83368042, 20.15807387], [71.44236479, 89.29578586, 19.24179778], [71.04034741, 90.75789130, 18.32552169], [70.63833004, 92.21999674, 17.40924560], [70.23631267, 93.68210218, 16.49296951], [69.83429530, 95.14420762, 15.57669343], [69.43227792, 96.60631306, 14.66041734], [69.03026055, 98.06841850, 13.74414125], [68.62824318, 99.53052394, 12.82786516], [68.22622581, 100.9926294, 11.91158907], [67.82420844, 102.4547348, 10.99531298], [67.42219106, 103.9168403, 10.07903690], [67.02017369, 105.3789457, 9.162760809], [66.61815632, 106.8410511, 8.246484721], [66.21613895, 108.3031566, 7.330208633], [65.81412157, 109.7652620, 6.413932545], [65.41210420, 111.2273675, 5.497656457], [65.01008683, 112.6894729, 4.581380368], [64.60806946, 114.1515784, 3.665104280], [64.20605209, 115.6136838, 2.748828192], [63.80403471, 117.0757892, 1.832552104], [63.40201734, 118.5378947, .9162760162], [62.99999996, 120.0000001, -0.8979507982e-7]], COLOUR(RGB, 1.00000000, 0., 0.)), THICKNESS(3), SCALING(CONSTRAINED))

(2)

NULL``

L33 := solve(zP3 = zP1, l3)

L111 := solve(subs(l3 = L33, yP3 = yP1), l1)

L333 := subs(l1 = L111, L33)

T11 := solve(subs(l3 = L333, l1 = L111, xP3 = xP1), t1)

L3T := subs(t1 = T11, L333)

L1T := subs(t1 = T11, L111)

LP13 := spacecurve([XT13, YT13, ZT13, t3 = 0 .. 1], color = red, scaling = constrained, thickness = 1)

PLOT3D(CURVES([[89.14619532, 109.5415219, 28.16031418], [88.24525256, 108.8365929, 27.58561389], [87.34430980, 108.1316638, 27.01091360], [86.44336704, 107.4267348, 26.43621331], [85.54242428, 106.7218058, 25.86151302], [84.64148151, 106.0168768, 25.28681273], [83.74053875, 105.3119478, 24.71211244], [82.83959598, 104.6070187, 24.13741215], [81.93865322, 103.9020897, 23.56271186], [81.03771046, 103.1971607, 22.98801157], [80.13676769, 102.4922317, 22.41331128], [79.23582493, 101.7873027, 21.83861099], [78.33488217, 101.0823736, 21.26391070], [77.43393941, 100.3774446, 20.68921041], [76.53299664, 99.67251561, 20.11451012], [75.63205388, 98.96758659, 19.53980983], [74.73111112, 98.26265757, 18.96510954], [73.83016835, 97.55772855, 18.39040925], [72.92922559, 96.85279953, 17.81570896], [72.02828283, 96.14787051, 17.24100866], [71.12734006, 95.44294149, 16.66630837], [70.22639730, 94.73801248, 16.09160808], [69.32545454, 94.03308346, 15.51690779], [68.42451177, 93.32815444, 14.94220750], [67.52356901, 92.62322542, 14.36750721], [66.62262625, 91.91829640, 13.79280692], [65.72168348, 91.21336738, 13.21810663], [64.82074072, 90.50843836, 12.64340634], [63.91979796, 89.80350934, 12.06870605], [63.01885519, 89.09858032, 11.49400576], [62.11791243, 88.39365131, 10.91930547], [61.21696967, 87.68872229, 10.34460518], [60.31602690, 86.98379327, 9.769904891], [59.41508414, 86.27886425, 9.195204600], [58.51414138, 85.57393523, 8.620504310], [57.61319861, 84.86900621, 8.045804020], [56.71225585, 84.16407719, 7.471103729], [55.81131309, 83.45914817, 6.896403439], [54.91037032, 82.75421915, 6.321703149], [54.00942756, 82.04929013, 5.747002858], [53.10848480, 81.34436112, 5.172302568], [52.20754204, 80.63943210, 4.597602278], [51.30659927, 79.93450308, 4.022901987], [50.40565651, 79.22957406, 3.448201697], [49.50471375, 78.52464504, 2.873501407], [48.60377098, 77.81971602, 2.298801116], [47.70282822, 77.11478700, 1.724100826], [46.80188546, 76.40985798, 1.149400536], [45.90094269, 75.70492896, .5747002453], [44.99999991, 74.99999993, -0.5632062994e-7]], COLOUR(RGB, 1.00000000, 0., 0.)), THICKNESS(1), SCALING(CONSTRAINED))

(3)

NULL

``

display(LP12, LP13, LP32, P1, P2, P3, Kriv1, Kriv2, Kriv3)

 

``

``

``

``

 

Download trimming_surfaces.mw

I really love this feature of course because it just allows you to learn so much about function properties via comparative learning processes, but I would also love to have the ability to:

1) Add elements to the list that is stored under known_functions:

FunctionAdvisor(known_functions);

 

2) Add my own categories of information such as the ones that exist like DE, branch_cuts, etc

I want to know about some algorithms used by Maple, if there is a way to dig through the code.

Hello!

I am currently trying to plot the function: sqrt(x^2+y^2-c), where x & y are variables in cartesian coordinates, and c is an arbitrary real constant. I came across a jagged edged plot when I asked maple to plot:

sqrt(x^2+y^2-c)       *** Code below ***

Explore(plot3d([sqrt(x^2+y^2-c),-sqrt(x^2+y^2-c)],x=-2..2,y=-2..2,numpoints=10000),c=-1..1)

So I entered in the "Re" command to take the real part:

Explore(plot3d([Re(sqrt(x^2+y^2-c)),Re(-sqrt(x^2+y^2-c))],x=-2..2,y=-2..2,numpoints=10000),c=-1..1)

This smoothed the plot out at the ring x^2+y^2=1, but however also added what looks like a solid disc as well. Is there a way I can plot the function correctly without this disc in the middle?

Thanks!

solve_V_alfa.mws

 

I'm trying to solve two simultaneous equations for velocity, V, and angle of inclination, alfa, given the range, ranj and maximum height, H.  The solve part works fine, but gives me several unwanted complex solutions.  I was trying to put the solutions in a list so that I could access them.  The text below is rather verbose, but I've left comments in as a possible educational aid for people understanding expression sequences, and sets. 

restart:
#interface(imaginaryunit, errorbreak=0, errorcursor=true, #labelling=false):
#with(SolveTools);

# Investigating sets and expression sequences
#S:={q, w,e}:
S:=7,2,5:
whattype(S);
L4:=convert(S,list): #Doesn't work for expression sequences
L4:=[S]; # this converts the expression sequence to a list, L4
L4[3]; # outputs 3rd element of L4 which is 5
# End of investigation

print(`Next part - solving two equations: Ranj and height H given`);
print(`To find angle of inclination, alfa, and velocity, V`);
g:=9.81:Ranj:=80:H:=15:
L:=solve({4*V^2*cos(alfa)^2-g*Ranj^2/(Ranj*tan(alfa)-2*H), Ranj*g-V*sin(2*alfa)},{V, alfa}): #::real}):
#L:=solve([4*V^2*cos(alfa)^2-g*Ranj^2/(Ranj*tan(alfa)-2*H), #Ranj*g-V*sin(2*alfa)],{V, alfa}): #::real}):
# ::real, alfa::real:
printf("L is of type %a", whattype(L));
#whattype(L);
#L2:=convert(L,list); #gives error message
L2:=[L]:
L2;
print(`Next: To distinguish between real and complex solutions`);
print(`Output in if statement is not working as expected.`);
#nops([L]);
for i from 1 to nops([L]) do
if type(L[i],complex(float)) then
#if type(L[i],nonreal) then
printf("Complex solution for i=%d\n",i);
else
printf("else part of if: i=%d\n",i);
print( L[i]);
end if;
end do; #for

Download solve_V_alfa.txt

 

First 791 792 793 794 795 796 797 Last Page 793 of 2219