Carl Love

Carl Love

27187 Reputation

25 Badges

11 years, 341 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

I got 5/4*5^(m+1)/m, but that is asymptotically equivalent to your result (since the limit at infinity of their ratios is 1). I did it by integrating, getting the series for that, and then applying a correction factor.

restart;

interface(typesetting= standard): interface(prettyprint= 3):

Order:= 2:

assume(m > 0);

s:= j-> 5^j/j:

Verify that getting the asypmtotic series the normal way won't work.

S1:= sum(s(j), j= 1..m+1);

-2*ln(2)-I*Pi-25*5^m*((1/25)*LerchPhi(5, 1, m)-(1/25)/m-(1/5)/(m+1))

asympt(S1, m);

Error, (in asympt) unable to compute series

The summand s(j) is increasing for j > 1. Imagine approximating the integral of s(j) with rectangles under the curve. Then the sum S1 would represent the integral on 1..m+2. Likewise, the integral can approximate the sum.

int(s(j), j= 1..m+2);

Ei(1, -ln(5))-Ei(1, -m*ln(5)-2*ln(5))

asympt(%, m);

(25/(ln(5)*m)+O(1/m^2))*5^m

A1:= op(1,expand(%));

25*5^m/(ln(5)*m)

Estimate the error factor: that is, the factor by which the integral over the last rectangle overestimates that rectangle.

int(s(x)/s(m+1), x= m+1..m+2);

-5^(-1-m)*(m+1)*(-Ei(1, -m*ln(5)-ln(5))+Ei(1, -m*ln(5)-2*ln(5)))

asympt(%,m);

4/ln(5)+O(1/m)

Since this is asymptotic to O(1), we are justified in applying a constant correction factor A1. So, the final first term of the asymptotic series for S1 is

A:= A1/op(1,%);

(25/4)*5^m/m

Verify with a plot.

plot(S1/A, m= 30..1000);

 

Download asympt_sum_by_int.mw

First, I'll create Z and its CDF again. (CDF stands for Cumulative Distribution Function, if that helps.) But, you only need to do this once per session. This Z is the same N(0,1) as in your first problem.

Z:= Statistics:-Distribution(Normal(0,1)):

And I'll also define Φ for convenience (less to type):

Phi:= evalf@Z:-CDF:

You can use the above for all your "Z" problems.

Now, to the problem at hand. First some identities that I hope that you already know. If you don't know these, find them in your textbook and memorize them.

  1. For any random variable (r.v.) Z and any real z ≥ 0, P(|Z| > z) = P(Z > z) + P(Z < -z).
  2. For any continuous r.v. Z and any z, P(Z ≥ z) = P(Z > z), (i.e. isolated points don't matter).
  3. For any continuous r.v. Z and any z, P(Z > z) = 1 - P(Z < z).
  4. For Z ~ N(0,1) and any z, P(Z > z) = P(Z < -z) (symmetry).

Putting those together, the answer to your problem is

2*(1 - Phi(1.39));

The factor of 2 comes from applying rule 1, then rule 4. The "1 minus" comes from rule 3.

Try this for the function definition:

w:= (xi, eta, dxi, deta)-> value;

A function must be defined with pure names for the parameters. When you call the function w, then you can pass it whatever as arguments:

w(xi(t), eta(t), diff(xi(t), t), diff(eta(t), t));

 

Variable x has been assigned a value already, probably in your previous problem. One solution is to use a different variable in the integral. You could replace the three occurences of x with chi, X, or xi (or any other unused variable name).

Has Psi been assigned a value by your instructor? If it hasn't, then it's also a bad choice of name because Psi is a predefined function in Maple. It would be better to use psi instead.

I can't help you with the palettes, but if you're willing to type your commands then do

Z:= Statistics:-Distribution(Normal(0,1));
Z:-CDF(.87) - Z:-CDF(0);
evalf(%);

The following answers apply to the transcendental RootOf. The situation for the polynomial RootOf is slightly different.

Q1)  How can I evaluate the RootOf?

You can substitute values for the variables and apply commands to it just as you can with any other expression. Just don't substitute for the "with respect to" variable (the _Z). That wouldn't make sense, just like substituting a nonatomic expression for x in int(f(x), x) or solve(f(x), x) wouldn't make sense.

