Carl Love

Carl Love

28110 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@vahid65 I thank you for your interest in my work, but I'm not currently associated with any university or other academic or research institution. I am a private tutor of mathematics and related subjects. I tutor both online and in person. My usage of Maple comes from my pure love of Maple and MaplePrimes and currently serves no other purpose. If you'd like to arrange an online session, contact me privately (use the More -> Contact Author menu at the bottom of this message).

Best regards,
Carl Love, formerly known as Carl Devore

@JohnS There's no inconsistency, and this behavior is the same as most other programming languages. Let me try to explain. M is the name (address of) a Matrix, which is a container; each M[i,j] is a name of (an address of) some object in the container. Changing the contents of the container does not change the container. Here's an analogy: M is a house, and each M[i,j] is a person living in the house. Even if every person is replaced by another person, it's still the same house, and it still has the same address.

But assigning to M is changing the house. Let's say that M stands for Mary's house (meaning the house owned by Mary---whether she actually lives there is irrelevant). That house has an address. Let's say that Mary sells this house and buys another house at a different address. She names the new house M. That's equivalent to assigning to M.

If the system weren't set up this way, then inplace operations would be impossible; and, as you noted earlier, that would be a major waste of memory.

@adrian5213 The command iquo(N,n,r) returns the integer quotient of N divided by n and returns the remainder in the variable r. If you need more information than that, you'll have to look at the source code, which is in the GNU Multi Precision Arithmetic Library and is open source.

Yes, of course you can use variables with &B as in

&B QR(z, rn);

There's no way to both represent something as an integer and for it to have leading zeros. If you want leading zeros, you should use a symbol or string representation.

P.S. A list representation, as suggested by John, also works. It's the option with the most flexibility, but also the least-compact representation, both internally and as displayed. It's because of this lack of compactness that I chose not to mention it earlier.

@Kitonum The order of equations may be irrelevant mathematically, but computationally it can have a major effect on the speed with which a solution is found.

@J Rod As a workaround, you can use character style Maple Input (aka 1D input) rather than the default 2D Input. The character style is the leftmost pull-down on the context toolbar (the bottommost toolbar). You can make this change permanently or for the session by using the Tools -> Options menu.

A great many long-time users, me included, use exclusively Maple Input.

@JohnS 

Inplace operation is always possible without using LinearAlgebra and without using global. Though I do wonder why you'd be restricted to not using any command from LinearAlgebra. Perhaps it's an exercise.

One is allowed to assign to a parameter subscripted. Thus, the example that you mentioned can be coded like this:

MyProc:= proc(
     M::Matrix, x, y,
     i::depends(And(posint, satisfies(i-> i <= op([1,1], M)))),
     j::depends(And(posint, satisfies(j-> j <= op([1,2], M))))
)
     M[i,j]:= M[i,j]*x^i*y^j;
     [][]
end proc:

And used like this:

A:= LinearAlgebra:-RandomMatrix(2,2);

MyProc(A, x, y, 2, 2);
A;

If a procedure performs inplace operations, then there's no need for it to have a return value. So it's best to explicitly make the return value NULL. The symbol that I like to use, [][], is equivalent to NULL.

 

@JohnS Yes, it's possible to do inplace operations, and there's no need to make global. I didn't mention this possibility because perhaps it's a bit too sophisticated for this OP at this time. All matrix arithmetic commands can be handled by commands in the LinearAlgebra package, and all such commands have an inplace option. An example of such a command that can be used in this case is MatrixMatrixMultiply

Note that it's usually not appropriate for a procedure to overwrite a parameter unless the caller specifically requests inplace operation.

@Østerbro Here's the meaning of the error message: A name is an object that can be assigned to. Think of it as a variable name. Anything else is an object. So, if you try to assign to something other than a name, it's an "illegal use of an object as a name."

@Mikael Hakman Nonetheless, if the OP could provide me with such a trivial example, I could extend it to the case where g can't be inverted. 

Would you please provide a simplified example of what you want, i.e., an example where g can be symbolically inverted? If you can do that, then I can show you how to extend it to cases where g can't be symbolically inverted. As it stands, I can't see how what you want is any different from a parametric plot. 

Showing the curve, the tangent line, and the point (a, f'(a)) together on one plot makes no sense. Are you sure that you don't mean the point (a, f(a)), the point where the tangent line touches the curve? 

@anton_dys The reason that I used eval is that it would adequately handle the cases where dsolve returns several functions in one solution. You can't do that with rhs. Your solution also has the flaw that it causes the dsolve to be executed every time u is invoked. You must use unapply to avoid that. 

What's the program supposed to do if the byte is greater than 7 after the random bit is flipped? 

@acer Thanks for those answers. Now some more-serious questions about objects (for my learning).

In your module above, what would cause ModuleCopy to be invoked, and what would determine the number of arguments that it had?

Where is it specified that the magnitude is the left operand and the argument the right operand?

Can invocations of `&angle` within the module be replaced with ModuleApply?

Why doesn't `*` contain an if nargs=1 then return args[1] clause as appears in `+`?

 

First 428 429 430 431 432 433 434 Last Page 430 of 710