Carl Love

Carl Love

28015 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@janhardo

Here are two expressions that are obviously mathematically equal. However, they are entered in forms that are sufficiently different that Maple doesn't automatically recognize them as equal, so they are stored separately. I'll call them syntactically distinct.

e1:= (x+1)^2; e2:= expand(e1);

(x+1)^2

x^2+2*x+1

The is command verifies that they are mathematically equal:

is(e1 = e2);

true

Sometimes more-elaborate techniques are required for that verification:

is(simplify(e1 - e2) = 0);

true

But keep in mind that it has been proven (Richardson's theorem) that there are mathematically equal expressions for which the equality can never be verifed.

 

Using evalb just verifies whether they are syntactically identical:

evalb(e1 = e2);

false

Using a relation (=, <, <=, etc.) as the condition of an if statement implicitly invokes evalb:

if e1=e2 then "identical" else "not identical" fi;

"not identical"

 

Download IdenticalVsEqual.mw

@ Brendan McKay: You wrote:

  • I was concerned that the format of the output is not documented, so it might change.

On the off chance that the format changes such that your code cannot interpret it, then you would know that that code is being run in a Maple version newer than the version that you used to write the code. Thus, your stated purpose would be fulfilled anyway.

@mmcdara That's quite impressive work! Can we confirm that the maxima are global (NLPSolve tends to return local optima)?

@dharr Many of the basic functions of number theory distribute over the multiplication of relatively prime factors. These are called multiplicative functions (Wikipedia link). The sum-of-divisors function sigma is one such function. From a few quick read-throughs of the OP's worksheet, I think that he is applying it correctly to products of powers of distinct primes.

@mmcdara You wrote:

  • ...the Statistics:-NonlinearFit solver uses Optimization:-NLPSolve's and this latter supports constraints (for instance p3 > p2, p1 > 0, ...)....

That's not quite true for your example constraints. Strict inequality constraints are not allowed and will be flagged by the syntax checker. So, the examples should be p3 >= p2p1 >= 0.

@C_R Correct, the output of make_nice is not a mathematical expression. Being an expression intended for pretty-printed display, it is essentially a MathML expression constructed via Maple's Typesetting package. You can see this with lprint:

k:= 3/8*ln(x/y):
pp:= make_nice(k):
lprint(pp);

Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mn("3"
),Typesetting:-mn("8")),Typesetting:-mo("&InvisibleTimes;",mathcolor = 
"#909090"),Typesetting:-mrow(Typesetting:-mi("ln",fontstyle = "normal"),
Typesetting:-mo("&ApplyFunction;"),Typesetting:-mfenced(Typesetting:-mfrac(
Typesetting:-mi("x"),Typesetting:-mi("y"))))),Typesetting:-_Hold([(3/8) %* ln(x
/y)]))

I don't understand why you'd want to perform "further mathematical manipulations" on the output of make_nice. Since the output is mathematically equivalent to the input k, why not just perform them on k? However, if you look at the last part of that lprint output, you'll see that it essentially retains a copy of the original expression. So you could do

value(op([-1$3], pp)) * 8

So, in this sense the output of pp is not an endpoint, although I see no good reason not to use simply k*8.

@Andiguys The command that you want is Minimize, not minimize. The latter is a distinct command that can't be used for this problem.

@Carl Love I'm amazed that no one has caught my egregious error yet. Where I said min in the above Answer, I should've said max.

@MaPal93 I just want to add that these are great Questions about fsolve, and I think many readers will be able to benefit from their Answers. These are longstanding difficulties that often arise with iterative use of fsolve. My only issue is with losing patience reading your worksheets, not with the Questions themselves.

@mmcdara Thanks for that. It's amusing and interesting. "I'm hard headed" (or hardheaded) would be an idiomatic English translation.

@MaPal93 I have solutions for your two questions above, but I don't have the patience to work through your long worksheet. Indeed, I've been ignoring your Questions, even though they're good Questions, for months because of this. If you make a version for me to work on, I will gladly answer those two questions. 

By a "version for me", I mean:

  • Use colons to suppress all output that is not directly related to the fsolve problem.
  • Use only one- or two-letter variable names for the decision variables and parameters of the equations passed to fsolve. No subscripts, no Greek letters.

@JAMET You still have a space after textplot

You wrote:

  • I really have a hard nipple

I'm guessing that you don't really know what that means in English? It's a somewhat sexual thing. Perhaps you should try translating that again.

@mmcdara I agree with a lot of what you said. However, there is no ambiguity whatsoever in the meaning of denom(res) = 0, neither in Maple nor in mathematics. It means that both the real and imaginary parts are (or, equivalently, the modulus is 0) regardless of the presence of the imaginary unit. There is no situation where it means that the real part is 0 and the imaginary part is unrestricted.

Also, there is only one equation here, not two. An inequation has a completely different algebraic status than an equation when solving a system of equations.

@mmcdara Your way is very likely better than the linear regression method that I used. I used it because the technique shown in my linked subsection of the Wikipedia page seemed almost identical to what the OP was already doing, except for the small change that I noted: replacing (i - 0.5)/n with (i - 0.3)/(n + 0.4).

Using the formulas for the maximum likelihood estimators given in the final section of that Wikipedia page, I get the same numbers as you did by using the equivalent Maple command.

k_hat:= fsolve(add(S^~k*~ln~(S))/add(S^~k) - 1/k = add(ln~(S))/n, k);
                     k_hat := 0.9301095062

lambda_hat:= (add(S^~k_hat)/n)^(1/k_hat);
                 lambda_hat := 129.944334168688

@Samir Khan I appreciate the great use of video/animation that you made in your Post. Vote Up!

First 15 16 17 18 19 20 21 Last Page 17 of 708