Carl Love

Carl Love

28100 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@brian bovril You do have a point. Unfortunately, when you use is with a type, it's the same as using the type command. Unfortunately, integer is a type, not a property (in the Maple sense). (In contrast, real is a property, not a type.) See the eighth and ninth paragraphs at ?is .

@toandhsp Thank you for spotting the error in my Answer. I've fixed the original. The error was caused by my cutting-and-pasting from two separate runs, thus different random polynomials. I hope that you now understand the Answer.

Your equations are highly nonlinear---the exponents aren't even integers. There are 72 equations and 72 unknowns. It is reasonable to expect fsolve to take a long time with that. How long does it take?

@brian bovril Of course the tests fail. That Answer is just a floating-point approximation to the true answer. It isn't even an integer.

In the future, please use the upload arrow (green arrow---last item on the second row of the MaplePrimes toolbar) to upload your worksheet, or cut-and-paste your code in plaintext format, rather than pasting your code as an image. This will make it much easier for other people to work with your code.

@acer Good idea. But selectremove works just as well with functions as lists, and the Vector form makes the shuffling easier. So I reduced the code to this:

rearrangeCurves:= proc(
     v_items::specfunc(anything, PLOT),
     v_reorder::list([integer,integer]):= []
)
local p, curves, rest;
     (curves,rest):= selectremove(type, v_items, specfunc(anything, CURVES));
     curves:= < op(curves) >:         
     for p in v_reorder do
          curves[p]:= curves[p[[2,1]]]
     end do;
     PLOT(convert(curves,list)[], op(rest))
end proc:

@taro Note that op(a) and a[] are the same only for lists and sets.

@mehdi jafari Sorry, I meant imaginaryunit, not complexunit. I have corrected the original.

Regarding method= float: If you have a large Matrix of exact values (say, Gaussian integers as in this example), then it will be much faster to use method= float; for a 2x2 Matrix, it makes no significant difference.

@MuriloLobo Yes, I understand that extra values may need to be added after the trimming, if trimming is used.

I don't know how to account for the changing mean and standard deviation. Perhaps there is a standard distribution that is like a Normal but has finite bounds. I don't know enough about distributions to answer that. If you check ?Statistics,Distributions , you might find something.

Note that the mean and standard deviation of a random sample are unlikely to be exactly equal to the mean and standard deviation of the distribution from which the sample is drawn.

@MuriloLobo Your question is now well formed to me. Thank you.

To answer your question, would it be acceptable to generate a normal Normal sample with given mean and sd and then trim off the values that lie outside the 95% bounds? Do you want it trimmed on bottom end also?

I executed your worksheet twice using the menu command Edit -> Execute -> Worksheet and I cannot reproduce your problem. I get fully displayed matrices.

@Christopher2222 Are you referring to

kernelopts(limitjvmheap= true);
kernelopts(jvmheaplimit= 2000*Unit(mebibyte));

?

@Joe Riel Joe, see the Wikipedia article "Longest common subsequence problem". The command StringTools:-LongestCommonSubsequnce would return the characterwise longest common subsequence. What Markiyan wants is the wordwise longest common subsequence.

I am adapting the algorithm described in the Wikipedia article. The first step is to break the strings into Arrays of words.

Definitions: For a positive integer n, let [n] denote {1, 2, ..., n}. Define a (finite) sequence as a function f: [n]-> A for some n and some set A. Define the length of f to be n. Let n, A, and sequence f be given. Let S be a subset of [n]. Let O: [|S|]->  S be the unique increasing bijection determined by S. Then g:= f@O is the subsequence of f determined by S. Note that g is itself a sequence as defined above. Note that g: [|S|]-> A and thus, when viewed as a sequence, g does not depend on S, merely on |S|.

Let f1 and f2 be two sequences, and let g1 and g2 be respective subsequences. If g1 = g2 (as sequences), then g1 is a common subsequence of f1 and f2.

@Mac Dude To my mind, the original question and the followup both make no sense. So I can't really say that the Question has been Answered, although the Replies do contain some useful information for the OP. I am waiting for a reformulation of the original question.

@MTata94 Change ln to log10 in my code. I already updated the Answer. If I do this, then I get 1860.633190 for evalf(Fi(30)).

First 545 546 547 548 549 550 551 Last Page 547 of 709