Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Jjjones98 It is common for respondents on MaplePrimes to end their example commands with semicolons because that used to be required for single-command input. These terminal semicolons are not parts of the commands and are not meant to be included when those commands are used as subexpressions in other expressions. So, remove the internal semicolon.

@Jjjones98 But vv's is a procedure, not a direct command.

@Kitonum I didn't mean to give the impression that one couldn't animate a plot3d. However, it was pretty clear to me that the OP wanted a 2D animation. This is afterall the equation of a wave moving through a one-dimensional object, a string.

@st0812 You can export a Maple worksheets as a PDF. Use "Export as" from the File menu. This will include the code, text, results, and graphics, and it'll be viewable by anyone, regardless of whether they have Maple.

@st0812 To animate that, change plot3d to plot.

@rstellian Here's another way, which I like better because it makes it clear that you're trying to pad x with leading zeros so that it's the same length as X:

scm:= (X::posint, x::posint)-> nprintf("%0*d", length(X), x):

Also, I changed ilog10 to length in the Answer above.

@Preben Alsholm The button only appears on posts (questions, answers, replies) that have no responses and whose authors have 10 or fewer reputation points. It has always been that way, ever since the spam button has existed.

You wouldn't do this with nested if statements. Every practical computer language (above the level of assembler) has a looping command that increments an index variable (i in your case) for each pass through the loop. That command in Maple is for, as used in John Fredsted's Answer below.

To directly answer the question that you pose in your title: Yes, that has happened to me a few times. I can't recall how it got fixed, but it did.

You should upload your worksheet as a file attachment rather than as a screenshot. To do that, use the green uparrow on the toolbar in the MaplePrimes editor.

@weidade37211 If R is your random variable, try Statistics:-DensityPlot(R) (*footnote). That'll give you a plot of vertical columns whose heights are the probabilities and whose horizontal coordinates are the "support" (i.e., data values). If that's not what you want, let me know.

The plot command that you suggest doesn't work very well because the ProbabilityFunction is only nonzero at discrete values (which plot won't be able to deduce because it's discontinuous). But ultimately it can be done with plot using some finesse to get exactly what you want.

*footnote: Although "density" is used in the command's name, it actually uses either the PDF or the ProbabilityFunction, whichever is appropriate. The needed information is stored in the module that encodes the random variable.

@Jasagredo Nearly all writers who write lengthy Maple code store that code in plaintext files rather than worksheets. Those plaintext files can be handled by Git. There are two main ways to then use that code in a worksheet: The first is to store it in a library; the second is to read it into the worksheet with the read command (see ?read). I recommend that you start with the second way.

To teach yourself Maple, as I myself have done, I recommend that you start with the help pages whose names begin Programming Guide (see ?ProgrammingGuide). These pages used to be distributed in book form, but, sadly, they no longer are.

@Cryme You can express the inverse function symbolically with RootOf. Then Maple will know how to take the derivative, and it'll still be able to do numeric things like plotting.

f:= x-> ln(x)+x;
g:= y-> RootOf(f(x)=y, x, 0..10);
D(g)(2);
D(g)(2.);
plot(g, 1..10);

 

@Markiyan Hirnyk 

I wrote "algebraic expression e that needs to be interpreted as an equation", NOT "algebraic expression e, which needs to be interpreted as an equation". In English that comma makes a huge difference in the meaning. In the former "that needs to be..." is called a restrictive clause; in the latter "which needs to be..." is called a non-restrictive clause. A restrictive clause defines a proper subset of the set described by its antecedent noun phrase; a non-restrictive clause applies to the whole set. To reduce the confusion, some writers, myself included, always introduce a restrictive clause with that rather than which, although the formal rule allows either, which makes the presence of the comma the only definitive difference. See the Wikipedia article "English relative clauses".

So, regarding your example diff(x^2, x), my statement from my previous Reply says nothing about it at all because it is not an expression that needs to be interpreted as an equation. On the other hand, in solve(diff(x^2, x), x), it is an expression that needs to be interpreted as an equation, so the correct interpretation is 2*x = 0.

Please stop reading and interpreting my posts as if you thought that I was an idiot. Only an idiot would say that diff(x^2, x) should in general be interpreted as 2*x = 0. If you are drawn to such a conclusion, then you should suspect that your interpretation of what I wrote is wrong.

In any situation in Maple where one has an algebraic expression e that needs to be interpreted as an equation, the interpretation is e = 0. I think that this is what Markiyan has been trying to convey to you.

@Jasagredo You asked:

  • I noticed that Irreduc works with mod, yet it is undocumented at ?mod. How can I find all such functions?

Any function X that works with mod corresponds to a procedure named `mod/X`, which corresponds to an entry named "mod/X.m" in the library. The following finds all such entries:

map(
   x-> nprintf("%s", x[1][5..-3]), 
   select(x-> x[1][1..4] = "mod/", LibraryTools:-ShowContents())
);

That yields 136 results for me (in Maple 2016). There are probably many of those, particularly among the ones with compound names, for which it doesn't make sense to use them at the top level.

  • Do I need to follow all arithmetic with a call to Expand to reduce high powers of the field extension element?

By itself, mod only reduces the coefficients. You need to have a call to something to reduce the exponents. If you don't have anything else that you need to call, then it might as well be Expand. Note that instead of

a*b mod p;
Expand(%) mod p;

you could simply use

Expand(a*b) mod p;

  • What does $ mean?

The $ is a binary infix operator expressing repetition. So x $ 2 is the same as x, x. See ?$.

  • What does 2: mean?

Don't make the mistake of assuming that if two characters appear together offset by whitespace that they are a syntactic unit. In this case, the 2 is the second argument of $. The : is just like a ;, and it means in addition that the display of the output of the proceeding command is to be suppressed.

  • I thought that % referred to the output of the preceeding command.

It does.

  • What does <%> mean?

Enclosing something in < > makes it a column vector (which'll display neatly as a column). For display purposes only, I wanted the output of the preceeding command, the two random polynomials, to display as a column.

 

First 344 345 346 347 348 349 350 Last Page 346 of 708