Carl Love

Carl Love

27214 Reputation

25 Badges

11 years, 343 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

That one does not simplify. But that is not analogous to your first example: This second example has a product of two square roots in numerator; the first has a single square root in the numerator. In general, sqrt(a)*sqrt(b) <> sqrt(a*b). If I make this small change in your second example (combining the square roots in the numerator), it will simplify to 1 without using assumptions.

I can't find a set of assumptions that will work on your second example. I'll admit that's a deficiency of the assumption facility. But I can force the potentially invalid rule (although it's perfectly valid if everything under a radical is positive) by using applyrule like this:

 

ex:= (g*a^2+2*2^(1/2)*E^(1/2))^(1/2)*(-g*a^2+2*2^(1/2)*E^(1/2))^(1/2)/(8*E-g^2*a^4)^(1/2);

(g*a^2+2*2^(1/2)*E^(1/2))^(1/2)*(-g*a^2+2*2^(1/2)*E^(1/2))^(1/2)/(8*E-g^2*a^4)^(1/2)

ex2:= applyrule(sqrt(A::algebraic)*sqrt(B::algebraic)= sqrt(A*B), ex);

((g*a^2+2*2^(1/2)*E^(1/2))*(-g*a^2+2*2^(1/2)*E^(1/2)))^(1/2)/(8*E-g^2*a^4)^(1/2)

simplify(ex2);

1

expand(ex2);

1

 

Note that this is valid for any E.

Download simpsqrt.mw

@iazaroff Hmm. I guessed wrong.  Try this: use the pull-down menu to change the input mode from "2D Input" to "Maple Input". Then, at the red "> ", type explicitly (i.e. do not use the palettes)

sin(Pi/4);

(including the semicolon), and then press return (or enter). The characters you type should appear in red boldface. Maple should respond 1/2*sqrt(2), but it should be in the usual mathematical notation, and it should be in blue.

Let me know how that goes.

If I apply simplify or even expand to your expression, it simplifies to 1 with or without any assumptions. I'm using Maple 16. What version are you using?

Are you using parentheses? Unlike standard mathematical notation, functions like sin, ln, etc., in Maple always require parentheses when you are evaluating them at a point: sin(Pi/4), ln(3.4), etc. I'm guessing that when you're pressing return, Maple is putting your cursor back on the spot where it thinks that you are missing a character. It doesn't always get the right spot though.

Good luck exploring Maple. You can usually get help fairly quickly here at MaplePrimes.

Use this procedure:

asympt_neg:= (f,x)-> subs(x= -x, asympt(subs(x= -x, f), x, _rest));

A good function to test this on is GAMMA (because GAMMA is not an even function and it has a nontrivial asymptotic series):

asympt_neg(GAMMA(x), x);

You can view the results yourself. You can see that there are a number of differences between this series and the regular asypmtotic series for GAMMA (which is probably the most famous of all nontrivial asymptotic series). If you evaluate this series at, say, -9.5, you'll see that it gives an excellent approximation to GAMMA(-9.5), and a much better approximation than the regular series gives.

(A much-simplified version of what I posted earlier.)

List the positions of all substrings of the given string that match a chemical element symbol.

BreakBad:= module()
    uses ST= StringTools, ST_PD= StringTools:-PatternDictionary, SC= ScientificConstants;

    #PatternDictionary is case sensitive. Thus, all text is uppercased for searching.
    
    local
        #Periodic (remember) Table of Elements:
        #Map from uppercase elem symbs to standard capitalized symbs.
        PTE:= proc(EL::string) option remember; ST:-Capitalize(EL) end proc,

        #Dictionary of uppercased elem symbs.
        Dict:= ST_PD:-Create(ST:-UpperCase ~ ([SC:-GetElements()])),
        
        #ST_PD:-Search returns seq of 2-member lists, with 2nd member
        #being the dict. id# of found pattern. RetStr is operator that turns that id#
        #into standard elem symbol.
        RetStr:= curry(applyop, curry(PTE@ST_PD:-Get, Dict), 2)
    ;
    export ModuleApply:= (S::string)-> RetStr ~ ([ST_PD:-Search](Dict, ST:-UpperCase(S)));
