Robert Israel

6577 Reputation

21 Badges

18 years, 215 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are answers submitted by Robert Israel

> limit*(x^4/(x^2+y^2), {x = 0, y = 0});

First problem is that you have a multiplication sign * after the limit.
Second problem is that limit isn't clever enough to find this limit.

> limit((x^2-2*y^3-4*z)/(x+y^3+2*z), {x = 2, y = 1, z = 0});

This one works fine for me: the result is 2/3.

Part of the problem is the terminology: the "lookup table" is not of the Maple type table, it is a list.  Also the result of insertpattern must be assigned to the name of the "lookup table" in order to be used.  Try this.

> Data:= compiletable([]);
  Data := insertpattern(1=2, Data);
  Data := insertpattern(3=4, Data);
  tablelook(3, Data);

 

 

See the help page ?Optimization,LPSolveMatrixForm.  This is for solving a linear programming problem:

maximize c^%T.x
subject to A.x <= b
bl <= x <= bu


  For example, to maximize x[1] + 2*x[2] subject to
3*x[1] +4*x[2] <= 5
6*x[1]+7*x[2]<=7
all x[i]>=0

you could use

with(Optimization):
LPSolve(<1,2>,[<<3,6>|<4,7>>, <5,7>], maximize, assume=nonnegative);

which would be the same as

LPSolve(<1,2>,[<<3,6>|<4,7>>, <5,7>], [<0,0>,<infinity,infinity>],maximize);

 

The plot3d command is for a surface, not a curve.  What was the complete command you used? 

The default for plotting is that the axes go from the least to the greatest values of the coordinate.  To change that, you can use the view option.  As for scaling of the z axis, the options are constrained (to use the same scale as for the x and y axes) and unconstrained (which is the default).

Do you mean something like this?

> seq(mul((365-n)/365, n=1..N), N=1..5);

Or perhaps this?

> f:= N -> mul((365-n)/365, n=1..N);
  f(1), f(3), f(5);

Or this?

> Q:= product((365-n)/365, n=1..N);
  eval(Q, N=5);

Hmm, I'm surprised that the product didn't get expressed in terms of GAMMA or pochhammer.

 

 

 

It sounds like what you want is a stochastic differential equation.

This one can be solved in terms of integrals, if you leave f(t) unspecified:

> dsolve({(D@@2)(x)(t)+10*x(t)=f(t), x(0)=x0, D(x)(0)=v0}, x(t));
x(t) = 1/10*sin(10^(1/2)*t)*v0*10^(1/2)+cos(10^(1/2)*t)*x0+1/10*10^(1/2)*(Int(cos(10^(1/2)*_z1)*f(_z1),_z1 = 0 .. t)*sin(10^(1/2)*t)-Int(sin(10^(1/2)*_z1)*f(_z1),_z1 = 0 .. t)*cos(10^(1/2)*t))

 But perhaps you want a numerical solution for a specific random function.  That can be done using dsolve(numeric, ...) with a system defined using procedures: see the help page ?dsolve,numeric,IVP.

The problem is that you're trying to evaluate seq( traj[k], k = 1 .. J) where J is a symbolic variable.

Try this:

> display([seq(plot([traj[1..J]]), J=2..5)], insequence=true);


 

The LambertW function has branches indexed by integers: LambertW(_Z7, _Z) is the _Z7'th branch as a function of _Z, where _Z7 is an arbitrary integer. 

_Z is the variable in a RootOf, i.e. RootOf(f(_Z)) means some z such that f(z) = 0.

 

The stats package is deprecated: use Statistics instead. 

If data is your list of lists [elm1,elm2,elm3,elm4], then to get the list of elm1's, you can use

> data1 := map2(op,1,data);

To get the mean of this list:

> Statistics[Mean](data1);

To get the frequency distribution,

> Statistics[Tally](data1);

 

Your first error is in

f:=x-> (x*(cos(x)))- ((x*x(sin(x/2))));

The way you wrote it, you're evaluating the function x at sin(x/2).  Perhaps you mean

f:=x-> x*cos(x) - x^2*sin(x/2);

Another error seems to be that you are using f as a local variable in the hermite procedure, and not assigning it any value there.  The definition of the global variable f outside the procedure has no effect on this local f.

From two polynomials in x,y,z you can eliminate one of the variables (say z) using resultant, obtaining the equation of the intersection curve in x and y.

Thus:

> resultant(x^2 + y^2 - z, 1/2*(x+y)+5-z, z);

x^2+y^2-(1/2)*x-(1/2)*y-5

The Maple tag is acting up again: that should be x^2+y^2-(1/2)*x-(1/2)*y-5.

So the intersection curve satisfies x^2+y^2-(1/2)*x-(1/2)*y-5=0

For example, let's say you wanted to plot the inequality x^2 + y^2 <= 5 (which we'll have to rewrite as x^2 + y^2 - 5 <= 0).

On the Tools menu, choose Assistants, Plot Builder...

Under Expressions, click on Add.

Type x^2 + y^2 - 5 and click Accept.

Click OK.

Under Select Plot, choose 2-D implicit plot.

Click Options.

Check the box next to Filled Regions.

Click Plot.

Your plot should appear, with the region where x^2 + y^2 - 5 < 0 in red, the curve x^2 + y^2 - 5 = 0 in black, and the region where x^2 + y^2 - 5 > 0 in yellow.

Try:

> eval(ApproximateInt(...), LEGEND=NULL);

The expression you posted does not give that error, which would indicate that you made a mistake in parentheses.  In the Standard interface, 1d input has automatic matching of delimiters,: if you put the cursor after a "(" or ")", the corresponding ")" or "(" will have a little box around it. 

The error "invalid input: diff expects 2 or more arguments, but received 1" means pretty much what it says: you have to tell the differentiation command diff what variable(s) to differentiate with respect to.  For example, you might use diff(y(x),x) for diff(y(x),x), but diff(y(x)) without a second argument is incorrect.

There is something else strange about your expression: I suspect that you didn't really mean y^((2/(3)))(x), which tells Maple to evaluate the "function" 2/3 at x (the result of that being 2/3), but rather y(x)^(2/3).

 

 

Another way, if you want separate plots rather than an Array of them, is to use print.

For example:

> p := proc()
   print(plot(x^2, x=0..2));
   print(plot(y^3, y=-2..2));
end proc:
> p();

 

First 95 96 97 98 99 100 101 Last Page 97 of 138