Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@9009134 Here it is:
 

Download GradPlot.mw

@janhardo The mathematical meaning of path integral is not completely standardized, especially in other languages. I think that to be completely clear, one must specify either scalar line integral or vector line integral.

And neither of these should be called a surface integral, which is an integral whose region of integration is a surface. The result of a scalar line integral can be interpreted as a difference of surface areas above and below the xy-plane, but that is not reflected in the integral's name.

The Wikipedia article "Line integral" has an excellent animation to illustrate this surface-area interpretation. 

@9009134 Just adding code is not enough. You must follow the steps that I specified, in the order that I specified:

1. Remove some lines.

2. Add some lines.

3. Re-execute the entire worksheet with the !!! button.

The error that you're seeing is due to aspects of the Physics[Vectors] subpackage still being active. The issue is not due to a bug in that package; rather, the package is simply inappropriate for this purpose.

 

What you want to do is possible.

But it's not possible that the code you show above, by itself, could produce the output that you show. Please provide the complete code that produced that output.

@David Sycamore Add the option

axis[2]= [mode= log]

inside the parentheses of the plotting command. I'm not sure if this will work in your version of Maple. Let me know.

Unfortunately, int(exp(a*t^b), t) ​​​​​​for explicit real constants a and returns in vastly different forms depending on a and b. Sometimes it returns WhittakerM functions, sometimes it returns incomplete GAMMA functions (which are much simpler), and sometimes it returns unevaluted (such as for a=1, b= Pi). Can it be taught to always return the GAMMAs?

@Carl Love I want to emphasize that I am not claiming that the vector-field plot above has any relevance to the physical problem described. It simply illustrates the steps that one must take to plot the gradient of a 2-variable function.

@ecterrab You wrote:

  • I am a non-native-English speaker...

But I suspect that you've lived primarily in the English-speaking world longer than nm has been alive, so it's not quite the same thing.

  • ...but I don't see what would be wrong with this use of "work as well" in this sentence of this help page.

There's nothing at all wrong with it if the intended audience is people fluent in spoken English. But the intended audience should be considered to include those whose primary exposure to English is written technical literature and technical online forums rather than speech. There are 2 or possibly 3 reasons why as well may not be the best choice for this broader audience:

  1. The phrase as well is idiomatic, which means that its meaning cannot be deduced from the meanings of its individual words. Indeed, in archaic usage it was a single word: aswell.
  2. It's primarily used in spoken English; in written English, it's usually replaced by also (if it means also).
  3. As used in the help page, it appears in the middle of its clause. That's a bit awkward; when it means also, it usually appears at the end of its clause (except possibly in Canada).
  4. (Doesn't apply to this example.) Its spoken usage is slightly different in Canada, where it may be used at the beginning of a sentence.

And by no means am I implying that you should've known any of this when you were writing that help page! I believe that editing such material for a technical, international audience can only be done by a professional technical editor.

Just for the record, the phrase in question is "works as well", not "work as well". However, all the points that I made above would apply to either phrase.

@Arif Ullah khan You wrote:

  • I face another issue here that when we choose a particular value for B, then for different values of infinity we get different solutions. It seems that infinity play a role of parameter here.

Yes, but I see that as the best thing about this algorithm. Since the equations are being numerically solved as IVPs rather than BVPs, it is trivial to simply keep extending the right boundary until the value of the second derivative  stabilizes (to within, say, epsilon = 0.5e-4 = 4 digits). This stable value is what the author calls C or C(B) (or with an overbar in the case of the 2nd equation). Finding a good value for the fake infinity is often the most challenging part of solving these boundary-layer BVPs.

So you need to get used to not using a fixed value for the fake infinity. The suitable value will depend on the parameters.This would be much more difficult to do with either a mesh-based BVP solver or a shooting method. 

 

@rlopez The worksheet's Startup Code contains

restart:
with(plots):
with(plottools):

To view the Startup Code, go to the Edit menu, and it's near the bottom of that menu.

The streams command does work to produce a plot from the 2-variable scalar function V. (I'm not claiming that this plot has any significance to the physical problem being considered. It's just a correct plot of a specific mathematical function.) The problem arose when trying to plot the gradient of V.

@9009134 Okay, you mean that you a vector-field plot of the gradient. That's doable.

To understand my last comment, you need to look at the code of procedure streams by expanding the Code Edit Region in the worksheet that you posted. Here it is:

streams:=proc(n,fcn,pts,name) 
       local f,k,DISK,p; 
       f:=transform((r,th) -> [r*cos(th),r*sin(th)]): 
       DISK:=disk([0,0],1,color=red); 
       for k from -n by 2 to n do 
             p[k]:=implicitplot(fcn=2*k/n,x=-n/2..n/2,y=-Pi..Pi,numpoints=pts): 
       od: 
       display(seq(f(p[2*i]), i=-n/2..n/2), DISK, view=[-n/2..n/2,-n/2..n/2], scaling=constrained, axes=boxed, title=name); 
end:

As you can see, it uses implicitplot​​​​​, which is not a command that can plot a vector field.

Here's how to plot the gradient. Take out (or comment out) the lines

with(Physics[Vectors]):
Setup(mathematicalnotation= true):

Use these lines:

dV:= VectorCalculus:-Gradient(V, [x,y]):
plots:-fieldplot(dV, x= -2..2, y= -2..2, fieldstrength= log[10]);

There are many options to control the appearance, size, and relative size of the arrows. See help page ?plots,fieldplot for details.

I don't know what you mean by "plot the gradient". Your is a function of two variables. Thus its gradient is a vector of two functions, each of two variables. What does it mean to plot such an object? In addition, the 2nd parameter of procedure streams is fcn. If fcn is passed a gradient--a vector--then what does fcn = 2*k/n mean?

@radaar Let me know if you need any help with those changes.

Still, I'd like to know what was your intention with the "three-level" stuff? There are higher-order analogs to Newton-Raphson that involve higher-order derivatives (thus they are difficult or impossible to apply to multivariate functions). These are called Householder methods, which you can look up in Wikipedia. Was that your intention? If they converge, they do so even faster (measured by iteration count) than Newton-Raphson, but they can become either numerically unstable or slow if those higher-order derivatives are excessively complicated.

The help page says "works as well", but I think that you misinterpretted that as "works well". In idiomatic English, those phrases mean very different things. Works as well means works also in this context. As well is an idiomatic expression with several meanings not related to the usual meaning of well.

To add to the confusion, if the phrase were works as well as <any noun phrase>, then the well would be meant in its usual sense. But if it were works as well as <any verb phrase grammatically parallel to "works">, then it would mean works and also <verb phrase>.

It would be helpful for the non-native-English audience if a professional editor removed such idioms from the help pages.

@itsme A lot of what you're asking for is already implemented in Code Edit Regions. Look for it on the Insert menu.

My wish for Code Edit Regions is quite simple: When they're executed, and there's a syntax error, I'd like the cursor to be placed somewhere near the error.

First 164 165 166 167 168 169 170 Last Page 166 of 708