Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

Use

plots:-spacecurve([0, y, y^2],  y= -1..1);

You're absolutely correct that the series is divergent. In some cases, Maple uses something called "formal summation" to evaluate a divergent series. This is especially likely to happen when you use evalf on an a sum that returns unevaluated or on an inert Sum. You can prevent this by setting

_EnvFormal:= false:

anywhere in your session or in an initialization file. 

The expand command with split the integrals. You could do this:

Int(exp(-I*(A*x+B*y)), [x= -a...a,  y= -a..a]):
convert(value(expand(%)), trig);

 

I think that the HSV color scale provides a more-intuitive way than RGB of translating reals from bounded intervals to colors. The below code is a variation of Acer's, but I scale along from 0 to .85 and keep S and constant at 1. H values higher than about .85 look closer to red than violet to me. 

I have also provided what I think is a more intuitive way to use value to get the numeric values.
 

restart:

F:= proc(n, H:= .42)
uses TS= Typesetting, CT= ColorTools;
    if n < 1 then
        TS:-mn(
            "1",
            ':-mathcolor'= CT:-RGB24ToHex(CT:-Convert([H,1$2], "HSV", "RGB24")),  
            ':-size'= "16",
            ':-fontweight'= "bold"
        )
    else
        thisproc(n-2, H/(n+1)) %+ thisproc(n-1, (H+n*.85)/(n+1))
    fi
end proc
:

for k from 0 to 6 do F(k) od;

1

Parse:-ConvertTo1D, "invalid input %1", `%+`(Typesetting:-mn("1", mathcolor = "#BDFF00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#0030FF", size = "16", fontweight = "bold"))