end module;

Testing it:

BreakBad("The Cat Molly");

[[2, "H"], [1, "Th"], [2, "He"], [5, "C"], [5, "Ca"], [6, "At"], [10, "O"], [9, "Mo"], [13, "Y"]]

So this says that "H" occurs at position 2, "At" at position 6, etc.

 

For next step, we need to decide what to highlight because there are overlapping choices. For the simple example string above we have 9 matches; it would be quite a mess to highlight them all. Perhaps we should select at random. For the final display, I'm considering doing it as a textplot. That way highlights can be done with color easily under programmatic control


       

Here's a solution.

Marks:= proc(m::And(nonnegative,numeric))
   local
      k, margin
     ,CutOffs:= [
         [40, "fail"], [50, "third class"], [60, "lower second class"]
        ,[70, "upper second class"], [100, "first class"]
      ]
   ;
   for k to nops(CutOffs) - 1 do
      margin:= m - CutOffs[k][1];
      if margin < 0 then
         return m, cat(CutOffs[k][2],`if`(margin >= -3, " borderline", ""))
      end if
   end do;
   if m > CutOffs[-1][1] then
      error "invalid input: Argument must be less than or equal to %1 but received %2"
         ,CutOffs[-1][1], m
   end if;
   m, CutOffs[-1][2]
end proc;

I'm guessing that if you're in a math class using space curves, then you've covered the concept of curvature. Is that right? For a smoothly running roller coaster, you'll need continuity of the curves, their derivatives, and their radii of curvature (which are based on the second derivatives). Practically speaking, that means that you need to check that the curves, their derivatives, and their second derivatives match at the splice points.

If you post some of your curves, I'll show you some Maple code to do this. Be sure to include the bounds for the parameters and to indicate where the splice points are.

Are you sure that what you posted is an exact cut-and-paste of your procedure and its execution? In particular I don't understand how your parameter declarations

Marks:=proc(m::nonnegative, numeric)

could result in this exact error message:

Error, invalid input: Marks expects its 1st argument, m, to be of type 
nonnegative and numeric, but received One

Your immediate problem is that you need a comma after the c in the print statement.

But, also, your algorithm is incorrect in two ways:

  1. You can't assume that c is the largest of the three numbers.
  2. The formula a^2 + b^2 = c^2 only applies to right triangles.

The correct algorithm is that the sum of the two smaller sides must be greater than the largest side.

 

 

To change the limits of integration:

subs(1..delta= x[i]..x[i+1], eq7);

To get terms without a[j], a[j+1/2], and a[j+1], just set those variables to 0:

eval(eq7, [a[j]= 0,  a[j+1/2]= 0,  a[j+1]= 0]);

It seems so simple that I wonder if I am understanding your question correctly.

f:= x->x^2:  xticks:= [2,8]:
plot(f, 0..10, labels= [x,y], tickmarks= [xticks, f~(xticks)], gridlines);

I guessed that you might like the gridlines option also, but you can just take that out if you don't want it.

It seems to me that the tipping and capping will come automatically if you simply apply your procedure violinplot to a KernelDensityPlot with the ranging options. In particular, to enforce positivity, in the below example I use the left= 0 option.

violinplot:= proc()
   local P;
   P:= Statistics:-KernelDensityPlot(args);
   plots:-display(
      plottools:-rotate(
         plots:-display(P, plottools:-reflect(P, [[0,0], [1,0]]))
        ,Pi/2
      )
   )
end proc:

violinplot([45,7,4,345,8,456,3,2,45,444,111,34], left= 0, axes= boxed);

Isn't this plot tipped and capped as you want?


Your command

with Statistics;

should be

with(Statistics);

You are missing parentheses.

First 379 380 381 382 383 384 385 Last Page 381 of 389