Carl Love

Carl Love

26740 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

The absolute value of your final computation is independent of the order of the 4 vectors, so it doesn't matter which one you subtract from the others.

V:= (p,q,r,s)-> abs(LinearAlgebra:-`&x`(p-s, q-s) . (r-s));

proc (p, q, r, s) options operator, arrow; abs(LinearAlgebra:-`&x`(p-s, q-s).(r-s)) end proc

Pts:= ['LinearAlgebra:-RandomVector(3)' $ 4];

[Vector(3, {(1) = -59, (2) = 12, (3) = -62}), Vector(3, {(1) = 72, (2) = 42, (3) = 18}), Vector(3, {(1) = 52, (2) = -13, (3) = 82}), Vector(3, {(1) = 70, (2) = -32, (3) = -1})]

for pts in combinat:-permute(Pts) do V(pts[]) od;

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

851671

 

Download BoxProduct.mw

Your final formula can be simply proved by mathematical induction, without any need for a closed-form algebraic expression for the Fibonacci sequence.

restart:

interface(prompt= ""):

The prroposition to prove:

eval(G(2*n) = G(2*n+1) + G(2*n+2), G= arctan@`/`@F);

arctan(1/F(2*n)) = arctan(1/F(2*n+1))+arctan(1/F(2*n+2))

for positive integers n where F = combinat:-fibonacci.

 

We start by having Maple confirm a fairly well-known identity for a sum of arctangents:

combine(arctan(1/a) + arctan(1/b)) assuming a > 1, b >= 1;

arctan((b+a)/(a*b-1))

So we just need to verify this Fibonacci identity:

1/F(2*n) = subs({a= F(2*n+1), b= F(2*n+2)}, op(%));

1/F(2*n) = (F(2*n+2)+F(2*n+1))/(F(2*n+1)*F(2*n+2)-1)

It'll be easier to work with in polynomial form. This will be the verification goal of mathematical induction:

Goal:= numer((lhs-rhs)(%)) = 0;

-F(2*n)*F(2*n+2)-F(2*n)*F(2*n+1)+F(2*n+1)*F(2*n+2)-1 = 0

To form the induction hypothesis, change n to n-1:

IH:= eval(Goal, n= n-1);

-F(2*n-2)*F(2*n)-F(2*n-2)*F(2*n-1)+F(2*n-1)*F(2*n)-1 = 0

Verify the induction base case:

is(eval(Goal, {n=1, F= combinat:-fibonacci}));

true

And verify the Goal by simplifying with respect to the induction hypothesis and the defining recursive formula for the Fibonacci sequence:

is(simplify(Goal, {IH, seq(F(2*n+k)+F(2*n+k-1) = F(2*n+k+1), k= -1..1)}));

true

 

Download FibonacciAtanIdentity.mw

@C_R Your understanding of (...)(...) is totally correct. The reason that the extra parentheses (as shown by @nm) are necessary is the precedence of Maple's binary infix operators: -> has lower precedence than = (just like has lower precedence than *). See ?operators,precedence.

You can avoid the need for the extra parentheses by replacing x->x with x@@0, which is the identity function. `@@` has higher precedence than =. You could also use 1@@0_@@0, etc.

The multiplication symbol can be easily suppressed:

make_nice:= e-> subs(
    "∗"= "⁢",   
    InertForm:-Display(evalindets(e, And(`*`, fraction &under curry(op,1)), `%*`@op))
): 

Also, by changing @nm's typespec from `&*`(fraction, anything) to And(`*`, fraction &under curry(op,1)), my procedure can handle products of any number of factors, such as 3/8*ln(x/y)*exp(z).

You just need to add the arrows option to your DEplot3d command. For example, by adding arrows= cheap I get this:

In your display command, remove the options gridlines= true and axes= none, and add the options

axis[1]= [gridlines=17, tickmarks=0], axis[2]= [gridlines= 8, tickmarks=0], view= [0..16, 0..7]

You should get this:

