Carl Love

Carl Love

28075 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@acer Thank you. When I checked, it was listed (with dead links) in Recent Posts and Active Conversations, but not in Recent Questions. It seems to take an inordinate amount of time for that update to happen.

@Rouben Rostamian  Although what you posted is not a complete Answer, it's almost an Answer, and it's all in the right direction towards getting a complete Answer. So, your significant quantity of work is appreciated and deserves a vote up.

@vv Amazing, but how did you find and its argument? 

Why are you using a finite-difference derivative approximation? And with such a large value of delta (0.01) at that? If there's some reason why you can't use a regular derivative, that may explain why fsolve is not working. fsolve might work with a lower value of Digits, say 5 or 6. The default in Maple is Digits = 10, so there's a good chance that's also the default in Maple Flow.

@mmcdara In Maple 2022, I tried your Student[Statistics]:-Sample command and numerous variations. They either returned hfloat results identical to Statistics:-Sample, meaningless results (e.g., when using Binomial(100, 3/10)), or some indication that the input wasn't understood (e.g., when using BinomialRandomVariable(100, 0.3)).

It would be nice if there was a nicer way than trunc to get Sample to return integers for integer distributions.

@pointerbender As to the reason that it helps, note that vv's idea is a standard trick for proving summation formulas by mathematical induction. As in
 

restart:

#Use mathematical induction to prove this:
S:= n-> Sum(k, k= 1..n) = n*(n+1)/2:
S(n);

Sum(k, k = 1 .. n) = (1/2)*n*(n+1)

#Base case:
S(1);

Sum(k, k = 1 .. 1) = 1

#Inductive case:
S(n+1) - S(n) = n+1;

(Sum(k, k = 1 .. n+1)-(Sum(k, k = 1 .. n)) = (1/2)*(n+1)*(n+2)-(1/2)*n*(n+1)) = n+1

simplify(%);

(Sum(k, k = n+1 .. n+1) = n+1) = n+1

 

Download SumInduction.mw

Note that I've only used the inert command Sum rather than its active form sum. So the proof is making no use of the fact that Maple's sum already knows the formula that we're trying to prove, which of course wouldn't be fair.

So that your Question can be better Answered, please clarify these things:

  1. Your example problem is so trivial that I'm having trouble answering it partly because there are so many ways to code it (most of which don't use recursion) and partly because it's hard to understand why anyone would want a recursive solution for something that can be completely solved with a very simple equation (x[i] = x[0] + i*b). I suspect that the other two respondents have similar thoughts. So, if this was just intended to be a simple example of a more-general problem that is your actual interest, then please give a more-relevant example.
     
  2. What do you mean by "binary" in the title? Yes, I know what binary means, but I can't see how it applies to your example. Perhaps if that were explained, the example wouldn't seem so trivial.
     
  3. Reading what you wrote as standard mathematical English, it seems that you want to restrict the solutions to a particular set A. That's not possible if your other mathematical symbols are meant in their usual interpretations. (Thus, the other two respondents assumed that you meant that you want the output sequence as a set, without restriction.) So, what did you really mean by the set A? The restriction to a given set is not possible because once a value is given for b and any single x[i], the rest are completely determined by your formula x[i] = x[i-1] + b.

@ecterrab It is not "an entirely different problem". In both cases, an anomaly occurs because the input expression can be simplified to 0. Whether that occurs inside of a RootOf is of minor significance. I wanted to present an example that would give problematic results without an error message[*1], so I intentionally chose one where RootOf wouldn't be involved.

[*1] ...because bugs that are manifested without throwing an error are much more dangerous and insidious.

@acer Here's a similar but simpler case with problematic (IMO) results. I prefer the solve result.

PDEtools:-Solve(sin(t)^2 + cos(t)^2 - 1, t); #NULL output 
solve(sin(t)^2 + cos(t)^2 - 1, t);
                               
t

You wrote: 

  • Will the above work all the time? should this command be used to obtain this information or is there a better way?

You need to reread carefully your posted output of your own commands, because they didn't even work on the example that you showed. The extremal values of the second coordinate do not necessarily correspond to the extremal values of the first coordinate. However, extracting the min and max (rather than the first and last) of each column of the data matrix is a viable strategy for obtaining the "true view"---one that I've used myself to get around that DEFAULT problem (long before the "originalview" field was introduced).

@angelisasking I think that all that you need to do is change the i on the right side of the line of code that I indicated to some other otherwise-unused variable.

@Will_iii Since I don't have Maple Flow, I can only answer by comparing to Maple itself. From what I've seen so far, Maple Flow is just a large subset of Maple commands in a completely different GUI interface.

Since log[b](x) = ln(x)/ln(b), surely this will work:

ln(1000)/ln(10)

Since your error message indicates that the Units:-Simple package is being used, there's a chance that this will work:

:-log[10](1000)

The :- is to tell it to NOT use the package version of log. It works in Maple, but I don't know whether it works in Maple Flow.

There was an Excel file containing the 3D data attached to your recently deleted duplicate Question. Please post and/or attach that file here.

@acer Thank you for the corrections, which I've incorporated into my Answer. I too was skeptical about adding whitespace. I've verified that what I currently have in my Answer works in Maple 2018.

I have no doubt that Typesetting is both easier to use and more flexible / forgiving in syntax. My decision to use nprintf was influenced by knowing that the OP's interest is graph theory and that constructions such as `1:1` are vertex labels produced by GraphTheory:-CartesianProduct and related commands, and vertex labels must be type {symbol, string, integer}. Still, as I said, if the OP only wants to use these multicolored objects for prettyprinting, then they might as well use your Typesetting-based method.

@tomleslie You wrote:

  • After the point of achieving a solution, I have no idea what your subsequent code is trying to achieve.

The OP's goal is to get an approximate series solution by the Homotopy Perturbation Method. AFAIK, that's the only purpose of HPM. The well-known S-E-I-R ode system given may just be an example with a more-general HPM solver being the goal.

First 83 84 85 86 87 88 89 Last Page 85 of 709