Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@tira 

Okay, I read your PDF, which is simply a transcript of a Maple worksheet. (By the way, why couldn't you simply upload the Maple worksheet itself?) In it, you successfully use pdsolve(..., numeric) to solve a system of two PDEs. What do you mean by "not change the sign of my equations"? I don't see any sign change. In other words, I'd be better able to help you if you would provide an example of pdsolve NOT working for you.

All I need to execute your worksheet are the four values of Gr that you used, which you stored in L. Please supply those values.

And please try uploading that Maple worksheet.

I don't see any attached file. Also (and this may my personal preference), I hate Word files. Please find some other format. Maple would be best; it can be used as a document editor. It's not the best mathematical editor, but it's better than Word. You have Maple, right? Why else would you be posting your question here?

I also find that Ctrl-Del deletes anything in a worksheet easily. No selecting needed; no mouse motion needed. If it doesn't work for you, check if your NumLock is superceding your Del. This is what I use for 99% of my deleting. I just keep the keys held down for a large block delete.

To get a high-precision integral, use the third technique from my Answer, the one where the integrals are computed by dsolve, and set the abserr option to dsolve. If your Digits is not large enough, then dsolve will return an error with a suggested value of Digits.

restart:
Digits:= 20:
So:= dsolve([
     -1.2*diff(y(x), x$2)+0.8*y(x) = 2, y(0)=1, y(1)=0,

     diff(u(x),x) = y(x), u(0)=0,
     # So u(x) = int(y(t), t= 0..x).

     diff(u2(x),x) = y(x)^2, u2(0)=0
     # So u2(x) = int(y(t)^2, t= 0..x).

     ], [y(x), u(x), u2(x)],
     'numeric', 'output' = listprocedure, abserr= 1e-20
):

Error, (in dsolve/numeric/BVPSolve) precision is insufficient for required absolute error, suggest increasing Digits to approximately 23 for this problem

So, I set Digits:= 23 and redid the exact same dsolve command, which returned without error. Then,

So(1);

@Konstantin@ 

It can't be simpler to write your own numerical integration procedure!

We need to get to the bottom of why this isn't working for you. I just tried in Maple 18.02, and all three solutions work fine for me (with Digits <= 15). Have you tried the third technique that I posted, the one where dsolve does all the work?

What is your setting of Digits? I've noticed that if I set Digits to 20, then I have the same problem that you are having: The integral for the square returns unevaluated. This is understandable: You should not be able to get the answer to a higher precision than the precision of dsolve's numeric procedure (which is, in general, lower than the Digits setting). So use that third technique that I posted, which is numerically robust. Or add the epsilon argument to the integral to reduce the precision:

evalf(Int(u^2, 0..1, epsilon= 1e-10));

 

I just added a third, completely different, solution technique to my Answer above. It has often been argued here at MaplePrimes that this is the most numerically robust technique.

@Konstantin@ 

Hmm. It worked for me, although I did not show my output in my Answer. What version of Maple are you using? I used Maple 16. I will test in Maple 18 now.

I just added an additional, alternative solution to my Answer. Does that one work for you?

You can use TypeTools:-GetTypes() to see which types are loaded.

@Markiyan Hirnyk 

My guess is that the simplification is easier to obtain when it is rational. Compare

e:= sqrt(sqrt(a)-sqrt(b))*sqrt(sqrt(a)+sqrt(b)):
e1:= eval(e, [a=26, b=10]):
evala(e1);

and

e2:= eval(e, [a=16, b=6]):
evala(e2);

@jonlg 

You need to take the transpose of the Array before passing it to LeastSquares. But note that LeastSquares will work with the listlist form; you do not need an Array.

A:= [1,2,3]: #lists
B:= [4,5,6]:
C:= zip(`[]`, A, B): #listlist form
CurveFitting:-LeastSquares(C, y);

C:= <Array(A),Array(B)>:
CurveFitting:-LeastSquares(C, y);

Error, (in CurveFitting:-LeastSquares) data points not in recognizable format


CurveFitting:-LeastSquares(C^%T, y);  #C^%T is the transpose of C.

But if you use columns Vectors instead of Arrays it's different:

A:= <1,2,3>:  B:= <4,5,6>: #Column vectors.
C:= <A|B>: #Note: <A|B>, not <A,B>
CurveFitting:-LeastSquares(C, y);

It's subleties like these that lead me to advise you again: First master the use of lists; then we'll discuss Arrays when your need arises.

 

@Markiyan Hirnyk 

The result of

a := Array([1, 2, 3]):
b := Array([4, 5, 6]):
zip(`[]`, a, b);

is an Array of lists. That is, it is one-dimensional Array each element of which is a two-element list. So, yes, the zip command works in this case, but probably not in a way that a new user would find useful. To combine two one-dimensional Arrays into a two-dimensional Array, use angle brackets:

c:= <a,b>;

@jonlg 

Perhaps the reason that it is coded as exp(x) rather than e^x is so that the procedure can be written using Maple-level code. See

showstat(exp);

If you really prefer e^x, then you can do

e:= exp(1):

and then proceed to use e^x. AFAIK, the notation exp(x) is used in most computer languages.

@jonlg 

Lists and Arrays are different entities in Maple. You may be confusing the two. In the following code, A, B, and C are all lists (and C is a special type of list called a listlist).

A:= [1,2,3]:
B:= [4,5,6]:
C:= zip(`[]`, A, B);

First, master the use of lists, then we can discuss Arrays when your need for them arises.

@Kitonum 

The plots for this PDE system produced using the default option settings to pdsolve are completely erroneous. There are two ways that I can tell:

1. The plots for Th, Tw, and Tc are identical.

2. When you change the timestep or spacestep options, the plots are completely different.

The system might benefit from rescaling, for example, replacing Tw with TW= 1e6*Tw.

I can write you a routine that will separate the last term from all sums and Sums in an expression. Would that satisfy your need? Or do you need it to be specific to sums and Sums that end with an n+1 term? And, if so, do you need it to apply only when the final term is specifically with the variable n, or would you like it to apply to m+1, etc.?

First 515 516 517 518 519 520 521 Last Page 517 of 709