In your Case 2, solve chose (somewhat arbitrarily) two different branches of LambertW, but any branch would work. If you change all instances of solve(...to solve(..., allsolutions), I think you'll understand what's happening. If not, I'll explain further.

First, pick a value of Kr to use. I chose 0.1. Then do

Kr:= 0.1:
F:= [f, Theta, Phi](eta):
Frame:= Inf-> plots:-odeplot(
    dsolve({OdeSys, eval([Cond], 10= Inf)[]}, numeric),
    `[]`~(eta, F), legend= F
):
plots:-animate(Frame, [Inf], Inf= 0.1..10, frames= 50, size= 500*[2,1]); 


 

All you need is 

(A,B):= convert~(Solution, list, nested)[]: print('A'=A, 'B'= B);

6Here's a procedure for it:

#Bins takes a histogram and its data sample and returns a list of "bin-bounds" = count.
Bins:= (
    H::And(specfunc(PLOT), patfunc(specfunc(POLYGONS), anything)),
    S::{rtable,list}(numeric)
)-> 
local `&<`:= curry, `&>`:= rcurry;
    (Statistics:-TallyInto &< S &> _rest @ (op&<[1,1]..op&<[2,1])~)(
        [indets(op(1,H), And(listlist(numeric), 4 &under nops))[]]
    )
:

Applying it to the histogram in your worksheet:

Bins(Q,A);   

[-2.71396014591046 .. -2.66663223217829 = 2, -2.66663223217829 .. -2.61930431844611 = 0, -2.61930431844611 .. -2.57197640471394 = 0, 
-2.57197640471394 .. -2.52464849098177 = 2, -2.52464849098177 .. 2.4773205772496 = 0, -2.4773205772496 .. -2.42999266351743 = 1, -2.42999266351743 .. -2.38266474978526 = 1, -2.38266474978526 .. 
-2.33533683605308 = 2, -2.33533683605308 .. -2.28800892232091 = 1, 
-2.28800892232091 .. -2.24068100858874 = 3, -2.24068100858874 .. 
-2.19335309485657 = 1, -2.19335309485657 .. -2.1460251811244 = 0, 
-2.1460251811244 .. -2.09869726739223 = 4, -2.09869726739223 .. 
-2.05136935366005 = 0, -2.05136935366005 .. -2.00404143992788 = 1, 
-2.00404143992788 .. -1.95671352619571 = 3, -1.95671352619571 .. 
-1.90938561246354 = 5, -1.90938561246354 .. -1.86205769873137 = 2, 
-1.86205769873137 .. -1.8147297849992 = 4, -1.8147297849992 .. 
-1.76740187126702 = 4, -1.76740187126702 .. -1.72007395753485 = 2, 
-1.72007395753485 .. -1.67274604380268 = 3, -1.67274604380268 .. 
-1.62541813007051 = 4, -1.62541813007051 .. -1.57809021633834 = 2, 
-1.57809021633834 .. -1.53076230260617 = 3, -1.53076230260617 .. 
-1.48343438887399 = 5, -1.48343438887399 .. -1.43610647514182 = 7, 
-1.43610647514182 .. -1.38877856140965 = 7, -1.38877856140965 .. 
-1.34145064767748 = 7, -1.34145064767748 .. -1.29412273394531 = 6, 
-1.29412273394531 .. -1.24679482021313 = 4, -1.24679482021313 .. 
-1.19946690648096 = 12, -1.19946690648096 .. -1.15213899274879 = 6, 
-1.15213899274879 .. -1.10481107901662 = 9, -1.10481107901662 .. 
-1.05748316528445 = 6, -1.05748316528445 .. -1.01015525155228 = 13, 
-1.01015525155228 .. -.962827337820104 = 18, -.962827337820104 .. 
-.915499424087933 = 8, -.915499424087933 .. -.868171510355761 = 19, 
-.868171510355761 .. -.820843596623589 = 15, -.820843596623589 .. 
-.773515682891417 = 9, -.773515682891417 .. -.726187769159246 = 15, 
-.726187769159246 .. -.678859855427074 = 17, -.678859855427074 .. 
-.631531941694902 = 11, -.631531941694902 .. -.584204027962731 = 19, 
-.584204027962731 .. -.536876114230559 = 11, -.536876114230559 .. 
-.489548200498387 = 21, -.489548200498387 .. -.442220286766215 = 13, 
-.442220286766215 .. -.394892373034044 = 20, -.394892373034044 .. 
-.347564459301872 = 15, -.347564459301872 .. -.3002365455697 = 24, 
-.3002365455697 .. -.252908631837528 = 12, -.252908631837528 .. 
-.205580718105357 = 21, -.205580718105357 .. -.158252804373185 = 16, 
-.158252804373185 .. -.110924890641013 = 22, -.110924890641013 .. 
-.0635969769088414 = 23, -.0635969769088414 .. -.0162690631766695 = 25, 
-.0162690631766695 .. .0310588505555018 = 14, .0310588505555018 .. 
.0783867642876737 = 18, .0783867642876737 .. .125714678019845 = 22, 
.125714678019845 .. .173042591752017 = 18, .173042591752017 .. .220370505484189
= 19, .220370505484189 .. .267698419216361 = 22, .267698419216361 .. 
.315026332948532 = 14, .315026332948532 .. .362354246680704 = 22, 
.362354246680704 .. .409682160412876 = 10, .409682160412876 .. .457010074145048
= 20, .457010074145048 .. .504337987877219 = 10, .504337987877219 .. 
.551665901609391 = 7, .551665901609391 .. .598993815341563 = 17, 
.598993815341563 .. .646321729073735 = 21, .646321729073735 .. .693649642805906
= 11, .693649642805906 .. .740977556538078 = 15, .740977556538078 .. 
.78830547027025 = 15, .78830547027025 .. .835633384002421 = 12, 
.835633384002421 .. .882961297734593 = 13, .882961297734593 .. .930289211466765
= 13, .930289211466765 .. .977617125198937 = 14, .977617125198937 .. 
1.02494503893111 = 10, 1.02494503893111 .. 1.07227295266328 = 11, 
1.07227295266328 .. 1.11960086639545 = 13, 1.11960086639545 .. 1.16692878012762
= 7, 1.16692878012762 .. 1.2142566938598 = 8, 1.2142566938598 .. 
1.26158460759197 = 7, 1.26158460759197 .. 1.30891252132414 = 13, 
1.30891252132414 .. 1.35624043505631 = 11, 1.35624043505631 .. 1.40356834878848
= 11, 1.40356834878848 .. 1.45089626252065 = 9, 1.45089626252065 .. 
1.49822417625283 = 6, 1.49822417625283 .. 1.545552089985 = 9, 1.545552089985 ..
1.59288000371717 = 6, 1.59288000371717 .. 1.64020791744934 = 9, 
1.64020791744934 .. 1.68753583118151 = 8, 1.68753583118151 .. 1.73486374491368
= 4, 1.73486374491368 .. 1.78219165864586 = 4, 1.78219165864586 .. 
1.82951957237803 = 3, 1.82951957237803 .. 1.8768474861102 = 3, 1.8768474861102
.. 1.92417539984237 = 3, 1.92417539984237 .. 1.97150331357454 = 6, 
1.97150331357454 .. 2.01883122730671 = 6, 2.01883122730671 .. 2.06615914103889
= 4, 2.06615914103889 .. 2.11348705477106 = 1, 2.11348705477106 .. 
2.16081496850323 = 1, 2.16081496850323 .. 2.2081428822354 = 3, 2.2081428822354
.. 2.25547079596757 = 2, 2.25547079596757 .. 2.30279870969975 = 0, 
2.30279870969975 .. 2.35012662343192 = 2, 2.35012662343192 .. 2.39745453716409
= 2, 2.39745453716409 .. 2.44478245089626 = 0, 2.44478245089626 .. 
2.49211036462843 = 0, 2.49211036462843 .. 2.5394382783606 = 1, 2.5394382783606
.. 2.58676619209278 = 1, 2.58676619209278 .. 2.63409410582495 = 1, 
2.63409410582495 .. 2.68142201955712 = 0, 2.68142201955712 .. 2.72874993328929
= 0, 2.72874993328929 .. 2.77607784702146 = 0, 2.77607784702146 .. 
2.82340576075363 = 0, 2.82340576075363 .. 2.87073367448581 = 1, 
2.87073367448581 .. 2.91806158821798 = 0, 2.91806158821798 .. 2.96538950195015
= 1]

You asked:

  • I am unable to add a constraint with if statement.

The if syntax that you were using isn't allowed in 2D Input. Anyway the same thing can be better expressed with max because it'll remain symbolic until the solver supplies values for the variables, whereas an if evaluates immediately.

eq1:= Q2 = max(0, d*h*(x - delta*(alpha+beta)));

  • I have to minimize the function TRC, i am unable to do. 

You need a comma after the I2 = 0..8.

  • Check whether i have represented I1 and I2 with respect to alpha and beta right or wrong.

I think that I'd need substantial background information on the problem to answer that.

Anyway, making the two minor syntax changes that I've given, the solver will at least return an answer, which is a step in the right direction, even though the ensuing discussion indicates that there are still some logic errors to work out.

You've been making the same mistakes over and over, for years now. In your 2D Input, you need to remove any spaces after displaytextplot, and draw. Also, the arguments to display need to be in parentheses, not square brackets, just like all other procedural commands. These are exactly the same problems as the last Question of yours that I Answered.

Even a crystal ball cannot solve a nonsensical problem. You cannot simultaneously solve n equations for more than n variables (n=1 in this case). That is a fundamental principle of mathematics. It is beyond being an undecidable problem (such as the Continuum Hypothesis or the propositions whose existence is guaranteed by Godel's Theorem). It makes no sense at all.

Following the directions given on the Wikipedia page "Weibull distribution", section "Parameter estimation", subsection "Ordinary least square using Weibull plot", I only made a single small change to your computation: I changed (i - 0.5)/n to (i - 0.3)/(n + 0.4). Anything else that may appear to be a change is merely a mathematically equivalent simplification. (In particular, there's no need to use both sort and Rank; using either one is sufficient.) Then I used Statistics:-LinearFit to do the regression.

restart
:

St:= Statistics:

S:= -<-255.172, -235.249, -196.935, -132.567, -77.3946, -32.1839, -0.766284>;

Vector(7, {(1) = 255.172, (2) = 235.249, (3) = 196.935, (4) = 132.567, (5) = 77.3946, (6) = 32.1839, (7) = .766284})

n:= St:-Count(S);

7

lnpof:= map(i-> ln(-ln(1-(i-0.3)/(n+0.4))), St:-Rank(S)^+);

Vector(7, {(1) = .8578795099, (2) = .3858416541, (3) = 0.8194559696e-2, (4) = -.3665129205, (5) = -.7898398342, (6) = -1.343181903, (7) = -2.308880127})

lnsigma:= ln~(S);

Vector(7, {(1) = 5.541937827582851, (2) = 5.46064452765943, (3) = 5.282873725054183, (4) = 4.887088178000508, (5) = 4.34891701071996, (6) = 3.4714663275086806, (7) = -.26620242077484896})

plot((data:= <lnsigma | lnpof>), style= point);

PV:= St:-LinearFit([1, ln_x], data, ln_x, output= parametervector, summarize);

Summary:
----------------
Model: -2.4778919+.47999708*ln_x
----------------
Coefficients:
              Estimate  Std. Error  t-value  P(>|t|)
Parameter 1   -2.4779    0.4212     -5.8834   0.0020
Parameter 2    0.4800    0.0931      5.1576   0.0036
----------------
R-squared: 0.8418, Adjusted R-squared: 0.8101

Vector(2, {(1) = -2.4778918861403914, (2) = .47999707789937385})

k:= PV[2]; lambda:= exp(-PV[1]/k);

HFloat(0.47999707789937385)

HFloat(174.56657533276328)

On the Maple help page ?Weibull, k is called c, and lambda is called b.

X:= St:-RandomVariable(Weibull(lambda,k)):

plot(St:-PDF(X,t), t= 0..9);

 

Download WeibullParameters.mw

This Answer is fundamentally the same as the one by @nm ; I just want to give some background information.

The command evalb, when applied to an equation, checks whether the two sides of the equation are syntactically identical; but you want to check whether the two sides are mathematically equivalent.

Two expressions are syntactically identical if they are stored in exactly the same way in the computer's memory. (In Maple, in practice, this means that only one copy is actually stored at all.) Via a process that Maple calls automatic simplification, some expressions which are typed in differently will become syntactically identical:

evalb(sin(a+b) = sin(b+a));
             
true

I think that you (and most other readers here) already understand basically what it means for two expressions to be mathematically equivalent. Let me try to be more precise (although this is still not a perfect definition): Two expressions are mathematically equivalent if they are numerically equal for all possible numeric substitutions of their variables for which they're both defined and which satisfy the "current assumptions". The "current assumptions", if unspecified, are all complex numbers. In Maple, assuming or assume can be used to specify assumptions. 

Of course, if two expressions are syntactically identical they are also mathematically equivalent. But the converse isn't true. It can be proven (see Richardson's Theorem) that it's impossible to create a perfect algorithm to determine mathematical equivalence. So, whether you use isexpandsimplify, or numerous other commands, there will always be undecidable cases. However, one may hope that in the cases where the equivalence is already established via a well-known and elementary theorem (such as the case you present), Maple will be able to verify it. The best command to try first is is:

is(sin(x + y) = sin(x)*cos(y) + cos(x)*sin(y));
              true

The reason that is is the best first choice is that it will give up and return FAIL if after some reasonable amount of time it cannot decide true or false. Other commands may run for an infeasible amount of time.

Regarding checking integrations: Suppose that f is the expression that you want to integrate (let's say with respect to x), and is your proposed antiderivative that you want to check. Then do

is(f = diff(F,x));

You may need to include assumptions on x. Appropriate assumptions are likely obvious. For example,

is(f = diff(F,x)) assuming x > -1, x < 1;

There's usually no need to exclude isolated singularities such as specific values of x that make a denominator 0.

Keep in mind that the default assumption in Maple is "all complex numbers", not "all real numbers". The calculus of functions of complex variables is sufficiently similar to that of real variables that you usually do not need to make the distinction.

1 2 3 4 5 6 7 Last Page 1 of 385