Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

It is not a rational function (one polynomial divided by another), and thus it's not clear what is meant by "proper" fraction (one whose denominator has greater degree than its numerator).

I see no relationship between your Question and its title, "Numeric Formating". What did you mean?

@omkardpd Please post the code in which this happens.

@Earl Your worksheet won't upload because of special characters in its filename. I recall seeing a semicolon in it. Try making it something simple like RiverCrossing.mw.

@John SREH In that case, simply change Preben's next to break. This'll end the loop cleanly rather than going to the next value of the loop index.

By the way, it looks like you're numerically integrating (the square of) a numeric dsolve solution. You can get dsolve to do that for you, which'll give you much better error control. I'll expand on this in an Answer below.

@Rouben Rostamian  The command InertForm:-Parse will take an infix expression entered as a string and return an equivalent prefix expression (not as a string). That's most of the work. From there, you can change all `%+` and `%*` to exactly two operands per operator, move the operators to the ends, and remove the parentheses.

I just have some quick and immediate thoughts about this. It's been less than 5 minutes since I started reading this post, so my ideas are not fully formed.

It seems that this RPN requires that each operator have a fixed number of operands. That means that a distinction must be made between unary negation and binary subtraction. These are different keys on most pocket calculators but not in the standard alphabets used for most computer languages, including Maple.

What makes you say that it'll speed up evaluation? I certainly see that RPN can speed up the manual entry of expressions. But all expression evaluations AFAIK are already done with stacks.

The term hailstone sequence is usually associated with the name Collatz. The classic example is

A[n+1]:= `if`(A[n]::even, A[n]/2, 3*A[n]+1), A[1] = any positive integer.

The Collatz conjecture is that for any given A[1], there exists an n such that A[n] = 1.

I don't know what you mean by double hailstone sequence.

@emendes a) The quantile function is simply the inverse function of the CDF. In this case, the CDF can't be symbolically inverted while it contains the parameter m. But for any given numeric value of m, a numeric inverse can be easily obtained with fsolve, like this:

fsolve(eval(Statistics:-CDF(X2, v), [m= 3]) = .95, v= 0..1);

     0.776393202250021

b) $ n simply means "make n copies." For example, x $ 5 is x, x, x, x, x. The unevaluation quotes that I showed earlier forces the expression to be re-evaluated for each copy, which in this case makes the distributions i.i.d.

 

Please upload your worksheet using the big green up arrow on the toolbar of the MaplePrimes editor.

If you copy and paste your code to a plaintext Maple Input region and then hit return, you may get a more informative error message.

@quo On the other hand, it's fine to independently assign values to m[a], m[b], m[a,b], m[], etc. Each of these has an effect on m, which is the parent table, but they don't affect each other.

(You can even dependently assign values to m[a] and m[b], as in
m[a]:= 1 + m[b];
m[b]:= 3;

though I don't recall ever having a need to do this.)

@quo The main problem with using an indexed variable such as m[a] is that you cannot independently assign values to both m and m[a]. Worse yet, if you try to do it, you won't get an error message; you'll just get incorrect results.

@rstellian I said that if you just wanted to draw samples, then a much-more efficient procedure could be used. Here it is:

Sampler:= (i::posint, x::posint)->
   subs(L= irem~([$i-x..i-1, $i+1..i+x] -~ 1, 100) +~ 1, R= rand(1..2*x), ()-> L[R()])
:
S:= Sampler(98,5):
['S()' $ 25]; #Sample size is 25.

 

@Markiyan Hirnyk As described in the example in the last sentence of the first paragraph of the original Question, the data points are 93, 94, 95, 96, 97, 99, 100, 1, 2, 3. The mean of these is 68. There is nothing to adjust.

Please change the title of your Question from "I really need your help, please" to something mathematical or scientific! That you need help is already obvious because you're posting a Question. Thus, the current title has very low information content. Thus, the post will likely be ignored by future readers.

First 356 357 358 359 360 361 362 Last Page 358 of 709