Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

Do not worry about the datatype issue: It is somewhat misleading, although the error message is true. The source of the error is that dsolve is generating symbolic expressions when it is expecting numeric expressions. It looks like your variable U has not been defined. Certainly it has no definition in the code that you provided. Also, it looks like you are trying to use linalg[grad], but you have referred to it as simply grad. Since linalg is deprecated, you should replace grad with VectorCalculus:-Gradient.

This operation is common enough that there's a single command for it: icontent.

In your initial conditions, ics, you use lowercase f. In the rest of your system, you use uppercase F.

I can't see your original list of strings, but I assume it's something like

L:= ["z", "d", "i", "p", "s", "y"];

If that is so, then do

map(convert, L, symbol);

 

Another option (not necessarily better than the above) for combining two lists is zip:

`+`(zip((x,y)-> x*ln(y), X, Y)[]);
or, better yet,
`+`(zip(`*`, X, ln~(Y))[])

In Maple 2015, make that

add(zip((x,y)-> x*ln(y), X, Y));
or, better yet,
add(zip(`*`, X, ln~(Y)));

Assuming that haa, and bb are suitably defined functions of c, then you need to add undefined at the end of the piecewise. It becomes the "otherwise" clause, thus taking care of the regions that are not covered by your ranges. Then, include the discont option to plot. So,

BB:= piecewise(
     -1.57 < c and c < -1.56, h,
     -0.06< c and  c < -0.05, aa,
     -0.5< c and c < 0.04, bb,
    undefined
);
plot(BB, c= -2..2, discont);

Regarding your first question, see ?piecewise. But your inequalities are nonsense: they imply -2 < -3 and -1 < -2.

Regarding your second question, you'll need to show the code that gives that error.

Statistics:-Sample returns a Vector, even if you ask for a sample of size 1. So, you need to index for the element before you subtract it from 200.

X[1]:= Statistics:-Sample(Binomial(200, .5), 1)[1];
for i to 10 do  X[i+1]:= Statistics:-Sample(Binomial(200-X[i], .5), 1)[1]  end do;

AFAIK, Maple's for loop syntax is pretty much the same as most other languages. It's done like this:

list_A:= table():  list_B:= table():  list_C:= table():
more:= true:
for k while more do
     #Do computation that computes A, B, and C and sets the
     #boolean value `more`.
     list_A[k]:= A;  list_B[k]:= B;  list_C[k]:= C
end do:
list_A:= convert(list_A, list);
list_B:= convert(list_B, list);
list_C:= convert(list_C, list);

You'll get a much smoother ellipsoid if you use regular plot3d and parametric plotting, like this:

plot3d(
     [2*sin(t)*cos(u), 3*cos(t)*cos(u), 4*sin(u)], t= 0..2*Pi, u= -Pi/2..Pi/2,
     scaling= constrained
);

cos(2*t) is the same thing as 2*cos(t)^2 - 1.

You need more points. One thousand points is a very small amount for an implicitplot. Use numpoints= 10000 and also add gridrefine= 3.

The student[showtangent] command is old and deprecated. It's better to use Student:-Calculus1:-Tangent, which automatically shows the point of tangency and puts a good caption on the plot.

f:= x-> x^2-2*x:
a:= 1.5:
T:= Student:-Calculus1:-Tangent(
     f(x), x= a, -10..10, output= plot,
     pointoptions= [symbol= diamond, symbolsize= 24, color= red]
):
N:= plot(-1/D(f)(a)*(x-a)+f(a), x= -10..10, color= black, legend= ["the normal"]):
plots:-display(
     [subs(" and a tangent line."= " and a tangent line and a normal line.", T), N],
     view= [-10..10, -10..10], scaling= constrained
);

You can cut and paste to MaplePrimes plaintext (1D) Maple input and most 2D Maple output. It won't work for Matrices, Vectors, and plots. For plots, you can Export them using a right-click context menu. I always export to PNG (except for animations, for which I use GIF). Then upload them to MaplePrimes using the green uparrow tool, which is the last item on the second row of the toolbar in the MaplePrimes editor. You can also use this tool to upload entire worksheets.

First question: Click on the Edit menu, select Execute, then select either Selection or Worksheet.

Second question: Use the time() command. The most common way is to place

st:= time():

at the beginning of the block of code that you want to time. Also place

time()-st;

at the end of the block.

The two-argument form of map is called zip. So, for that command that doesn't work, change map to zip.

First 269 270 271 272 273 274 275 Last Page 271 of 395