Q2) In other words, What is it saying?

A ?RootOf is Maple's way of expressing an inverse function (usually with multiple branches) for which it otherwise has no expression. Another way of thinking about it is that it's Maple's way of expressing an implicitly defined function (usually one with multiple branches).

Q3) Is there any way that I can get an expression without RootOf for the variable that I am solving for?

For an exact symbolic solution, generally, no, not unless you are aware of some solving technique which Maple is not using. A floating-point solution is usually possible if you supply numeric values to the parameters. In either case, you can try to apply the command ?allvalues. That is the command specifically designed for expressions containing RootOf. Especially, try to reduce the RootOf expression with allvalues if you have assigned numeric values to some of the parameters. If you've applied assumptions to some of the parameters, then try simplify.

Q4) Is there any way that I can get an analytical expression for the variable that I am solving for?

I am guessing that what you really meant by this question is what I answered in Q3 above. But I separated out this question so that I coud point out that an expression with RootOf is an analytic expression. You can generally apply to it all the Maple commands that you would apply to any other analytic expression, including diff, series, simplify.

Q5)  Or from here we can only get numerical means to solve for the variable. If so, how to proceed?

Use ?eval to supply numeric values to the parameters, then apply allvalues. At this point, you may need to select a branch. Then apply evalf. There are cases where not all branches will satisfy the original equation, so plug back into the original to check.

First, you have a small error. It has no effect for this current question, but you should fix it. The command restart must be in lowercase letters.

You could apply a DataTable to this situation, as in your previous question. But I'll show you another way. Define q[1] with a variable as one of the numeric components, and still include the units. For example, I replaced the numerator 14.6 with a variable Luftmængde. Then execute the rest of the commands. Some of them will have symbolic answers expressed in terms of Luftmængde, but the units will carry through. After the end, you can use the command

eval(P[dyn1], Luftmængde= 14.6);

Of course, you'll be able to use any number that you want.

There are many other ways to do what you want, and if the above is not satisfactory, then I can show you another.

You may have an older version of Maple. There have been some recent improvements in RealDomain. You may be able to solve your equation without using RealDomain if you first convert  it to surd form.

restart;

kernelopts(version);

`Maple 16.02, X86 64 WINDOWS, Nov 18 2012, Build ID 788210`

expr:= convert((2*x-x*sqrt(x)-1)^(1/3)+sqrt(x)+(1-2*x)^(1/3), surd);

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

solve(expr = 0, x);

0, 1, 1/2, (1/4)*(5^(1/2)+1)^2


Download surd_solve.mw

Go back to your question from one month ago, "how many routes in a 6x6 square?" Careully study the lengthy answers to that. I covered there many of the questions that are posed here, including

  1. how to represent the vertices as pairs of integers
  2. how to label the vertices with convenient two-character letter-number combinations while maintaining the underlying integer-pair representation
  3. how to create the graph in GraphTheory using the simple criterion that vertices u and v are adjacent iff LinearAlgebra:-Norm( < u - v > ) = 1
  4. how to use GraphTheory:-Departures to construct paths (words) in the graph
  5. how to plot the board and the paths (words).

It would be much quicker to start with the above base, which is already coded in the post, than to work from the Mathematica. The project is already half done. It would be nice to know that my prior work on it was not for naught.

What needs doing?

  1. Setting the distribution of letters. Counting the letters in a real Boggle game would help for this.
  2. Assigning the letters to the vertices.
  3. Dictionary lookups.
  4. Scoring. Having the actual game would help with this.
  5. Adding the letters to the plot.

Place your cursor in your worksheet in the spot that you want the table. Then from the Insert menu, select Spreadsheet. When you want to update the spreadsheet, right click in it and select Evaluate All. For programmatic access to spreadsheets, see ?Spread.

Before answering your main question, I want to point out that angles need to be in radians in Maple. You can enter them in degrees and then convert to radians, like this

Angles:= [30, 60, 90];
Angles:= Angles *~ Pi/180:

or

Angles:= map(convert, Angles *~ degrees, radians):

