Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 362 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@85951971 

If you want to select the model based on the lowest residuals, it is possible to do that automatically, but not necesarily advisable. It is very tricky with nonlinear models: There are often parameter choices that give a local minimum for the residuals which are far from being a global minimum. Maple's Statistics:-NonlinearFit (and all nonlinear parameter fitting software that I am aware of) very often returns one of these local minima.

Take a close look at Markiyan's answer. The program that he used is called DirectSearch:-DataFit (the DirectSearch package must be downloaded from the Maple Applications Center). His correct piecewise interpretation of the spherical model gives a good fit. Notice the first number in the output of DataFit. That is the total residual. From all the fitmethod choices offered by DataFit, Markiyan hand selected the one with the smallest first number. It would be easy to automate that.

Markiyan (who is from Ukraine) has an excellent knowledge of English. If you write in correct English with correct spelling and punctuation and without hipster slang he will understand you.

@Rouben Rostamian  

Thanks Rouben. It's very impressive.

@Preben Alsholm 

If I simply differentiate eq2 and use a DAE method, then I get the same solution as your "Alternative solution". It would seem like the loss of information caused by differentiating the constant would make this method not work, and yet the differences between the two numerical solutions are insignificant (on the order of 10^(-8)).

I simply used

solution2:= dsolve([diff(eq1, t), eq2, CI], numeric, method= rkf45_dae);

Do you have any idea why this works?

@MDD In other words, the list of monomials needs to be generated automatically, and needs to be in the correct order.

@acer I updated the Answer. I can find no significant difference in the times when hits are unlikely, and, yes, there are other factors to consider that my timing test does not address. I understand and appreciate your argument based on clear coding style.

In the more likely case that hits are likely, I found that the assigned method is significantly faster.

@Markiyan Hirnyk 

Yes, it is not necessary to assign the plot to a variable and then display it. Simply using the odeplot command, without assignment, is enough.

@Wolff 

The dialog box can be manually moved to reveal the whole plot. But that's a pain to do every time.

Here's a completely different idea: Put the plots in an animation, and step through them in single-frame mode, like a slideshow:

Test:= proc(j)
local x;
     plot(x^j, x= -2..2)
end proc:

plots:-display([seq(Test(k), k= 1..3)], insequence);

@digerdiga If you want to apply D to the identity function, use D(x->x)(x) or D(x->x). Both will return simply 1.

Consider the analogy: If D(f)(x) = diff(f(x),x) then D(x)(x) = diff(x(x), x). The subexpression x(x) doesn't have any mathematical meaning that I am aware of.

@Glowing 

Stopping Maple is a complicated topic which probably deserves its own thread. Always try the red stop button first. It does work in many/most cases. If that doesn't work, then you'll need to use a task manager (such as Windows Task Manager or "top" on Linux) to find out what process is actively running and explicitly kill it. Killing a kernel (mserver) is relatively painless---you can still save your worksheet and make a full recovery. Killing the GUI is painful. All your worksheets will be killed and they can only be recovered up to their last autosave. 

@Wolff 

What do you mean by "there is no simple possibility to have a break in a loop"? Isn't that what my first code provides?

@acer The dialog box pops up near the center of the main window. If the last output was a plot, it will likely be obscured by the dialog box. A workaround is to send the plots to plot windows:

Test:= proc(j)
local x;
     plot(x^j, x= -2..2)
end proc:

plotsetup(window);
for j to 3 do
     print(Test(j));
     print(`Press RETURN to continue.`);
     readline(-1);
end do:
plotsetup(default);

@Alejandro Jakubi 

In Standard, I find no way to read from the keyboard without a dialog box, which I hate. For one thing, the box often obscures the output. Do you know a way to do it? It may be iolib(n, ...for some integer n.

@acer 

Using Maple 18, the plotsetup command is not working for me. The plot still goes to the screen, and the file is never created; nor is there any error message about not being able to create the file. I even tried putting a Threads:-Sleep(2) on each side of the plotsetup. Do you have any idea what's going wrong?

Update: Problem solved! I needed to put the restart in a separate execution group. This shows that the help file ?restart is not quite correct. It says (in the eighth paragraph of Description) that the restart should be on a separate line. Actually, it needs to be in a separate execution group. I've long suspected this, and now there's proof.

The Threads:-Sleep after the plotsetup is also necessary.

There's no way to do that with the text treated simply as plaintext. But if the text (or any other image) were in a JPEG file, then it'd be possible.

Update: As Acer shows below, getting the text into a file in a graphics format is pretty easy.

For what it's worth, I've reduced the task to some simpler-looking expressions and generalized the integral. Let

H:= hypergeom([m,-m], [m+1], 1/2);
G:= 2^(-1-m)*(sqrt(Pi)*GAMMA(m)*m/GAMMA(m+1/2) + 1);
J:= Int(abs(x-(1-x^n)^(1/n)), x= 0..1);

I've proved that if H = G for m > 0, then J = 1/2 for n > 0. Graphical/numerical evidence strongly supports the equalities.

First 485 486 487 488 489 490 491 Last Page 487 of 709