Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 357 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

Have a look at ?Statistics,KernelDensity.

The instructions don't say to replace solve with evalf , they just say to use evalf. The intention was that you first get exact expressions for the critical points with solve. This involves solving some quadratic equations, so there are some square roots in these answers if you input the equations with exact fraction coefficients rather than decimals. Then you can get some decimals for these with evalf. Try this

EquationSet:= {
   diff(x(t),t) = -y(t) - z(t), 
   diff(y(t),t) = x(t) + y(t)/5, 
   diff(z(t),t) = 1/5 + (x(t) - 5/2)*z(t)
};
Solut:= [solve(rhs~(EquationSet), {x,y,z}(t), explicit)];
evalf(%);

 

Your matrix essentially specifies a function from R^2 to R^4. So there are 6 dimensions. One possible way to represent this is as four surfaces---one for each coordinate function. These can be shown as a single 3D plot of four surfaces or as four separate frames arranged as a 2 x 2 array. No matter how you represent it as a plot, you'll need ranges for x and y.

Somewhere in your input expression---likely in several places---you have used square brackets [.] were you should've used round parentheses (.). All algebraic grouping in Maple, no matter how deeply nested, is done with parentheses.

The Explore command seems to not work directly with matrices. I get around this using a procedure M to access the matrix.

M:= (i,j)-> m[i,j]:
Explore(
   plots:-pointplot([seq([M(a,k), .1*k], k= 1..op([1,2], m))]), 
   parameters= [a= 1..op([1,1], m)]
); 

 

The domain is given as (x,t) in (-infinity, infinity). Since that interval is given with rounded brackets () rather than square brackets [], the endpoints are not included. Thus, there's no need for you to be able to evaluate your function at infinity.


 

restart:

The following fsolve technique works because one equation is linear and the other polynomial. The linear equation is used to eliminate a variable, then fsolve will return all real roots for a univariate polynomial.

P1:= y^2 = x^3+x^2:
P2:= y = 2*x+1:
Sys:= (lhs-rhs)~({P1,P2}); #Put into equal-to-zero form.
V:= [indets(Sys, name)[]];
E:= eliminate({P1,P2}, V[2]);
#Could've just as well eliminated V[1] above.
map2(eval, eval(V, E[1]), [fsolve(E[2])]);

{y-2*x-1, -x^3-x^2+y^2}

 

[x, y]

 

[{x = (1/2)*y-1/2}, {y^3-9*y^2-y+1}]

 

[[-.6920214716, -.3840429433], [-.3568958679, .2862082642], [4.048917340, 9.097834679]]

(1)

Here's another (easier) way to find all roots for a polynomial system. This one doesn't rely on being able to eliminate a variable.

RootFinding:-Isolate(Sys, V);

[[x = -.6920214716, y = -.3840429433], [x = -.3568958679, y = .2862082642], [x = 4.048917340, y = 9.097834679]]

(2)

Here's another way to plot systems of bivariate polynomials.

algcurves:-plot_real_curve(mul(Sys), V[], gridlines= false);

 

The great thing about plot_real_curve is that it automatically figures out how big to make the viewing window to capture all the intersections.

 

``


 

Download BivarPoly.mw

No, there's no such library command, but it's trivial to write one. It took me two minutes and nine lines of code.

Okay, I fixed it. The problem is the line

F:= (q,x,alpha)-> expand(eval(u, Solu[1]));

This needs to be changed to

F:= unapply(eval(u, Solu[1]), q, x, alpha);

Then you need to remove the assignment to alpha at the beginning of the worksheet and change the colon after the plot command to a semicolon. That's all there is to it!

Because I find it awkward to use a preposition as an adjective, especially for nonnative English users, I use the equivalent terms surjective for "onto",  injective for "one-to-one", and bijective for "one-to-one and onto". If F is a function from finite set A to finite set B given by a procedure F, then the following checks whether it's surjective and/or injective:

Bijective:= (F, A::set, B::set)->
   (FA->
      if FA subset B then 
         'surjective' = evalb(FA = B),
         'injective' = evalb(nops(FA) = nops(A))
      else 
         error "The codomain B is inappropriate"
      end if
   )(F~(A))
:

Examples:

F:= x-> 2*x:
A:= {1,2,3,4,5}:
B:= {2,4,6,8,10}:
Bijective(F, A, B);

     surjective = true, injective = true

A:= {a, b, c, d, e}:
P:= combinat:-randperm(A);

     P:= [a, e, b, c, d]

F:= proc(x) local p; member(x,A,p); P[p] end proc:
Bijective(F, A, A);

     surjective = true, injective = true

Suppose that you have a function Phi(s) whose second derivative is phi(s). Then substitute its second derivative for phi(s) in your original expr:

restart:
expr:= (k*s^2+1)*diff(phi(s),s$2)-k*phi(s)+s*k*diff(phi(s),s):
expr2:= int(int(eval(expr, phi(s)= diff(Phi(s),s$2)), s), s);

(I don't know why things come out so large when I copy-and-paste Maple output. Does anyone know how to control that?)

 

 

The laplace command is in the inttrans (INTegral TRANSforms) package, so you need to use a package-name prefix or a with(inttrans) command:

inttrans:-laplace(exp(3*t)*cos(2*t), t, s);

Considering that you're using Maple 13, inttrans:-laplace may need to be changed to inttrans[laplace], which'll also work in newer Maple.

Let's say that the matrices are named A and B. In the first worksheet, do

save A, B, "MyFile.m":

The MyFile can be anything, but the extension should probably be .m if the matrices are large, as that causes an encoding into a Maple-specific format. In the second worksheet, do

read "Myfile.m": 

At this point, the names A and B will be defined in the second worksheet to whatever they were in the first worksheet at the time of the save.

Because of the special evaluation rules of seq, add, and mul, you have to do

eval((f@Seq)(i, i= 1..2), Seq= seq);

and likewise for the add. The Seq here is just a dummy; it could be any name. And note that i does not get the usual protection against global interference that those special evaluation rules provide.

Here's a completely different method based on the relation being given by a boolean procedure of two arguments rather than by a set of ordered pairs. That is, for x, y in S, R(x,y) must return true if x is related to y and false otherwise.

Matrix methods are used to check symmetry and transitivity.

EqvRel:= (R::procedure, S::set)->
   ((A::Matrix)->
      (
         'reflexive' = andmap(x-> R(x,x), S),
         'symmetric' = ArrayTools:-IsZero(A - A^+),
         'transitive' = ArrayTools:-IsZero(A - signum~(A^2 + A))
      )
   )
   (Matrix(nops(S)$2, (i,j)-> `if`(R(S[i],S[j]), 1, 0), datatype= integer))
:

Examples:

Rel1:= (x,y)-> irem(x-y, 3) = 0:
S:= {'rand()' $ 30}:

EqvRel(Rel1, S);

     reflexive = true, symmetric = true, transitive = true

Rel2:= (x,y)-> x <= y:
EqvRel(Rel2, S);

     reflexive = true, symmetric = false, transitive = true

Rel3:= (x,y)-> x <> y:
EqvRel(Rel3, S);

    reflexive = false, symmetric = true, transitive = false

 

First 184 185 186 187 188 189 190 Last Page 186 of 395