John Fredsted

2238 Reputation

15 Badges

20 years, 164 days

MaplePrimes Activity


These are answers submitted by John Fredsted

You can use either

f(x,y) := x*y*(x^2 - y^2)/(x^2 + y^2):
plot3d(f(x,y),x = -1..1,y = -1..1);

or

expr := x*y*(x^2 - y^2)/(x^2 + y^2):
plot3d(expr,x = -1..1,y = -1..1);

but not mix them as you do [when you write

f(x,y) := x*y*(x^2 - y^2)/(x^2 + y^2) = expr;

expr is not assigned anything, so it is not available for any subsequent plotting]. Both of them produce the same plot:

1808_3DPlot.gif

An object is created using module() ... end module as in the following example:

rectangle := module()
	local length,height;
	export setLength,setHeight,getLength,getHeight,findArea;
	setLength := proc(l) length := l end proc;
	setHeight := proc(h) height := h end proc;
	getLength := () -> length;
	getHeight := () -> height;
	findArea  := () -> length * height;
end module:

Here, rectangle is an object with the two properties length and height, and the five methods setLength, setHeight, getLength, getHeight, and findArea. An example of its use is given by:

rectangle:-setLength(10):
rectangle:-setHeight(20):
rectangle:-getLength(),
rectangle:-getHeight(),
rectangle:-findArea();
                          10, 20, 200

You can also have a procedure return an object, as in the following example (which builds upon the example above):

makeRectangle := proc(l,h)
	module()
		export getLength,getHeight,findArea;
		getLength := () -> l;
		getHeight := () -> h;
		findArea  := () -> l * h;
	end module
end proc:

An example of its use is given by:

rectangle1 := makeRectangle(10,20):
rectangle2 := makeRectangle(20,40):
rectangle1:-getLength(),
rectangle1:-getHeight(),
rectangle1:-findArea();
rectangle2:-getLength(),
rectangle2:-getHeight(),
rectangle2:-findArea();
                          10, 20, 200
                          20, 40, 800

For much more on modules, you could, for instance, see chapter 2 of the Maple 11 Advanced Programming Guide.

I have just exported as HTML with GIF images some simple worksheets containing, among other things, less than signs and greater than signs, without facing any problems.

Could you upload to mapleprimes your worksheet which causes the problems?

The 3/4 comes from 2 - 5/4: note that the linear term in your polynomial does not read 1/4*(x - 5), but only 1/4*x.

It is not quite what you ask for, but maybe the following could be helpful:

L1 := [1 + 4*I,5 - I,3];
L2 := map((x) -> [abs(x),argument(x)],L1);
L3 := sort(L2,(x,y) -> evalb(evalf(x[1]) < evalf(y[1])));

Note that the complex numbers are contained in a list, not a Vector.

PS: You certainly do not have to apologize for having created a forum topic concerning a problem which subsequently you solve yourself.

A tip: Let D be a diagonal matrix consisting of your eigenvalues. Then, the matrix

U . D . HermitianTranspose(U);

where U is any unitary matrix will have the very same eigenvalues. If your eigenvalues are all real and you want to use only real-valued transformation, then you can replace the above by

Q . D . Transpose(Q);

where Q is any orthogonal matrix.

Concerning your first question: Maybe you could use something along the lines of the following example:

LHS := "not n = 1":
RHS := "f(x) = cos(x)":
convert(LHS,symbol) implies convert(RHS,symbol);

Concerning your second question: To avoid quotation marks around a string you can use printf as follows:

text := "This is some text":
printf(text);

It is due to one of the common mistakes committed in Maple, see

http://www.mapleprimes.com/book/the-top-ten-maple-errors.

Robert, I guess you would like to know that the link you provide does not point to the specific post shown, but only to the beginning of the thread.

If you use assume(k::positive,T::positive), then Maple is able to give a nice expression. This expression, however, equals your expression only if, as indicated above by acer, the 75 is replaced by 7.

From your post it's hard to tell what specifically you are looking for, but maybe the Physics package might have your interest. Maybe the help page ?Physics,Setup would be a good place to start. Be warned, though, the help pages on the Physics package can be quite intimidating.

In order for me to hopefully provide a more specific answer, could your describe in a little more detail what you have in mind? For instance, what are the operators that you want to work with?

Is the following an example of what you are looking for?

M := Matrix(3,3,(i,j) -> 1000*sin(i*j));
map(evalf[5],M);
map(evalf[10],M);
map(evalf[20],M);

Jacques and Mariner, thanks for making these points.

As you probably know I am primarily using Maple 9.5 because I feel Maple 11, due to its 'XML-bloat-behaviour', is controlling me rather than the other way around.

As a matter of fact, I certainly will not upgrade any further without a money-back guarantee that, for instance, the tabbing-nuisance (which I consider to be a direct consequence of this 'XML-bloat-behaviour') reported several times elsewhere, has been resolved.

Unfortunately, I have my doubt that this is going to happen. If my doubts are well-founded, then what am I actually doing with Maple: shouldn't I right away begin to migrate to another CAS?

Maybe the following is helpful:

f := (x,y) -> x + y;
f([0,0],[1,1]);

The mean of a sequence of numbers is their sum divided by the number of numbers.

First 12 13 14 15 16 17 18 Page 14 of 19