Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@David Sycamore Now you're confusing me because you're making the problem sound completely different than in your original Question. So, do you or do you not currently have a file (independent of Maple) containing some numbers that you want to do computations with in Maple?

From the rest of your description of the problem, I'd think that you could easily generate all the data within Maple itself, unless these are some very special and/or very large primes.

@nm It's okay; I already anticipated your followup question, and I was typing up an answer anyway. Declare a local in the parent like this:

local parentfoo:= foo;

It doesn't matter whether this is before or after the definition of procedure foo. Then instead of invoking parent_module:-foo in the child, you invoke parentfoo.

@jamesson You've asked some good questions.

Regarding integral nomenclature, specifically path vs. line: According to the Wikipedia article "Line integral", the two names are used interchangably! I guess that you're a student in a third-semester calculus course. If that is true, I recommend that you not yet try to read that article past the first paragraph as it may lead to some confusion in your coursework. It's far from being the most well-written Wikipedia article on a calculus topic, although I have no specific quibble with its accuracy.

I can't keep the two straight myself: "path", "line", not much difference in the words, right? And even a line integral isn't necessarily over a straight line. The important distinction is the number of dimensions of output of the integrand. In what Maple calls a path integral, it's one dimension; and for a line integral, it's more than one[1]. Your correct integrand  (as clearly shown in Larson's problem) is x*y---a function that takes as input 2 real numbers and outputs 1 real number. Your proposed integrand, <x,y> (which would be xi + yj in Larson's notation, which is standard), takes as input 2 real numbers and outputs 2 real numbers. The syntax checkers in PathInt and LineInt will not let you use an integrand of the wrong dimensionality, so there's not a strong need to remember which is which.

Regarding the issue of prepending Student:-: I meant that the syntax is identical for the specific command that I gave. The Student versions of commands often allow for additional syntax; for example, output= integral only works in the Student versions of the integration commands.

[1] Functions which output more than one dimension are called "vector" functions, or, more precisely vector-valued functions. Functions which take more than one dimension of input are called multivariate.

@rahinui I believe that it is expected behavior that Maple will order the terms of an algebraic expression in whatever way it sees fit. Furthermore, I'm certain that it will not allow you to maintain two separate algebraic expressions that are identical except for the order of the terms. It will store only one version, one order, in memory.

Sets are handled differently. A long time ago, the order that elements appeared in sets was based on memory addresses and hence was session dependent. Now, the user still has no control over the order of sets1, but that order won't change from session to session. However, it may change if you upgrade to a new version of Maple.

[1] For the purpose of rigorous testing of code, it is possible to change the set-ordering rule through a command-line option. See ?maple for details.

@pppc Here's an example of forcing the value of a constant. I have a simple BVP:

ODEs:= diff(y(x),x$2) - C*y(x) = 0:
BCs:= y(0) = 0, y(1) = 0, D(y)(1) = 1:

The differential order is 2, and there's 1 arbitrary constant, C. That means that the numeric BVP solver will require there to be exactly 3 BCs (2+1 = 3). As you can see above, I do have 3 BCs. Pass it to the solver:

Sol:= dsolve({ODEs, BCs}, numeric):
Sol(0);

      [x = 0., y(x) = 0., diff(y(x), x) = -1.00000000000000, C = -9.86960442538029]

So, the solver is telling me that the value of C must be -9.8696.... In other words, it's forcing the value of C to be a specific value.

 

@pppc What is wrong is that you went from 5 BCs to 6. You can't simply add BCs without giving up something in return.

@pppc You say that you "changed the boundary condition to a more complex one". What I see in your worksheet is that you not only changed them, you reduced them to 4. There must be 5, and that is the reason for the error message. The numeric solver will accept quite complex BCs as long as you stick to two boundary points. The way that I've coded it now (which was done very quickly), that must be exactly 5 BCs. Since no w(x) without a derivative appears in the system, it's possible (with some modification to the coding) to give up one BC and solve the system for diff(w(x),x) instead w(x).

