Carl Love

Carl Love

28070 Reputation

25 Badges

13 years, 26 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

The root of your problem is the failure to use unapply and really has nothing to do with piecewise, as detailed in Kitonum's Answer. I just want to point out a simpler way to write piecewise expressions: Any piecewise of the form

piecewise(c, e1, not c, e2)

can be expressed as

piecewise(c, e1, e2).

And more generally, any piecewise of the form

piecewise(c[1], e1, not c[1] and c[2], e2, ....,  not `or`(c[1], ..., c[k-1]) and c[k], ek, ...)

can be expressed as

piecewise(c[1], e1, c[2], e2, ..., c[k], ek, ...).

In other words, they are processed left to right such that every condition already includes the negation of all conditions to the left of it.

You have

Sol[1]:= [fsolve([...] union {...})];

That needs to be

Sol[1]:= [fsolve({...} union {...})];

You need to pay attention to whether the interval of integration crosses vertical asymptotes and restrict x accordingly:

int((s^3-5*s^2+1)/(s+2)^2, s = 0 .. x) assuming x > -2;

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.

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