Carl Love

Carl Love

28065 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

DEtools:-phaseportrait is restricted to rectangular coordinates. You can get around that by using plottools:-transform to explicitly transform the cordinates to polar after it is passed the plot structure from phaseportrait. This causes some distortion of the arrow shapes, but it's not bad. Finally, the plot structure is wrapped in plots:-display so that we can get polar axes.

If you send the trajectories around the circle again by using t= 0..4*Pi (or more), you'll see that the magenta curve (the outermost) is a limit cycle for all of them---like a lopsided cardioid. But the arrows for the 2nd and subsequent revolutions are not the same, so the plot gets cluttered.

In the code, I use t instead of theta simply to reduce the length of the code.

plots:-display( #needed to get polar axes
    plottools:-transform((t,r)-> r*~[cos,sin](t))( #transform to polar
        DEtools:-phaseportrait(
            [diff(r(t), t) = r(t)*(1-r(t)^2) + 2*r(t)*cos(t)], 
            [r(t)], t= 0..2*Pi, 
            `[]`~(r(0)=~.25*~[$1..4]), #inits
            linecolor= [blue, DarkGreen, black, magenta],
            numpoints= 1000
        )
    ), 
    axiscoordinates= polar, size= [1000$2], thickness= 0
);

Here are two more ways:

fsolve(Statistics:-CDF(Normal(mu,10), 500) = 0.05, mu= 500..infinity);
                          516.4485363

fsolve(Statistics:-Quantile(Normal(mu,10), .05) = 500);
                          516.4485363

 

In the worksheet below, I show how to get the symbolic solution for part d (c = 2.5) by eigenvalue methods. You'd still need to fill numerous of the step-by-step details.
 

An Introduction to Systems of Linear Differential Equations in Matrix Form.

restart
:

LA:= LinearAlgebra
:

Method 1, just use dsolve:

ode:= m*diff(y(t),t$2) + c*diff(y(t),t) + k*y(t);

m*(diff(diff(y(t), t), t))+c*(diff(y(t), t))+k*y(t)

V:= [m, c, k]=~ [1, 5/2, 1];

[m = 1, c = 5/2, k = 1]

Sol1:= dsolve({eval(ode, V), y(0)=y0, D(y)(0)=yp0});

y(t) = (-(1/3)*y0-(2/3)*yp0)*exp(-2*t)+((2/3)*yp0+(4/3)*y0)*exp(-(1/2)*t)

The coefficients of t in the exponents are the roots of this polynomial equation:

Eq:= m*r^2 + c*r + k = 0:

solve(eval(Eq, V));

-1/2, -2

Method 2, matrix/eigenvalue method:

B:= eval(<0, 1; -k/m, -c/m>, V);

Matrix(2, 2, {(1, 1) = 0, (1, 2) = 1, (2, 1) = -1, (2, 2) = -5/2})

(ev,EV):= LA:-Eigenvectors(B);

ev, EV := Vector(2, {(1) = -2, (2) = -1/2}), Matrix(2, 2, {(1, 1) = -1/2, (1, 2) = -2, (2, 1) = 1, (2, 2) = 1})

The vector on the left are the eigenvalues. Note that they're the same as the coefficients in the exponents of our first solution. This is not a coincidence. The columns of the matrix on the right are (some) corresponding eigenvectors (eigenvectors are not unique, but eigenvalues are). Any nonzero multiple of an eigenvector is also an eigenvector. I need to normalize the given eigenvectors; that is, multiple them by the reciprocals of their magnitudes so that the new magnitudes are 1 (i.e., they are unit vectors).

NEV:= `<|>`(seq(LA:-Normalize(EV[..,k], 2), k= 1..upperbound(EV,2)));

Matrix(2, 2, {(1, 1) = -(1/5)*sqrt(5), (1, 2) = -(2/5)*sqrt(5), (2, 1) = (2/5)*sqrt(5), (2, 2) = (1/5)*sqrt(5)})

