6672 Reputation

17 Badges

10 years, 174 days

MaplePrimes Activity

These are answers submitted by tomleslie

I read the title of your post, ie "letter frequency as function of word length" and figured that can't be too hard. So I produced the following

So what does this do? (NB on my machine tis takes around 15 secs to execute - so be patienr!)

Well it takes all the words in your specified dictionary (ospd3), and processes them into an array whose columns (1..26) represent the letters A..Z, and whose rows represent the wordlengths (0..39). The [row,column] entry is the number of times the letter (ie column) occurs in all the words of the length represented by the row entry.

Easiest way to understand this is to look at row[1]  (ignore row(0), not sure why row(0) occurs I didn't get that far! ). This represents all word of length=1 and has two non-zero entries: ans[1,1]=1 and ans[1,9]=1, which represent the exiistence of the single-letter words "A" and "I"

Now I'm pretty sure that the resulting array (ans) is correct - but I then realised it bore no "sensible" relationship to the array you were trying to achieve (and whose picture you posted). So at this point I stopped!

One way to look at what I have done is to investigate entries in the intermdeiate variable B, which is a sequence of 4-element lists, The four entries in this lists consist of

# [ letter,
#   word,
#   lengthOfWord,
#   NumberOfOccurrenceOfLetterInWord
# ]

You can investigate any element in this list with B[n] where n is a number between 1 and 2095886, so for example B[1000000] will return ["M", "BILGY", 5, 0], whihc tells me the (useful?) information that the word "BILGY" is 5 letters long and contains the letter "M" exactly 0 times.

Having generated the sequence B, I'm pretty sure that I could organise the data you want in pretty much any way you want - but I'm just unclear aboout what you are after!????

Set up plots individually and the use the display() command, as in



 x := <1, 2, 3, 4, 5>:

 y_1 := <-0.1280360524e-1, -0.1474597325e-1, -0.1485958182e-1, -0.1486652215e-1, -0.1486682216e-1>:
 y_2 := <-0.1557970259e-1, -0.1449874881e-1, -0.1484654339e-1, -0.1482720338e-1, -0.1481534159e-1>:

 p1 := pointplot( [seq([x[j], y_1[j]], j = 1 .. 5)],
                  color = red,
                  symbol = solidcircle,
                  symbolsize = 16
 p2 := pointplot( [ seq([x[j], y_2[j]], j = 1 .. 5)],
                  color = blue,
                  symbol = solidcircle,
                  symbolsize = 16

 display([p1, p2]);

The TimeSeries package seem to rely on equally-spaced time points (I could be wrong!!), but you seem to have more or less random time points - so timeSeries is probably(?) the wrong choice

It isn't too difficult to import the data and organise it in a more or less sensible way. The problem is to decide what is a sensible organisation, and this (probably) depends on what you are subsequently going to do with the data.

The problem is made more difficult by the fact that the two time series don't really "align", so you inevitably end up with

timeValue, QGASvalue, NULL, or

timeValue, NULL, PMEASvalue

and frankly, dealing with NULL entries is a right royal pain in the whatever.

The attached shows one option, where the data is ultimately stored as a table. The table indices are time values, and the table entries are a two-element list of [PMEASvalue, QGASvalue]. In most cases, one of these list entries is NULL, becuase no corresponding data value exists.

Whether or not you find this organisation acceptable depends very much on what you plan on doing with the data!!

as in

A := Array([[1], [2], [3]]);

As has aready been pointed out, what do you mean by logp and logd - should these be log(p) and log(d)

Also (as been noted previously), I'm pretty sure that your final equation is missing a multiplication symbol. If I make these assumptions, and just run the code

f:= 2=c/p*(1+p^2)^2,
fsolve( {f}, {c,p,d,m});

then I get the answers

{c = 0.3049933633e-2, d = 6.797845273, m = -0.1978119948e-1, p = 0.1524973909e-2}


You have numerous instances where you use the subs() command in the format

subs( {set of substitutions}, [list of expression, but only one entry]);

Now I have no idea why you are using [B1], [alpha], [theta], as the second argument in these subs() expressions, rather than simply B1, alpha, theta.

When I make these simple corrections, as shown in the attached,

I get


Now I didn't bother debugging any further, because if theta1:=0 - anything  after this point is going to be really boring

In the (sub)-section you label as an "Analytical solution", you issue the command

pds := pdsolve(pde, bcs, numeric, time = t, range = 0 .. x[max], indepvars = [x, t], spacestep = (1/1000)*x[max], timestep = (1/1000)*t[max]);

The significant operand in this command is the word 'numeric'. This means that Maple will compute a numeric solution, (not an analytic one) and the default method will be finite difference.

I have no problem with you (subsequently) trying to write your own numerical method  for solving the same problem, but before we even get into that, you have to accept that you will be comparing your numerical solution with Maple's numerical solution.

Is that really what you want?

Your actual question is unclear

The following worksheet computes/plots most things you might want to know about your ODE - and when I guess that what you want to compute is diff(f(eta), eta, eta) when eta =0, it does produce the answer .332057384255589

Sometimes this gets banjaxed by Maple permission issues.

I know that the following reference is for translating completely different help files, but you might want to read

The important(?) step is that you have to be running Maple as an administrator in order to write the new help files to the desired location. Don't think that just because you have administrator privileges, Maple has. By default, it doesn't. So try the steps in the above link, whilst running MAple as administrator

It's worked before - can't hurt to try!

A cou00le are shown in the attached worksheet


If you change the final command in your worksheet to specify the indeterminate function ( ie follow the instruction given in the error message), as in

pdsolve(sol, w(x,y));

then Maple will (correctly!) return

w(x, y) = 0.

Note that this satisfies all of your boundary conditions, and your PDE - so is definitely a solution for the problem

Somehow I have the feeling that this is not what you want!

In this case you are being warned that you should only use solve() to solve for names or functions, ie not expressions such as


presumably becuase the requested operation is not guaranteed to work correctly!

If you really, really want to, then you can turn off warnings (I do not recommend doing this). But if you precede your code with


then all warnings will be turned off. I would reset this to the default immendiately after your code, with


I suggest that you also check some of the terms in your definition of system3d: in particular




Are these really what you meant???


This wold be OK if 'x' were guaranteed to be of type 'algebraic', Now what would you expect to happen if 'x' is not of type algebraic??

If you want to know what type/algebraic actually means, the check out the help page at ?type/algebraic

There are many Maple types which are not 'algebraic'!

L[1..5] returns an array whoses indices are 1..5 and whose values are L[1], L[2], L[3], L[4], L[5]

L[3..6] returns an array whose indices are 3 ..6 and whose values are L[3], L[4], L[5], L[6].

You seem to expect that L[3..6] would return an array whose indices are 1..4 and whose values are L[3], L[4], L[5], L[6]

So the obvious question you have to ask yourself is: when you ask for L[3..6] - what are the indices of the returned array?? Are they 3..6 or 1..4???

Now I could (if I had to) come up with argument in favour of either: but at some point, somewhere in history, somebody decided that L[3..6] would return an array whose indices are 3..6 (ie not 1..4), and then decide on the best way to represent it

Without an example it is dfficult to be specific, but you should investigate the colorscheme["valuesplit"....] plot option

Consider the following "toy" example

# Generate points for an example function
    pts:=[seq([k, sin(k)], k=-evalf(Pi)..evalf(Pi),0.25)]:
# Get the y-values of the plots and sort them in
# ascending order
   lims:= sort([seq( j[2], j in pts)]):
# valuesplit the colorscheme so that the maximum
# value (given by lims[-1]) is one color, and all
# others (range is given by lims[1]..lims[-2] )
# are a differentt color
   plots:-pointplot( pts,
                           colorscheme=[ "valuesplit",
                                                [ lims[1]..lims[-2]="Red",

First 112 113 114 115 116 117 118 Last Page 114 of 138