Carl Love

Carl Love

28100 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Carl Love 

I don't know much about Maplels, but I found the following in the help page ?Maplets,Elements,TextField: The command Maplets:-Elements:-TextField has an option tooltip= "...".

@Alejandro Jakubi Thanks for spotting. Code corrected above.

@JohnS Pattern matching "any name except x" is possible like this:

define(
     L, orderless, multilinear,
     L(a::And(name,Not(identical(x)))*b::function, c::function) = a*L(b,c),
     L(
          a::And(name,Not(identical(x)))*b::function,
          c::And(name,Not(identical(x)))*d::function
     ) = a*c*L(b,d)
);

@JohnS Under your definitions for L, we have L(x*f(x)) = x*L(f(x)). If that makes sense for your application, fine; but it doesn't fit my usual conception of linearity.

@JohnS 

It will work if you first put them on the sequence of constants:

constants:= constants, c, d, e, f;

 

@acer 

It wasn't the extra function calls that worried me; indeed, my procedure above has only one call per dimension, which is trivial. But I was worried about the one-element-at-a-time list building; each tuple is created that way. There might be a recursive way using Vectors. For a Cartesian product we know the number of tuples and their size from the start.

@Chia Go to help page ?parameter_classes and read the ninth section "End-of-Parameters marker, $". This usage of $ has no relation whatsoever to the more-familiar usage of $ as a sequence-building operator.

What do you mean by "high powers, like 10^17 by 10^12"?

Your story seems strange: Raising a 250x250 Matrix of floats to the 10^17 power is nearly instantaneous. What exactly are you doing? Why is a loop needed to raise a Matrix to a power?

@Preben Alsholm 

To convert any procedure to an inert form, you can prepend % to the name. So your

df_dz[s][i,j]:=subs(D=DD,convert(df_dz[s][i,j],D));

could be

df_dz[s][i,j]:= subs(D= %D, convert(df_dz[s][i,j], D));

The benefit of doing it this way is that it can be converted back to active form with the value command.

 

@ger89

Here I'm only answering your question #4: <0,0,0,0> is a column vector of four zeros. So, in the line in question, Preben solves the homogenous system of linear equations whose coefficient matrix is A10, and he requests that the prefix be used for the names of any free variables.

For more information on the angle-bracket notation for vectors and matrices, see ?LinearAlgebra,General,MVshortcut

@kevinmaple The arrow notation -> is an abbreviation allowed for procedures (usually one-liners) that contain only an expression, an expression sequence, or an if statement. So

CountUnique:= (L::list)-> nops({L[]}):

is essentially equivalent to

CountUnique:= proc(L::list) return nops({L[]}) end proc:

See ?operators,functional

It's possible to do what you want using the parse statement. However, there's almost always a better way. What's your ultimate goal? to generate a Cartesian product of sets or lists? or some other combinatorial object? These things can be done without using loops nested to arbitrary depth. Nonetheless, in the Answer below, I show how to do what you asked for.

@Preben Alsholm Yes, thanks, that's what I meant. I corrected the Answer.

@GPY You need to minimize the 2-norm, which is equivalent to minimizing its square. Try this:

Minimize(LinearAlgebra:-Norm(minmat, 2)^2);

This should resolve the absolute-value error.

@ger89 The second argument to pdsolve needs to be w(x,t), not w(u,t).

First 508 509 510 511 512 513 514 Last Page 510 of 709