The original matrix B now has this factorization:

((NEV^(-1)) %. LA:-DiagonalMatrix(ev)) %. NEV: % = value(%);

`%.`(`%.`(Matrix(2, 2, {(1, 1) = (1/3)*sqrt(5), (1, 2) = (2/3)*sqrt(5), (2, 1) = -(2/3)*sqrt(5), (2, 2) = -(1/3)*sqrt(5)}), Matrix(2, 2, {(1, 1) = -2, (1, 2) = 0, (2, 1) = 0, (2, 2) = -1/2})), Matrix(2, 2, {(1, 1) = -(1/5)*sqrt(5), (1, 2) = -(2/5)*sqrt(5), (2, 1) = (2/5)*sqrt(5), (2, 2) = (1/5)*sqrt(5)})) = (Matrix(2, 2, {(1, 1) = 0, (1, 2) = 1, (2, 1) = -1, (2, 2) = -5/2}))

Note that the product on the right is the original matrix. There are several important matrix factorizations in linear algebra. This one is called diagonalization because the middle matrix is diagonal. To apply an analytic function to a matrix, you diagonalize the matrix, apply the function to the diagonal matrix's diagonal entries, then multiply the three matrices back together. By analogy with C*exp(a*t) being the solution to y' = a*y, we expect exp(B*t).C to be the solution to the matrix differential equation system X' = B.X (C is a vector of integration constants).

SolGen:= NEV^(-1).LA:-DiagonalMatrix(exp~(ev*t)).NEV;

Matrix(2, 2, {(1, 1) = -(1/3)*exp(-2*t)+(4/3)*exp(-(1/2)*t), (1, 2) = -(2/3)*exp(-2*t)+(2/3)*exp(-(1/2)*t), (2, 1) = (2/3)*exp(-2*t)-(2/3)*exp(-(1/2)*t), (2, 2) = (4/3)*exp(-2*t)-(1/3)*exp(-(1/2)*t)})

Solve for the integration constants:

C:= LA:-LinearSolve(eval(SolGen, t=0), <y0, yp0>);

Vector(2, {(1) = y0, (2) = yp0})

So the specific solution is

SolPart:= SolGen.C;

Vector(2, {(1) = (-(1/3)*exp(-2*t)+(4/3)*exp(-(1/2)*t))*y0+(-(2/3)*exp(-2*t)+(2/3)*exp(-(1/2)*t))*yp0, (2) = ((2/3)*exp(-2*t)-(2/3)*exp(-(1/2)*t))*y0+((4/3)*exp(-2*t)-(1/3)*exp(-(1/2)*t))*yp0})

Express that in a more-standard form:

SolPart:= collect(SolPart, exp);

Vector(2, {(1) = (-(1/3)*y0-(2/3)*yp0)*exp(-2*t)+((2/3)*yp0+(4/3)*y0)*exp(-(1/2)*t), (2) = ((2/3)*y0+(4/3)*yp0)*exp(-2*t)+(-(2/3)*y0-(1/3)*yp0)*exp(-(1/2)*t)})

Now recall that in the reduction of the 2nd-order ODE to a 1st-order system, the first row was y and the second row was y'. So the solution to the original ODE is just the 1st row of the above:

Sol2:= SolPart[1];

(-(1/3)*y0-(2/3)*yp0)*exp(-2*t)+((2/3)*yp0+(4/3)*y0)*exp(-(1/2)*t)

Compare to the solution we got with dsolve:

Sol1;

y(t) = (-(1/3)*y0-(2/3)*yp0)*exp(-2*t)+((2/3)*yp0+(4/3)*y0)*exp(-(1/2)*t)

We see that it's the same solution.

 


 

Download MatODEs.mw

There is a Maple command to compute an interpolating polynomial:

''f''~((V:= [6,7,-1])) =~ map[3](CurveFitting:-PolynomialInterpolation, [$1..5], 1/~[$1..5], V);