Second, in my previous post, I said that you'd probably want to use more than 4 digits in actual practice, but you kept it at 4. You should change all occurences of evalf[4] to evalf[15] or simply evalf (for reasons that I won't go into here, 15 digits usually gives the optimal balance of speed and accuracy).

Third, you should probably use different names for the two Constructor procedures: the one that constructs the Ts and the one that constructs the Ths.

Now for your main questions. You have two lists of eight matrices each, Ts and Ths, and a single matrix Q, and you want to compute a list of matrices Qb such that Qb[k] = Ts[k]^(-1).Q.Ths[k] for k from 1 to 8. Here are two ways do that:

Qb:= [seq](Ts[k]^(-1).Q.Ths[k], k= 1..8):

or

Qb:= zip((X,Y)-> X^(-1).Q.Y, Ts, Ths):

Finally, you want to construct a 6x6 matrix from 3x3 matrices A, B, and D, with pattern

A B
B D.

The command for this is

M:= < < A | B > , < B | D > >:

Let me know if that is all clear to you!

Sorry that I didn't see this earlier. This system is very bad at notifying authors when there are responses to their answers.

So, I promised to help you again if you found two of the five errors. You found four, and correctly fixed three. The one that you incorrectly fixed is the definition of h. It should be

h:= (b-a)/2/n;   (or, equivalently, h:= (b-a)/(2*n);.)

The last error is that subtle one. It's another fencepost error. What is the sequence of coefficients of the evaluation points? If n = 2, then the coefficients are

1, 4, 2, 4, 1

and if n = 3, then the coefficients are

1, 4, 2, 4, 2, 4, 1.

Do you agree? So, there is always one more 4 than there are 2s. But your loop does the 4s and 2s in pairs so there are always the same number of them. You are missing the last 4. It occurs at x = b - h. So, your initialization of aa should be

aa:= f(a)+4*f(b-h)+f(b);

 

You should first test your procedures against Student:-Calculus1:-ApproximateInt (like I described in the previous post) before checking for convergence.

I came up with two ways to evaluate the the integral of Ei in this problem: an Ei identity and integration by parts. The identity is Ei(1,x) = -Ei(-x).

restart;

DQ:= -((D@@2)(y))(r)-2*y(r)/r+y(r) = ((4/9-exp(-r)/r)*2)*r*exp(-r):

Y:= rhs(dsolve(DQ, y(r)));

exp(-r)*r*_C2+(2*exp(-r)*Ei(1, -2*r)*r+exp(r))*_C1-(8/9)*((1/4)*(Int((2*Ei(1, -2*r)*r+exp(2*r))*(4*r*exp(r)-9)*exp(-3*r), r))*r*exp(3*r)+((r+1/2+r^2)*exp(r)-1/2-(3/2)*r)*r*Ei(1, -2*r)+((1/2)*r^2+(1/2)*r+1/4)*exp(3*r)-(3/4)*exp(2*r)*(r+1/3))*exp(-4*r)

subs(Ei(1,-2*r)= -Ei(2*r), %);

exp(-r)*r*_C2+(-2*exp(-r)*Ei(2*r)*r+exp(r))*_C1-(8/9)*((1/4)*(Int((-2*Ei(2*r)*r+exp(2*r))*(4*r*exp(r)-9)*exp(-3*r), r))*r*exp(3*r)-((r+1/2+r^2)*exp(r)-1/2-(3/2)*r)*r*Ei(2*r)+((1/2)*r^2+(1/2)*r+1/4)*exp(3*r)-(3/4)*exp(2*r)*(r+1/3))*exp(-4*r)

value(%);

exp(-r)*r*_C2+(-2*exp(-r)*Ei(2*r)*r+exp(r))*_C1-(8/9)*((1/4)*(3*exp(-r)+(1/2)*Ei(2*r)*(8*r^2*exp(-2*r)+8*r*exp(-2*r)+4*exp(-2*r)-12*r*exp(-3*r)-4*exp(-3*r))-4*r-2*ln(2*r)-2*Ei(1, r))*r*exp(3*r)-((r+1/2+r^2)*exp(r)-1/2-(3/2)*r)*r*Ei(2*r)+((1/2)*r^2+(1/2)*r+1/4)*exp(3*r)-(3/4)*exp(2*r)*(r+1/3))*exp(-4*r)

