Carl Love

Carl Love

28015 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@dharr I just came up with that formula off the cuff. Perhaps the mean would be better in general than the midrange.

@vs140580 A good choice of scale factor for each column (whether dependent or independent) is

10.^(-ilog10@((max+min)/2.)@abs~)(Data1[.., j])

where j is the column number. This formula gives the same scale factors that @dharr used, although I don't know whether he actually used a formula or just eyeballed it.

In plain words, the formula is "Divide by the power of 10 closest to (but not exceeding) the midrange of the absolute values of the data." 

 

Maple supports function composition via the operator @. But I don't understand your example. Please make a simpler example that uses no variables other than the function names and their parameters. And why is the parameter of R not used at all?

@mmcdara As far as I know, Maple has no means of plotting any solids. We only plot the surfaces that are their boundaries and imagine that the interiors are filled. When the OP specified "intersection of two solid bodies", they were asking for a means to plot the surfaces that are the boundary of that intersection. 

@mmcdara A second range argument in a 2D plot command is allowed, and its effect is similar to using that range as the view of the vertical coordinate. If the additional range is given in the form name= range, then in addition the name is used as the vertical axis label.

If a keyword parameter that take truefalse values, such as gridlines, is given without a value, that's equivalent to setting the value to true.

@nicolesharp100 See help pages ?StringTools,Regular_Expressions, ?StringTools,RegMatch, ?StringTools,RegSplit, ?StringTools,RegSub, and ?StringTools,RegSubs. The first of these pages explains the entire sublanguage called "regular expressions" (which is about twice as old as Maple).

@nicolesharp100 MaplePrimes already has tags. People just need to use them more.

@nicolesharp100 See help page ?history.

@JAMET Here it is in a worksheet:
 

restart:

S1:= 441:  S2:= 1109:  S3:= 511:  S4:= 900:  S5:= 2904:  S6:= 285:

for i while (x:= S||(i+1))::And(algebraic, Not(name)) do S1+= x od;

1550

2061

2961

5865

6150

 

Download Add_with_for.mw

Please put your Replies after the Answer that you're replying to rather than directly after your Question.

@tomleslie I agree: That other Answer shows how to get those values.

The mean and variance have different units (the variance unit is the square of the mean unit), so it makes no sense to me that you want to add the mean and variance.

@JAMET

S1 must be assigned a value (such as the 441 you showed in the Question) before using that for loop.

@emendes I added a section to my Reply above (right under its gray-background code block) to explain the "level of evaluation", the 2nd argument of the eval command (as it's used for deconstructing unevaluated expressions).

@KIRAN SAJJAN I think you need to change Ans1[j] to Ans1[k] in all the seq statements that use k as the index variable. Also, the Ans1[k], or whatever stores the dsolve solution, must be the first argument of odeplot. There are some places where you have it as the second argument.

@emendes 

Type operator 'identical':

You asked:

  •  I need help to understand why you have used identical

The type operator identical is an inert operator within the type sublanguage required to use an arbitrary item (in this case a name) as if it were a type. Specifically,

    type(e, identical(x))  if and only if  evalb(e = x).

With multiple arguments, identical(x, y, ...is equivalent to {identical(x), identical(y), ...}. There is no global meaning of identical outside the type sublanguage.


Explicit arguments vs those assigned to names:

  • Could you also tell me why my proc won't work unless I type Excl?

It doesn't require you to use Excl specifically, but as I wrote it above, it does require that the set of excluded names be assigned to some name (rather than being put directly in the procedure call). A modification to allow both forms is given below. Working with unevaluated expressions requires meticulous hygiene, and results are often counter-intuitive (such as this example). It should be avoided unless it's absolutely necessary, which it is in this case. Here's the modification:

SaveNames:= (excl::uneval, fname::{symbol, string})->
    subs(
        _V= remove(
            type, {anames}('user') minus {anames}(procedure), 
            identical(eval(excl, 2)[], eval(excl, 1)[], eval(excl, 1))
        )[],
        proc() save _V, fname end proc
    )()
:
# Now these both work:
SaveNames(
    {'x', 'y'}, 
    #...or...
    (* Excl, *) 
    "V.txt"
);

Levels of evaluation:

Here's how the levels of evaluation work. The level is the positive integer that's the second argument of eval, as in eval(excl, 2). (This usage of eval has no relation to the commonly used command eval(expr, x= a); that's an essentially different command that has the same name.) Suppose that the call to SaveNames is as in the example in my original Answer. Then

  • eval(excl, 1) = 'Excl', the global variable passed to the command;
  • eval(excl, 2) {'x', 'y'}, the direct assignment to Excl;
  • eval(excl, 3){3, 5}, which of course isn't useful for this procedure, it not being a set of names.

But if the call is SaveNames({'x', 'y'}, ...), then

  • eval(excl, 1) {'x', 'y'};
  • eval(excl, 2) = {3, 5}. It's okay to have this in the code because it's something that's being remove'd, and remove'ing something that isn't there is harmless.

Using no 2nd argument, eval(excl) means "full evaluation", i.e., evaluation to a level such that a higher level doesn't cause a change.


Typewise exclusions of things akin to procedures:

  • I have noticed that if I define SaveNames after ExclCM_IsStandard will be saved.  How to avoid that?

My guess is that CM_IsStandard is an "appliable module" (a module whose name can be used as if it were a procedure because it has a local or export named ModuleApply). In the remove command, change procedure to appliable, which is a supertype of procedure. If that doesn't fix the problem, I'll need to know what exactly CM_IsStandard is.

First 55 56 57 58 59 60 61 Last Page 57 of 708