This uses Maple 2018 syntax.

Regarding your handle, "lovemaple": You should show your love by writing some Maple code.

To avoid having a series of Questions with the same title (which is confusing), I changed you titles.

There is a typo in your Poisson probability formula. It should be P(k) = lambda^k*exp(-lambda)/k!.

Both parts of your problem can be done efficiently with a single 4-line procedure that has a combined for-while-loop (thus combining the exercise's requirements for each part), because both parts require summing the above formula for k = 0, 1, 2, ..., for either a given (part a) or for an to be determined by the sum exceeding a certain value (part b). The efficiency is due to not computing lambda^k or k! explicitly; rather, their quotient is built termwise. 

I urge you to deconstruct the 4 main lines (i.e., you can totally ignore the lines that I commented (in the code) as being for advanced users) of the main procedure below, to figure out what each part does (from help pages or asking here), and to reconstruct your own solution from your new-found knowledge. You may also need a brief tutorial or refresher on discrete probability distributions. Wikipedia is an excellent source, and you can also ask here, even if the question has little-to-none Maple content.
  
This code uses Maple 2019 syntax!
 

restart
:

PoissonCDF:= proc(lambda, x:= infinity, alpha:= 0)
#Passing x=infinity indicates that you want the critical value for alpha.
local k, S:= 1, t:= 1, crit:= evalf(exp(lambda)*(1-alpha));
    #.........
    #(*#*)(* This if-block is for the consideration of advanced users only. It
    # returns a symbolic result, which is not part of the original exercise.
    if lambda::And(realcons, nonnegative) implies x=infinity and alpha=0 then
        local N,a,K;
        (N,a,K):= `tools/genglobal`~([_N, _alpha, _k])[];
        assume(N::nonnegative, 0 <= a, a <= 1);
        return 1-a <= exp(-lambda)*Sum(lambda^_k/_k!, _k= 0..floor(N))
    fi;
    #*)
    #.........
    for k to x while evalf(S) <= crit do S+= (t*= lambda/k) od;
    `if`(x=infinity, k-1, exp(-lambda)*S)
end proc
:    

#Part a: the CDF at 5, 10, and 15:
lambda:= 10.:  Ns:= [5, 10, 15]:
seq('P'('k' <= N) = PoissonCDF(lambda, N), N= Ns);

P(k <= 5) = 0.6708596285e-1, P(k <= 10) = .5830397500, P(k <= 15) = .9512595963

#Part b: the critical values for alpha = 0.1, 0.05, and 0.01:
alphas:= [0.1, 0.05, 0.01]:
seq('P'(`%>=`('k', PoissonCDF(lambda, infinity, a))) < a, a= alphas);   

P(`%>=`(k, 14)) < .1, P(`%>=`(k, 15)) < 0.5e-1, P(`%>=`(k, 18)) < 0.1e-1

Compare our results with Maple's library code:

Statistics:-CDF~(Poisson(10), Ns, numeric);

[HFloat(0.06708596287897903), HFloat(0.5830397748189408), HFloat(0.9512596040682292)]

Statistics:-Quantile~(Poisson(10), 1 -~ alphas);

[14., 15., 18.]

#(optional) symbolic result example:
PoissonCDF(10);

1-_alpha <= exp(-10)*(Sum(10^_k/factorial(_k), _k = 0 .. floor(_N)))

The results can also be computed using the GAMMA function: 

PoissonCDF2:= (lambda, x)-> GAMMA(trunc(x+1), lambda)/trunc(x)!:

PoissonCDF2~(lambda, Ns);

[0.6708596288e-1, .5830397503, .9512595968]

PoissonCritVal:= (lambda, alpha)->
    local x:
    ceil(fsolve(GAMMA(x+1, lambda)/GAMMA(x+1) = 1-alpha, x= 0..infinity))
:

PoissonCritVal~(lambda, alphas);

[14, 15, 18]

 


 

Download Poisson.mw

In the worksheet below, your 4th proposed solution violates your 5th equation for any m other than -1, 0, or 1. By direct substitution using m=2, p=-1, q=1, it is explicitly shown to violate the 5th equation.

Your 3rd proposed solution is a specialization (to your proposed value of a1) of the 2nd solution returned by solve, which leaves a1 arbitrary.

Your 1st and 2nd proposed solutions, if you rationalize their denominators, can each be seen to be equivalent to a solution returned by solve.
 

Eqs:= [
    3*a0*a1^2*q,
    a1^3*q + 2*k^2*m^2*a1,
    3*a1^2*b1^2*q + 3*a0^2*a1*b1 - k^2*m^2*a1*b1 - k^2*a1*b1 + p*a1*b1,
    6*a0*a1*b1*q + a0^3*q + a0*p,
    b1^3*q + 2*k^2*b1
]:
<Eqs[]>;

Vector(5, {(1) = 3*a0*a1^2*q, (2) = 2*a1*k^2*m^2+a1^3*q, (3) = -a1*b1*k^2*m^2+3*a1^2*b1^2*q+3*a0^2*a1*b1-a1*b1*k^2+a1*b1*p, (4) = a0^3*q+6*a0*a1*b1*q+a0*p, (5) = b1^3*q+2*b1*k^2})

Solns:= [solve(Eqs, {a0,a1,b1,k}, explicit)];

[{a0 = 0, a1 = a1, b1 = 0, k = (1/2)*(-2*q)^(1/2)*a1/m}, {a0 = 0, a1 = a1, b1 = 0, k = -(1/2)*(-2*q)^(1/2)*a1/m}, {a0 = (-p*q)^(1/2)/q, a1 = 0, b1 = b1, k = (1/2)*(-2*q)^(1/2)*b1}, {a0 = -(-p*q)^(1/2)/q, a1 = 0, b1 = b1, k = (1/2)*(-2*q)^(1/2)*b1}, {a0 = (-p*q)^(1/2)/q, a1 = 0, b1 = b1, k = -(1/2)*(-2*q)^(1/2)*b1}, {a0 = -(-p*q)^(1/2)/q, a1 = 0, b1 = b1, k = -(1/2)*(-2*q)^(1/2)*b1}, {a0 = (-p*q)^(1/2)/q, a1 = 0, b1 = 0, k = k}, {a0 = -(-p*q)^(1/2)/q, a1 = 0, b1 = 0, k = k}, {a0 = 0, a1 = 0, b1 = b1, k = (1/2)*(-2*q)^(1/2)*b1}, {a0 = 0, a1 = 0, b1 = b1, k = -(1/2)*(-2*q)^(1/2)*b1}, {a0 = 0, a1 = 0, b1 = 0, k = k}, {a0 = 0, a1 = (-2*q*(m^2-6*m+1)*p)^(1/2)*m/(q*(m^2-6*m+1)), b1 = -(-2*q*(m^2-6*m+1)*p)^(1/2)/(q*(m^2-6*m+1)), k = ((m^2-6*m+1)*p)^(1/2)/(m^2-6*m+1)}, {a0 = 0, a1 = -(-2*q*(m^2-6*m+1)*p)^(1/2)*m/(q*(m^2-6*m+1)), b1 = (-2*q*(m^2-6*m+1)*p)^(1/2)/(q*(m^2-6*m+1)), k = ((m^2-6*m+1)*p)^(1/2)/(m^2-6*m+1)}, {a0 = 0, a1 = (-2*q*(m^2-6*m+1)*p)^(1/2)*m/(q*(m^2-6*m+1)), b1 = -(-2*q*(m^2-6*m+1)*p)^(1/2)/(q*(m^2-6*m+1)), k = -((m^2-6*m+1)*p)^(1/2)/(m^2-6*m+1)}, {a0 = 0, a1 = -(-2*q*(m^2-6*m+1)*p)^(1/2)*m/(q*(m^2-6*m+1)), b1 = (-2*q*(m^2-6*m+1)*p)^(1/2)/(q*(m^2-6*m+1)), k = -((m^2-6*m+1)*p)^(1/2)/(m^2-6*m+1)}, {a0 = 0, a1 = (-2*q*(m^2+6*m+1)*p)^(1/2)*m/(q*(m^2+6*m+1)), b1 = (-2*q*(m^2+6*m+1)*p)^(1/2)/(q*(m^2+6*m+1)), k = ((m^2+6*m+1)*p)^(1/2)/(m^2+6*m+1)}, {a0 = 0, a1 = -(-2*q*(m^2+6*m+1)*p)^(1/2)*m/(q*(m^2+6*m+1)), b1 = -(-2*q*(m^2+6*m+1)*p)^(1/2)/(q*(m^2+6*m+1)), k = ((m^2+6*m+1)*p)^(1/2)/(m^2+6*m+1)}, {a0 = 0, a1 = (-2*q*(m^2+6*m+1)*p)^(1/2)*m/(q*(m^2+6*m+1)), b1 = (-2*q*(m^2+6*m+1)*p)^(1/2)/(q*(m^2+6*m+1)), k = -((m^2+6*m+1)*p)^(1/2)/(m^2+6*m+1)}, {a0 = 0, a1 = -(-2*q*(m^2+6*m+1)*p)^(1/2)*m/(q*(m^2+6*m+1)), b1 = -(-2*q*(m^2+6*m+1)*p)^(1/2)/(q*(m^2+6*m+1)), k = -((m^2+6*m+1)*p)^(1/2)/(m^2+6*m+1)}]

ProposedSolns:= [
    {a0=0, a1=m*sqrt(-2*p)/sqrt((m^2+6*m+1)*q), b1= a1/m, k= sqrt(p)/sqrt(m^2+6*m+1)},
    {a0=0, a1=m*sqrt(-2*p)/sqrt((m^2-6*m+1)*q), b1= -a1/m, k= sqrt(p)/sqrt(m^2-6*m+1)},
    {a0=0, a1=m*sqrt(-2*p)/sqrt((m^2+1)*q), b1=0, k= sqrt(p)/sqrt(m^2+1)},
    {a0=0, a1=0, b1=m*sqrt(-2*p)/sqrt((m^2+1)*q), k= sqrt(p)/sqrt(m^2+1)}
]:

eval[recurse](Eqs, ProposedSolns[4] union {m=2, p=-1, q=1});

[0, 0, 0, 0, (12/25)*2^(1/2)*5^(1/2)]

simplify(-sqrt(-2*q)*m*sqrt(-2*p)/sqrt((m^2+1)*q)/2/m);

-(-q)^(1/2)*(-p)^(1/2)/((m^2+1)^(1/2)*q^(1/2))

 


 

Download RatDenom.mw

It's very difficult to measure the time of such trivial operations because the time of the measuring and looping code overwhelms what's being measured.

My first guess is that nops(data) <> 0 is the fastest way. My close second guess would be

not (data::[]).

Here are some hints:

1. There are four ways that may occur to you:

  1. Generate the fibonaccis and test if they're square.
  2. Generate the squares and test if they're fibonacci.
  3. Generate both and find the intersection.
  4. Find a formula that just gives square fibonaccis.

Of these, 1 and 3 are easy, and 1 is the most computationally efficient. 2 is more difficult because it's much easier to check if a number is square than to check if it's fibonacci, and also because there are far more squares than fibonaccis. 4, if it were possible at all, would require some sophisticated mathematical work.

2. The predicate issqr tests whether an integer n is a square, i.e., issqr(n) returns true or false depending on whether n is square.

3. A while-loop can be used to stop generation when you exceed 10000.

4. In Maple 2019, the whole thing can be done in a single line of code.

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.

 

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