Parse:-ConvertTo1D, "invalid input %1", `%+`(Typesetting:-mn("1", mathcolor = "#FFD600", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#00FF1F", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#AB00FF", size = "16", fontweight = "bold")))

Parse:-ConvertTo1D, "invalid input %1", `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FF5000", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00FFDD", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#83FF00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#00FF71", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#FD00FF", size = "16", fontweight = "bold"))))

Parse:-ConvertTo1D, "invalid input %1", `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FF2B00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#37FF00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#5500FF", size = "16", fontweight = "bold"))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FF9200", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00E0FF", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#57FF00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#00FF87", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#FF00EB", size = "16", fontweight = "bold")))))

Parse:-ConvertTo1D, "invalid input %1", `%+`(`%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FF0D00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00FF9A", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#B0FF00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#00FF5B", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#E700FF", size = "16", fontweight = "bold")))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FF4F00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#25FF00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#6700FF", size = "16", fontweight = "bold"))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FFA000", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00D2FF", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#4EFF00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#00FF8B", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#FF00E6", size = "16", fontweight = "bold"))))))

Parse:-ConvertTo1D, "invalid input %1", `%+`(`%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FF0600", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#49FF00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#4300FF", size = "16", fontweight = "bold"))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FF8400", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00EDFF", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#61FF00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#00FF82", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#FF00F0", size = "16", fontweight = "bold"))))), `%+`(`%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FF1900", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00FFA5", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#A8FF00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#00FF5E", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#EB00FF", size = "16", fontweight = "bold")))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FF5600", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#22FF00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#6B00FF", size = "16", fontweight = "bold"))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FFA200", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00D0FF", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#4DFF00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#00FF8C", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#FF00E6", size = "16", fontweight = "bold")))))))

`value/mn`:= u-> parse(op([1,1], Typesetting:-Parse(Typesetting:-mn(u))))
:

seq(value(F(k)), k= 0..6);

1, 2, 3, 5, 8, 13, 21

 


 

Download TypesetHSV.mw

It can be done like this:

rangetolist:= (x::range(realcons))-> [seq(x)]:

If you want to interpret the instructions literally, replace range(realcons) with (integer..integer).

 

It might be possible if the expressions are polynomials. See ?solve,parametric. The algorithm used by this command is extremely complicated, and results often take a long time to compute.

Using RealDomain seems to interfere with the ability of simplify to process assumptions. So, don't use it. I don't know exactly why it interferes, but I do know that RealDomain alters the definitions of both sqrt and simplify.

AFAIK, testeq is a probabalistic test that uses modular arithmetic. Because of the modularity, I don't think that it can ever process assumptions. You should replace testeq with is, which is a deterministic test that uses ordinary complex-number arithmetic and is the main command for deriving true/false conclusions from assumptions.

 

In the example below, is the summand, which I've represented as an m-ary function:

n_0:= 4:  m:= 3:
add(S(seq(i +~ 1)), i= Iterator:-Combination(n_0, m));

      S(1, 2, 3) + S(1, 2, 4) + S(1, 3, 4) + S(2, 3, 4)

The inner seq will always sequence the combinations in order.

What you referred to as "all monotonic lidyd [lists] of size m of [1..n_0]" is usually called all m-combinations of {1..n_0}.

An older-style command with the same result is

add(S(i[]), i= combinat:-choose(n_0, m));

The function osum could be written like

osum:= (S, k::(name= [nonnegint, nonnegint]))->
    local j;
    add(eval(S, lhs(k)= j+~1), j= Iterator:-Combination(rhs(k)[]))
:

And called like

osum(i[1]^2+i[2]^2+i[3]^2, i= [4,3]);
 

You could do this:

j:= piecewise(x < 0, x^2 + 1, 0 <= x, x - 1);
plot(j, x= -3..3, discont);

If I do as above, I can right click on the output of the first line, then "Open Context Panel", then "Plot Builder".

The error message is fairly clear: In order to get a numeric solution for x, you need to supply numeric values for hkpT[A], omega[A]. This is also mathematically clear. It seems unlikely that you're looking for a symbolic solution for x, because you've specified such a narrow numeric range for it.

I don't know what version of Maple you're using, but on mine it is already on the plot context menu. Right click on a plot for the context menu, then Symbol (7th item from the top in my version), then Symbolsize (bottom of the submenu), then enter the number.

The following procedure returns a root-bounding interval on which the original function is continuous, and it doesn't depend on the function or its numerator being polynomial.

p:= (x^3 - 13*x^2 + 55*x - 73)/(x - 1)
:
RootBoundwithDiscontinuity:= proc(f::algebraic, ab::name=range(realcons))
local A,k;
    for A in indets(plot(f, ab, discont), Matrix) do
        for k to upperbound(A,1)-1 do
            if A[k,2]*A[k+1,2] <= 0 then return [A[k,1],A[k+1,1]] fi
        od
    od;
    return
end proc
:
RootBoundwithDiscontinuity(p, x= -9..9); 
     [2.60815727428114, 2.64908352866142]

 

In addition to what Acer showed you, it's possible to combine any number of points, lines, and curves in a single plot command. Here's one with numerous bells & whistles.

L:= y = -3/2*x + 2; Pt:= [2,1]:
m:= -1/implicitdiff(L, y, x);
Lperp:= y = m*(x-Pt[1]) + Pt[2];
PtInt:= eval([x,y], solve({L, Lperp}));
plot(
    [rhs(L), rhs(Lperp), [PtInt], [Pt]], x= -5..5,
    style= [line$2, point$2], 
    symbolsize= 18, symbol= [solidcircle, soliddiamond],
    scaling= constrained, color= [red, "DarkGreen", black, red],
    view= [-5..5, -5..5], thickness= 0, size= [900$2],
    legend= [
        typeset(L, `\t`), 
        typeset(Lperp, ` `, `#mo(&perp;)`,`\t`),
        typeset(PtInt, `\t`),
        Pt
    ],
    labels= [x,y], 
    caption= "\nThe given information is in red.", 
    captionfont= [Times, 18],
    title= "Perpendicular Lines\n", titlefont= [Helvetica, Bold]
);

Here's a different way that uses neither complex arithmetic (like VV's) nor an idiosyncratic fractal-specific syntax (like Tom's). I have nothing against those methods; I just think that this real-arithmetic-only approach provides another valuable way of understanding what's happening.

N:= 6: #number of iterations
#Rotate point P by angle theta around point Q:
Rot:= theta-> (P,Q)-> 
    local R:= P-Q, s:= sin(theta), c:= cos(theta): 
    <R[1]*c - R[2]*s | R[1]*s + R[2]*c> + Q
:
Rot120:= Rot(2*Pi/3): #the only rotation that we need
#Select a point on line segment PQ:
BetweenPt:= (P,Q,r)-> P*(1-r) + Q*r:
#Replace line segment __ with _/\, i.e., put a notch in the middle:
Notch:= (P,Q)-> 
    local P1:= BetweenPt(P,Q,1/3); 
    (P, P1, Rot120(P,P1), BetweenPt(P,Q,2/3))
: 
Pts[1]:= <seq(<cos(2*Pi/3*k) | sin(2*Pi/3*k)>, k= 0..3)>:
for k to N do
    Pts[k+1]:= 
        <seq(Notch(Pts[k][j], Pts[k][j+1]), j= 1..3*4^(k-1)), <1|0>>
od:
plots:-display(
   seq(plot(Pts[k])$4, k= 1..N+1), insequence, 
   thickness= 0, scaling= constrained, axes= none
);

I made 4 changes to your worksheet. The change to the plot command is syntactically required.  The other 3 changes are just to increase the speed of numeric integration:

  1. Digits:= 15: #Increase from 10
  2. E:= (x,t)-> Int(  #Use uppercase I.
        exp((-esp*w^4+Disp*w^2+k)*t)*cos(w*(x+v*t))/Pi,
        w= 0..infinity,
        epsilon= 1e-7  #Added for speed.
    );
  3. #Same changes with larger epsilon:
    u:= (x,t)-> Int(E(x-xi, t)*f(xi), xi= 0..2e4, epsilon= 1e-5);
  4. plot(u(1500, t), t= 0..6e4, numpoints= 100);

This is the plot I got for numpoints= 10:

You'll need to wait several minutes for numpoints= 100.

First 112 113 114 115 116 117 118 Last Page 114 of 395