simplify(%);

exp(-r)*r*_C2-2*exp(-r)*Ei(2*r)*_C1*r+exp(r)*_C1+(4/9)*exp(-r)*ln(r)*r+(4/9)*exp(-r)*ln(2)*r+(4/9)*exp(-r)*Ei(1, r)*r+(4/9)*r^2*exp(-r)-(4/9)*exp(-r)*r-(2/9)*exp(-r)+(2/9)*exp(-2*r)

YY:= %:

Verify that it satifies the original equation.

eval((rhs-lhs)(DQ), [(D@@2)(y)(r)= diff(YY,r$2), y(r)= YY]);

2*(4/9-exp(-r)/r)*r*exp(-r)+(4/9)*exp(-r)/r+(8/9)*exp(-r)-(4/9)*(exp(-r))^2/r+2*(exp(-r)*r*_C2-2*exp(-r)*Ei(2*r)*_C1*r+exp(r)*_C1+(4/9)*exp(-r)*ln(r)*r+(4/9)*exp(-r)*ln(2)*r+(4/9)*exp(-r)*Ei(1, r)*r+(4/9)*r^2*exp(-r)-(4/9)*exp(-r)*r-(2/9)*exp(-r)+(2/9)*exp(-2*r))/r-2*exp(-r)*_C2-(8/9)*exp(-r)*ln(r)-(8/9)*exp(-r)*ln(2)-(8/9)*exp(-r)*Ei(1, r)+4*exp(-r)*Ei(2*r)*_C1-2*exp(-r)*exp(2*r)*_C1/r+(2/3)*exp(-2*r)+(4/3)*(exp(-r))^2-(16/9)*exp(-r)*r

simplify(%);

0

The identity is not valid everywhere. We can do it without the identity by using integration by parts.

 

Extract the unevaluated integral:

J:= indets(Y, Int(algebraic$2))[];

Int((2*Ei(1, -2*r)*r+exp(2*r))*(4*r*exp(r)-9)*exp(-3*r), r)

with(IntegrationTools):

simplify(Expand(expand(J)));

8*(Int(exp(-2*r)*Ei(1, -2*r)*r^2, r))-18*(Int(exp(-3*r)*Ei(1, -2*r)*r, r))+4*(Int(r, r))-9*(Int(exp(-r), r))

JJ:= value(%);

8*(int(exp(-2*r)*Ei(1, -2*r)*r^2, r))-18*(int(exp(-3*r)*Ei(1, -2*r)*r, r))+2*r^2+9*exp(-r)

jj:= Parts(JJ, Ei(1,-2*r), applytoall);

-2*(2*r^2+2*r+1)*exp(-2*r)*Ei(1, -2*r)-4*r-2*ln(r)+2*(3*r+1)*exp(-3*r)*Ei(1, -2*r)-6/exp(r)-2*Ei(1, r)+9*exp(-r)

YY:= simplify(eval(Y, J= jj));

exp(-r)*r*_C2+2*exp(-r)*Ei(1, -2*r)*_C1*r+exp(r)*_C1+(4/9)*exp(-r)*ln(r)*r+(4/9)*exp(-r)*Ei(1, r)*r+(4/9)*r^2*exp(-r)-(4/9)*exp(-r)*r-(2/9)*exp(-r)+(2/9)*exp(-2*r)

Verify that it satifies the original equation.

eval((rhs-lhs)(DQ), [(D@@2)(y)(r)= diff(YY, r$2), y(r)= YY]);

2*(4/9-exp(-r)/r)*r*exp(-r)+(4/9)*exp(-r)/r+(8/9)*exp(-r)-(4/9)*(exp(-r))^2/r-2*exp(-r)*_C2-(8/9)*exp(-r)*ln(r)-(8/9)*exp(-r)*Ei(1, r)+2*(exp(-r)*r*_C2+2*exp(-r)*Ei(1, -2*r)*_C1*r+exp(r)*_C1+(4/9)*exp(-r)*ln(r)*r+(4/9)*exp(-r)*Ei(1, r)*r+(4/9)*r^2*exp(-r)-(4/9)*exp(-r)*r-(2/9)*exp(-r)+(2/9)*exp(-2*r))/r-2*exp(-r)*exp(2*r)*_C1/r-4*exp(-r)*Ei(1, -2*r)*_C1+(2/3)*exp(-2*r)+(4/3)*(exp(-r))^2-(16/9)*exp(-r)*r

