Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@acer I thank you Acer for coming up with an example even terser than mine of this horrifying phenomenon. Yes, it seems wrong! Unless some other evaluation rule has been explicitly declared, I expect arguments to be evaluated before being passed, as we've each told the lesser-experienced members of this group perhaps hundreds of times. It's like a fundamental rule of Maple. In your example, g() is the argument.

@acer Great, vote up, and an Answer to save with my other examples of how to use the extensive undocumented features of Typesetting. It would be great if you'd

  1. change uses Typesetting to uses T= Typesetting (or some such) and then explicitly highlight the members of that package that are used;
  2. make the function symbol print in grey rather than blue, as is traditional for Maple's prettyprinted inert functions.

@Rohith I'm sorry, but what you're asking makes "absolutely" no sense to me: You say that you want to "ignore" abs, yet what you show as your desired extracted term still contains abs! So, please clarify for me how you define "ignore".

If you've assigned
expression:= log(sin(abs(a+b*c)));
and you want to extract
sin(abs(a+b*c))
from it, that can be done simply by
op(expression)
or (being more precise)
op(1, expression).

(I must point out that you've changed the expression from your original Question. There it was sin(abs(log(a+b*c))).)

My command indets(expr, function(Not(function)))[] extracts the innermost function(s). For the present example, that is of course abs(a+b*c).[*1]

If, on the other hand, you want to ignore abs, then it can be removed entirely from expression by
eval(expression, abs= (()-> args));
and the same will work for any function symbol[*2] (the abs being the function symbol in this case[*3]).

If you want to convert abs to an inert form without entirely removing it, that can be done by
subs(abs= %abs, expression);

The reason that I gave special attention to sqrt was because I suspected that it would come up in one of your future example expressions. If it does come up, it will need special treatment; it can't be handled in the same way as I've handled abs above.

[*1]The arithmetic operators such as and  * are not considered functions in the specific Maple sense of that word; however, when they're in their inert forms, they are functions to Maple.

[*2]Provided that that function actually appears in the expression after it's automatically simplified, which is why I gave special mention to sqrt.

[*3]In the way that the word function is used in Maple code (as opposed to Maple documentation), f(x) is a function, and the f itself is considered to be just the function symbol.

@acer The OP means the he wants to prettyprint an inert form of maximize, as he's displayed it in his Question, akin to Maple's ability to prettyprint inert limits. The words "type sign" in his title are his back-translation of "prettyprint". He doesn't care about the specific function (2*x-3)/(x-2) or about limits; those were just examples showing Maple "doing the right thing" wrt prettyprinting an inert expression.

@torabi That ODE BVP system in the paper is equivalent to

Eq17:= 
   1/r*diff(r*diff(theta(r),r), r) + Nb*diff(sigma(r),r)*diff(theta(r),r) 
   +  Nt*diff(theta(r),r)^2 = 0
;
Eq18:= diff(r*(Nb*diff(sigma(r),r) + Nt*diff(theta(r),r)), r) = 0;
BCs:= theta(1) = 0, sigma(1) = 0, D(theta)(0) = 0, D(sigma)(0) = 0;

That's substantially different from the BVP system in your Question. In particular, you've missed all the terms that contain the independent variable (r in this case) as a factor.

Note that because of the product rule for derivatives, in diff(r*f(r), r)/r the rs do not cancel.

If you at least enter problem #26, I'll be happy to show you how to solve it. Just type in the problem if you need to, for example "26) The integral from 0 to infinity of e to the -2x power, with respect to x".

@vv 

Vote up for a very compact solution! Your commented variation rand(1..6)$2 is definitely better (as you probably know). You can verify that by

(a,b):= (rand(1..6), rand(1..6));
addressof(eval(a)), addressof(eval(b));

(a,b):= rand(1..6)$2;
addressof(eval(a)), addressof(eval(b));

 

@annasophie 

You do call rand with (1..6), but rand is a procedure that returns a procedure (when it's called with a range), i.e., a procedure-valued procedure. Then that returned procedure needs to be called with ().

@torabi 

Can you please say which equation numbers in the paper specify an ODE BVP? 

@vv 
Vote up. Probably more robust than evalb(simplify(A = B)) is evalb(simplify(A - B) = 0) when and B are type algebraic.

Please don't leave! I've worked extensively over the past several days on the Sheikholeslami, et al, paper that you asked about last week. In particular, I've generated all 12 3-D plots from the paper, and I've written extensively on how to do that. I simply haven't posted it yet because I've been camping in a remote mountain location without Internet access (I'm posting this from my phone with a very tenuous 1-bar 4G LTE connection). So, you'd be very stupid to leave.

@Kitonum 

It's not a bug: evalb(A = B) returns true iff and are identical under automatic simplification. That's the way it was designed, and that's the way that it's always been. Maple has a plethora of other simplifiers and comparators. Perhaps because of this evalb should be considered for moderate-to-advanced-level users, with is being the default comparator for beginners. See also command verify.

@seppe 

I can anticipate your next question: 

Question: If I have a cascade of evaluations, such as L:= [x[1,1]] where x is subsequently assigned an Array, how can I access the intermediate levels, i.e., the [x[1,1]]?

Answer: You pass to eval a level number as its second argument, as in eval(L,1)eval(L,2), etc.

My next Answer, which I'm posting forthwith, has several elaborate examples of this.

The same thing happens to me, very often. In particular, I get the same sans serif K and C that you show. Sorry, but I don't know how to correct it. If it's any consolation, it only affects the prettyprinted display of expressions, not their internally stored values, which you can see with command lprint.

It seems to go away if I completely shut down Maple and restart it. Since I very often have about 10 worksheets open simultaneously, I hate needing to shut down Maple.

@seppe I still think that you're missing it. Inside a procedure, the way to access the assigned value of a parameter t declared as ::evaln or ::uneval is eval(t), not evaln(t).

And here is the line from my previous answer where I said that:

  • In all these cases, the assigned value of the expression or name can be obtained inside the procedure as eval(t).
First 303 304 305 306 307 308 309 Last Page 305 of 709