Since you have 5 arbitrary constants already, it's also possible to add up to 5 more BCs, but for each one added, the numeric solver will solve for and tell you the value of one of your constants. That would also require some modification of the coding.

Maple does have a fully symbolic implementation of piecewise functions. The command is piecewise (see ?piecewise). For example,

forcingfunc= piecewise(x < 1/3, 0, x < 2/3, 3*x-1, x < 1, 1)

That one is continuous. The numeric solver will let you enter a discontinuous one also, but whether it'll be able to use it without erroring out, I don't know.

@pppc The differential order of the system of ODEs is 5 (order 3 in w(x) + order 2 in u(x)). So, solving the system for w(x) and u(x) without introducing extra constants requires 5 boundary conditions (BCs). If you want to use 6 BCs, you can force the value of one of the 5 constants that you already have.

@acer Thank you. Of course it's okay. Your input, Acer, is always more than welcome. And, in this case, the continuous= false is something that I needed to know about.

@pppc The x is what we call the independent variable---the variable with respect to which derivatives are taken. It's range is necessarily1 constrained by the boundary points given in the problem specification. From the code in your Question, that would be 0..100.

The dependent variables are w and u--the unknown functions of the independent variable. They're the ones for which I'd like to know a very rough estimate of the maximum magnitude. Even better: The overall maximum of those functions and all of their derivatives used in the system. Just a single number covering all is needed.

As it has been posed, the system is solvable for diff(w(x), x) but not w(x) itself. To solve for w(x), I need one more initial condition. If you don't know, then we might as well make it w(0) = 0.

[1] We can extend the solution past the boundary points by starting an IVP solver at either boundary once the BVP solver gives us sufficient initial conditions.

@pppc Oh, the numbers are big. In that case, it'd also help if you told me a very rough estimate for the maximum magnitude of the dependent variables. Not taking this into account is one of those pitfalls that I was talking about.

I'm by no means an expert on the theoretical nature of BVPs. And that leaves me wondering, considering the high differential order of this system, Is it possible that there are multiple solutions? Is it possible for there to be complex solutions between the given boundary points? This would be a good time for an expert to speak up.

@ivanfanthony Yes, it's easy. But now I need one more parameter: an upper limit for t. Sure, it can go to infinity, but just for plotting, I need an upper limit. You'll still be able to exceed that limit on a numerical evaluation.

@pppc The command that puts sliders on the screen is Explore. See ?Explore. It's an amazing command; perhaps the best addition to Maple in years.

To start to learn how to solve BVPs numerically, look at ?dsolve,numeric and ?dsolve,numeric,BVP. There are many, many pitfalls during solving BVPs numerically. I think that this case will require expert help, like me (and there are a few other numeric BVP experts here on MaplePrimes). But I think that I could write a very basic Explore for this case in 2 minutes. I'll be able to do it later today. It'll not be possible to change Q(x) on the fly; that'll require manual input. In the meantime, it'd help if you'd specify acceptable ranges for the C__s.

@ivanfanthony It's no disturbance. I'm always happy to consider any question about my code.

The second argument of both Sum commands is l= 0..k, so all sums are starting at 0 and going to k (not k+1). However, there is no sum that is just Ss, as you pose above; there is nothing in my code that forms a sum like S(0)+ ... +S(5).

When you originally posted these equations, they appeared to me as difference equations because it looks like the independent variable is k; there is no other independent variable such as t or x. But, in consideration of your other Question thread, I see that each iterate S[k] is actually a real-valued function of a real variable, so should be styled as something like S[k](t). In light of that, the code above is irrelevant to your actual problem (and you should probably not waste time considering it further), although it does numerically solve the difference equations as they were posed. Also, it's now no surprise that the plotted solutions show no relation to your actual real-world problem. I'm guessing that it models the spread of a disease?

@nm My preference is that you leave the Question.

First 330 331 332 333 334 335 336 Last Page 332 of 709