simplify(%);

0

 


Download Ei_Integration.mw

Check out command ?RootFinding,Analytic.

Here's an example. Here I use 2x2 matrices to save space. I'm sure that you'll be capable to generalize this. The essence is the use of unapply to turn one matrix with a parameter into a constructor for other matrices. (The ?unapply command is much more general than just being used for matrices.)

restart;

Make a Matrix that depends on a unspecified angle:

M:= < < cos(theta),sin(theta) > | < -sin(theta),cos(theta) > >;

M := Matrix(2, 2, {(1, 1) = cos(theta), (1, 2) = -sin(theta), (2, 1) = sin(theta), (2, 2) = cos(theta)})

Make that Matrix into a procedure that constructs more Matrices:

Constructor:= unapply(M, theta):

Make a list (not a vector) of 8 angles:

Angles:= [seq](Pi*k/4, k= 0..7);

[0, (1/4)*Pi, (1/2)*Pi, (3/4)*Pi, Pi, (5/4)*Pi, (3/2)*Pi, (7/4)*Pi]

Apply the Conctructor to the list of angles to create a list of Matrices:

Mlist:= Constructor ~ (Angles);

Mlist := [Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1}), Matrix(2, 2, {(1, 1) = (1/2)*sqrt(2), (1, 2) = -(1/2)*sqrt(2), (2, 1) = (1/2)*sqrt(2), (2, 2) = (1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = 0, (1, 2) = -1, (2, 1) = 1, (2, 2) = 0}), Matrix(2, 2, {(1, 1) = -(1/2)*sqrt(2), (1, 2) = -(1/2)*sqrt(2), (2, 1) = (1/2)*sqrt(2), (2, 2) = -(1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = -1, (1, 2) = 0, (2, 1) = 0, (2, 2) = -1}), Matrix(2, 2, {(1, 1) = -(1/2)*sqrt(2), (1, 2) = (1/2)*sqrt(2), (2, 1) = -(1/2)*sqrt(2), (2, 2) = -(1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = 0, (1, 2) = 1, (2, 1) = -1, (2, 2) = 0}), Matrix(2, 2, {(1, 1) = (1/2)*sqrt(2), (1, 2) = (1/2)*sqrt(2), (2, 1) = -(1/2)*sqrt(2), (2, 2) = (1/2)*sqrt(2)})]

(Optional) Evaluate to floating point (in actual usage, you'd probably want more than 4 digits).

Mlist:= evalf[4](Mlist);

Mlist := [Matrix(2, 2, {(1, 1) = 1., (1, 2) = 0., (2, 1) = 0., (2, 2) = 1.}), Matrix(2, 2, {(1, 1) = .7070, (1, 2) = -.7070, (2, 1) = .7070, (2, 2) = .7070}), Matrix(2, 2, {(1, 1) = 0., (1, 2) = -1., (2, 1) = 1., (2, 2) = 0.}), Matrix(2, 2, {(1, 1) = -.7070, (1, 2) = -.7070, (2, 1) = .7070, (2, 2) = -.7070}), Matrix(2, 2, {(1, 1) = -1., (1, 2) = 0., (2, 1) = 0., (2, 2) = -1.}), Matrix(2, 2, {(1, 1) = -.7070, (1, 2) = .7070, (2, 1) = -.7070, (2, 2) = -.7070}), Matrix(2, 2, {(1, 1) = 0., (1, 2) = 1., (2, 1) = -1., (2, 2) = 0.}), Matrix(2, 2, {(1, 1) = .7070, (1, 2) = .7070, (2, 1) = -.7070, (2, 2) = .7070})]

Individual Matrices in the list are specified by index, 1 to 8.

Mlist[4];

Matrix(2, 2, {(1, 1) = -.7070, (1, 2) = -.7070, (2, 1) = .7070, (2, 2) = -.7070})

 

Download Matrix_function.mw

First 377 378 379 380 381 382 383 Last Page 379 of 389