tomleslie

13876 Reputation

20 Badges

15 years, 181 days

MaplePrimes Activity


These are replies submitted by tomleslie

The conclusion I have come to is that accurate syllable counting cannot be achieved

I think that Maple's "get-out" on this one, is (from the help page)

The morphological syllable length is defined to be the number of vowel-consonant changes in word. (Note that this may not agree with the lexical syllable length found in dictionaries.)

Before I came to the conclusion above I thought it might be fun to try and work out what "rules" are actually being applied by Maple's  SyllableLength()  command, and whether ti might be possible to do better

A moment's thought will convinece you that a reasonable stab at the basic algorithm would be to "telescope" all adjacent consonants to a single consonant, and all adjacent vowels to a single vowel. With 'V' representing a vowel and 'C' representing a consonant, this would result in a string of alternating "V", "C" characters - for example the word "straight" would be transformed to "CCCVVCCC", which would then be "telescoped" to "CVC". Then just count the number of occurrences of the "V" character in the resulting string. So I wrote a little procedure to do this -it's pretty trivial. (I apologise for parts of this - it's a long time since I used any regexp stuff, and I was never that great with 'regexps' anyway)

My experimentation suggest that this is pretty much what the SyllableLength() command in Maple actually does. However it does apply a few extras: for example the above algorithm will render "bake" as "CVCV" and hence count two syllables. The Maple command appears to "get around" this by ignoring all trailing vowels, so SyllableLength("bake") returns 1, but so does SyllableLength("llama")  or SyllableLength("guru")  - not good.

However a trivial piece of regexp magic will reduce the syllable count by one only if the word ends in consonant+"e"+(zero or one)"s". This works, but has the unfortunate side-effect or reducing words such as "he", "the", "due", etc to zero syllables. Another no-brainer: jonly apply this step if the input syllable length is greater than 1.

Then I got to your last example - ie "radio", which the basic algorithm describe above would collapse to  "CVCV" and so the syllable count would be off by 1. Again. another little piece of regexp magic will fix this - any word ending in "io" should have the syllable count increased by 1. However what happens if the "io" is not at the end of the word? consonant+"io"+consonant can be one or two syllables depending on whether the leading consonant is "t", "g", or "s". So OK another little piece or regexp.

Probably because of this last example, I then started thinking about the "ious" problem - think the difference between "specious" and "serious". It would seem that "ious" is one syllable when preceded by "c", "g" "t" or "x" (think "specious", "facetious", "egregious" or "noxious") but otherwise is two syllables ( think "serious", "odious", "pious", "harmonious"). Another regexp and this is solved

At this point, I'm cooking with gas: my routine now seems to be way more accurate than the the inbuilt Maple version, and I'm thinking that there can't be many(?) more "exceptional" cases to handle - until I thought about the "re+vowel" combination. This was when I really realised the magnitude of the problem, reinforced by contemplating reindeer. I simply cannot think of any way to deal with this issue algorithmically (or its relation the "de+vowel" combination,- think dealmaker and deactivate). My conclusion - we're screwed - as in there is no algothmic way to count "dictionary" syllables:-(

FWIW, the routine I came up with is attached

getSyll.mw

 

since you have 1020 variables and 440 equations, it is *seems* perfectly possible that no variables will have an explicit solution, and every variable will be defined in terms of other variables.

How would you expect the solution to be reported  in this circumstance?

As an experiment, I tried

sol:=fsolve(EQ): # <-Note colon, because output is very long

This actually returns a set of equations, showing the dependencies between the variables. You can examine various 'subsets' of this solution using sol[1..10], sol[-10..-1], etc.

Runniing various tests, I cannot find any entry in this solution set where a variable has been explicitly evaluated

x_k = x_k for all variables

and also

0 is not a solution

I have bad news for you - 0 is a solution! You may think that your equations aren't homogeneous, but........

And as I said earlier you actually have an infinity of solutions

As a general rule, solve() can "miss" solutions which do exist, but I don't think I've ever seen it report a solution which doesn't exist.

Respectfully suggest that you stop thinking that you know what the answer is, and start asking why Maple thinks that your system can be solved for arbitrary variable values - becuase in the absence of eviedence to the contrary, my money is on Maple

Other than the row/column switch, and the vector/vectorfield distinction, the thing which bothers me is that the order of the parameters has "switched", although the relevant coordinates attribute is the same in both.

Check the arguments I have highlighted in the output below

restart;
with(VectorCalculus):
with(Physics[Vectors]):
Setup(mathematicalnotation = true):     
SetCoordinates('spherical'[r, phi, theta]):
E_[1]:=Vector(<r, theta, phi>):
Ev_[1]:=convert(E_[1],PhysicsVectors):
E_[2]:=convert(Ev_[1],VectorCalculus):
lprint(E_[1]);
lprint(E_[2]);
Vector[column](3, {1 = r, 2 = theta, 3 = phi}, datatype = anything, storage = rectangular, order = Fortran_order, attributes = [coords = spherical[r, phi, theta]], shape = [])
Vector[row](3, {1 = r, 2 = phi, 3 = theta}, datatype = anything, storage = rectangular, order = Fortran_order, attributes = [vectorfield, coords = spherical[r, phi, theta]], shape = [])

 

@Carl Love 

maximum is always in the first quadrant. Consider

restart;
expr1:=(b-x)*x;
xval1:=solve( diff( expr1, x)=0,x);
subs( x=xval1, expr1);
expr2:=(abs(b)-x)*x;
xval2:=solve( diff( expr2, x)=0,x);
subs( x=xval2, expr2);

I know I'm not checking for max/min, which is sloppy: but a few plots for different values of 'b' should convince you that only maxima occur

Your second ODE ( eq2 in your worksheet) only has the dependent variable F(eta), and, in conjucnction with an appropriates subset of your boundary conditions, can be solved independently of your first ODE. Try adding the grou

A2:=dsolve({eq2, F(0)=S,D(F)(0)=lambda,D(F)(N)=0,D(D(F))(N)=0}, numeric, output=operator);
plots:-odeplot(A2, [eta, F(eta)], eta=0..N);

Now intuition (always dangerous, and possibly unjustified) suggests that knowing the solution for F(eta),  (including all of its derivatives),  *should* make the solution of your first ODE (ie eq1) *simpler*. Unfortunately (so far) I have been unable to persuade dsolve(....,numeric) to accept a modified version of your first equation (ie eq1) containing the appropriate function calls to the "known" solutions of F(eta) and its derivatives.

I'm reasonably sure that this must be possible (somehow) - but it is past my bedtime. I may get back to this tomorrow

 

but I think our responses overlapped. However I do seem to recollect PrebenAlshom having Danish font problems a while back. Not sure if he ever got them sorted. He'd undoubtedly be the best guy to figure out Danish-specific problems!!

Thought this *might* be down to typesetting level - because default is "standard" in 2016 and "extended" in 2017. But changing the typesetting level to "extended" in Maple 2016 doesn't help:-(

You state

Since I can't seem to get my test worksheet to paste into this post,

Don't "paste". Use the big green up-arrow in the MaplePrimes toolbar when you want to upload code. You can only use a "straightforward paste" when your code is wrtten in 1D. Everything about your question suggests that you are using 2D input

  1. For the first case: you might try a  "nested"  fit. Consider fitting the rea and imaginary parts separately: ie fit data (x, Re(g(x)) to Re(f(x, a1, b1, c1), and  (x, Im(g(x)) to Im(f(x, a2, b2, c2). If you do this separately, then obviously there is no reason why a1=a2, b1=b2, c1=c2, etc. However you could write a procedure which accepts trial values a,b,c, performs the two fits mentioned above, then computes and returns (a1-a2)^2+(b1-b2)^2+(c1-c2)^2, so forcing Maple to "fit" by minimising this last expression - this *might* be persuaded to work
  2. For the second case: did Maple throw an Error, for some reason, or did it just fail to find a a minimum? Maple's in-built minimisation routines are pretty good. Others (possibly better) are available as (free!) add-on packages. So the latter may be worth trying.

Obviously, since you don't actually provide the functions on which you are working, I can't try these for you

Added an execution group to generate plots of all dependent functions, for t=0.2 and x=0..1 (the latter range is arbitrary).

Increased the number of points being plotted in al of these 2D curves, just to smooth things out a little

See the attached

pdeSol3.mw

 

The Maple pdsolve() command does not routinely return specific partial derivatives. The usual "trick" to achieve this is to define a "dummy" dependent function, set it equal to the desired, partial derivative, substitute this dummy function in to the original PDE system, and extend the PDE system to include the dummy function definition.

So for your case I set dummy(x,t))=diff(u(x,t),x), made the substituions etc, etc. I also added a couple of plots:

  1. the 3D plot of diff(u(x,t),x), which is given by dummy(x,t) over the range x=0..1, t=0..1
  2. the 2D plot of diff(u(x,t),x) evaluated at a=0, which is given by dummy(x,t), x=0, t=0..1

See the attached

pdeSol2.mw

I'd like to confirm that the same issue/cure occurs for you, so let's keep this as simple as possible, by using the off-line help

  1. Use Help->Maple Help from the Maple Toolbar
  2. Type int/details in the search box
  3. Within the help browser, verify that the box at View->Display Examples as 2D Math is checked
  4. Within the help browser use View-> Open Page As Worksheet
  5. Execute the complete worksheet using !!! from toolbar.
  6. Error occurs

Now repeat the whole process 1-6, except this time at stage (3) uncheck the box at View->Display Examples as 2D Math.

When I do this error "disappears".

The above behaviour is consistent for me, and it doesn't matter whether my Maple input display (at Tools-> Options-> Display -> Input Display is set to "2D Math Notation" or "Maple Input".

If you can reproduce this behaviour, then the bad news is that this is probably yet another of these bugs associated with Maple's 2D input, and is unfixable by anyone on this site.

Maple's current default is to use "2D Input", both in the help examples and for worksheet input. In order to avoid problems of this type, for my own work, I always have Tools-> Options-> Display -> Input Display set to "Maple Input", and the box at Help->View->Display Examples as 2D Math unchecked.

In other words, I only use 1D input. I only ever use the 2D input when debugging other people's problems on this site.

Simply not getting what your problem is

Added an execution group to display version, and the same 1-D group at the appropriate point to compute an integral. Everything still working perfectly

Executed help sheet is attached

int or Int

definite and indefinite integration

 

 

Calling Sequence

Parameters

Options

Basic Information

Description

Notes

Examples

 

 

 

Calling Sequence

 

 

int(expression, x)

int(expression, x)

Int(expression, x)

Int(expression, x)

int(expression, x=a..b)

int(expression, x = a .. b)

Int(expression, x=a..b)

Int(expression, x = a .. b)

int(expression, [x, y])

 

int(expression, x=a..b, opt)

 

int(expression, [x=a..b, y=c..d, ...], opt)

 

Int(expression, x=a..b, opt)

 

int(f, a..b, opt)

 

int(f, [a..b, c..d, ...], opt)

 

Int(f, a..b, opt)

 

 

 

Parameters

 

 

expression

-

algebraic expression; integrand

x,y

-

name; variable of integration

a, b, c, d

-

endpoints of interval on which integral is taken

f

-

operator; integrand

opt

-

(optional) a sequence of one or more of the options listed below

 

 

Options

 
• 

The following options, which are described in more detail in the sections below, apply to definite integrals  only. Where indicated, some options take their default value from environment variables . An option has a default value of false if its corresponding environment variable is not set.

• 

AllSolutions=truefalse

Specifies whether int considers all possible real values for any symbols in the limits of integration. The default value is taken from _EnvAllSolutions.

• 

continuous=truefalse

Specifies whether int looks for discontinuities. The default value is taken from _EnvContinuous.

• 

CauchyPrincipalValue=truefalse

Specifies whether a principal value integral is computed, that is, whether infinities are allowed to cancel in some cases. The default value is taken from _EnvCauchyPrincipalValue.

• 

method=value 

Specifies which internal integration routine(s) to use.  See int/methods  for more details.

• 

numeric=truefalse

Specifies whether numeric integration methods are used instead of symbolic methods.  If numeric=true is specified, other numeric integration options can be specified.  See evalf/Int  for more details.

Basic Information

 
• 

This help page contains complete information about the int and Int commands. For basic information, see the int  help page.

Description

 
• 

The int command computes an indefinite  or definite integral  of the expression expression with respect to the variable x. The name integrate is a synonym for int.

• 

You can enter the command int using either the 1-D or 2-D calling sequence.  For instance, int(f,x) is equivalent to int(f, x).

• 

Indefinite integration  is performed if the second argument x is a name. Note that no constant of integration appears in the result. Definite integration is performed if the second argument is of the form x=a..b where a and b are the endpoints of the interval of integration.

  

If a and b are finite complex numbers, the int routine computes the definite integral over the straight line from a to b.

• 

If the integrand is specified as a Maple operator f, then the second argument must be a range a..b and not an equation, that is, a variable of integration must not be specified.

• 

If Maple cannot find a closed form expression for the integral, the function call itself is returned.

• 

The capitalized function name Int is the inert version of the int function, which simply returns unevaluated. It appears gray so that it is easily distinguished from a returned int calling sequence. In this form, expression can be a procedure, which can be integrated numerically.

• 

For numerical integration, use the option numeric.  For more information on numerical integration, see evalf/Int .

• 

If the second argument is a list, an iterated integration is performed on the variables or ranges in the order given. For definite integration, the list can be omitted and the ranges can be given as a sequence. For indefinite integration, the variables can be given as a sequence instead of a list if all variables appear in the expression being integrated. Otherwise, there may be confusion between variables and option names.

Handling Discontinuities

 
• 

Note that the indefinite integral in Maple is defined up to a piecewise constant. Hence, the results returned by int may be discontinuous at some points. In many cases, you can ensure continuity by replacing an indefinite integration problem by the corresponding definite integral.

kernelopts(version);

`Maple 2016.2, X86 64 WINDOWS, Jan 13 2017, Build ID 1194701`

(1)

int( floor(x), x );

floor(x)*x

(2)

int( floor(t), t = 0..x ) assuming x > 0;

floor(x)*x+piecewise(1 <= floor(x), -(1/2)*floor(x)^2-(1/2)*floor(x), 0)

(3)
• 

For symbolic definite integration, two options control how discontinuities are handled.  By default, int checks for discontinuities, and computes the integral as a sum of independent definite integrals, each of which involves an integrand which has no discontinuities in the interior of the interval of integration.

• 

The 'continuous' option instructs int not to look for discontinuities.

• 

The 'CauchyPrincipalValue' option instructs int to consider the limits from the left and right at each interior discontinuity as a single limit (so that the independent variable approaches the discontinuity at the same rate from the right and the left).  This allows for positive and negative infinite limits to cancel .

Returning the Entire Set of Solutions

 
• 

The 'AllSolutions' option, if set, forces int to return the entire set of solutions for the specified definite integral. This applies only to parameters in the endpoints of the interval, not to parameters in the integrand.

  

Note: The results returned with the 'AllSolutions' option may not be valid for some non-real parameter values. The results are always valid for all real parameter values.

Notes

 
• 

The Maple series function may be invoked on an unevaluated integral to compute a series expansion of the integral (when possible).

• 

When int is applied to a series structure, the internal function `int/series` is invoked to compute the integral efficiently.

Examples

 

int( sin(x), x );

-cos(x)

(4)

int( sin(x), x=0..Pi );

2

(5)

int( sin, a..b );

cos(a)-cos(b)

(6)

int( x/(x^3-1), x );

-(1/6)*ln(x^2+x+1)+(1/3)*3^(1/2)*arctan((1/3)*(2*x+1)*3^(1/2))+(1/3)*ln(x-1)

(7)

int( exp(-x^2), x );

(1/2)*Pi^(1/2)*erf(x)

(8)

int( exp(-x^2)*ln(x), x=0..infinity );

-(1/4)*Pi^(1/2)*gamma-(1/2)*Pi^(1/2)*ln(2)

(9)

int( exp(-x^2)*ln(x), x );

int(exp(-x^2)*ln(x), x)

(10)

series( (10), x=0, 4 );

series((ln(x)-1)*x+(-(1/3)*ln(x)+1/9)*x^3+O(x^5),x,5)

(11)

int(series((ln(x)-1)*x+(-(1/3)*ln(x)+1/9)*x^3+O(x^5),x,5), x)

(1/2)*ln(x)*x^2-(3/4)*x^2-(1/12)*x^4*ln(x)+(7/144)*x^4+O(x^6)

(12)

int( (11), x );

(1/2)*ln(x)*x^2-(3/4)*x^2-(1/12)*x^4*ln(x)+(7/144)*x^4+O(x^6)

(13)

int( exp(-x^2)*ln(x)^2, x=0..infinity );

(1/16)*Pi^(5/2)+(1/8)*gamma^2*Pi^(1/2)+(1/2)*gamma*ln(2)*Pi^(1/2)+(1/2)*ln(2)^2*Pi^(1/2)

(14)

The inert version of the int function simply returns unevaluated.

f:=7*x^3+3*x^2+5*x:

Int(f,x);

Int(7*x^3+3*x^2+5*x, x)

(15)

Inert objects can be evaluated with the value  command.

value((15));

(7/4)*x^4+x^3+(5/2)*x^2

(16)

A double integral

Int(x*y^2, [x=0..1, y=0..1] );

Int(x*y^2, [x = 0 .. 1, y = 0 .. 1])

(17)

int(x*y^2, x, y );

(1/6)*x^2*y^3

(18)

int(x*y^2, [x = 0..y, y = -2..2]);

32/5

(19)

int( 1/(x+a)^2, x=0..2, 'continuous' );

2/(a*(2+a))

(20)

int(1/x^3, x=-1..2, 'CauchyPrincipalValue');

3/8

(21)

int(F(x)*Heaviside(x-1),x=-1..3);

int(F(x), x = 1 .. 3)

(22)

An Elliptic integral

int(1/sqrt(2*t^4 - 3*t^2 - 2), t = 2..3);

(1/5)*5^(1/2)*EllipticF((1/3)*7^(1/2), (1/5)*5^(1/2))-(1/5)*5^(1/2)*EllipticF((1/2)*2^(1/2), (1/5)*5^(1/2))

(23)

Integrating algebraic functions (only for RootOf notation)

f:=(x^2-1+3*(1+x^2)^(1/3))/(1+x^2)^(2/3)*x/(x^2+2)^2;

(x^2-1+3*(x^2+1)^(1/3))*x/((x^2+1)^(2/3)*(x^2+2)^2)

(24)

f:=convert(f,RootOf): # replace (1+x^2)^(1/3) by a RootOf:

g:=int(f,x);

-(3/2)*RootOf(_Z^3-x^2-1, index = 1)/(x^2+2)+(3/2)*RootOf(_Z^3-x^2-1, index = 1)^2/(x^2+2)-(1/2)*ln((3*RootOf(_Z^3-x^2-1, index = 1)^2+x^2+3*RootOf(_Z^3-x^2-1, index = 1)+2)/(x^2+2))

(25)

evala(diff(g,x)-f); # check the answer:

0

(26)

Define a Maple operator using the unapply  command.

f:=unapply(x+y,x);

proc (x) options operator, arrow; x+y end proc

(27)

int(f,4..5);

9/2+y

(28)

Specify the 'AllSolutions' option.

int(1/x, x=a..2);

Warning, unable to determine if 0 is between a and 2; try to use assumptions or use the AllSolutions option

 

int(1/x, x = a .. 2)

(29)

r := int(1/x, x=a..2, 'AllSolutions');

r := piecewise(a < 0, undefined, a = 0, infinity, 0 < a, -ln(a)+ln(2))

(30)

r assuming a > 0;

-ln(a)+ln(2)

(31)

r assuming a < 0;

undefined

(32)

int(abs(sin(x)), x=0..2*Pi*m) assuming m::integer;

Warning, unable to determine if Pi*_Z14 is between 0 and 2*Pi*m3; try to use assumptions or use the AllSolutions option

 

int(abs(sin(x)), x = 0 .. 2*Pi*m)

(33)

int(abs(sin(x)), x=0..2*Pi*m, 'AllSolutions') assuming m::integer;

4*m

(34)

NULL

 

See Also

DEtools[integrate_sols]

diff

elliptic_int

evalf

evalf/Int

int

IntegrationTools

inttrans[fourier]

inttrans[laplace]

inttrans[mellin]

iscont

limit

series

symbolic order integration

unapply

VectorCalculus

VectorCalculus[int]

 

 

 

 

 


Download helpProb2.mw

but in all of the examples you have provided, there is a product o two differential terms. So in the following - of the two possible  "answers", which one do you consider to be correct

a:=diff(f(x,y),x)*diff(k(x,y),x);
IntegrationTools:-Parts(int(a, x), op(1,a));
IntegrationTools:-Parts(int(a, x), op(2,a));

 

First 110 111 112 113 114 115 116 Last Page 112 of 207