tomleslie

13876 Reputation

20 Badges

15 years, 173 days

MaplePrimes Activity


These are replies submitted by tomleslie

@maple 

Read/Execute the worksheet in my previous post

What reason do you have to believe that this is incorrect in any way?!

When using a recursive definition, there has to be a "stopping condition" in order to avoid an "infinite loop". This stopping condition has to be a defined numeric value.

You say that you want 'n' iterations: so that would be how many - exactly - one hundred?, one thousand? one million? one trillion? Think about it

@Dina 

Supplied code executes with no error or warnings

Supplied code provides the answers I would expect

I have no idea what your problem is!!!!!!

Clarify

@Dina 

Impossible to diagnose problem from you random comments - upload code

@asa12 

I have just run this file in Maple 18.02 - no errors.

It was developed in Maple 2015,2 where it runs with no errors

I can only suggest that you make sure that your "Maple 18" installation is up-to-date

As for your comment

"i understand your comment , you said that u1(t) and u2(t) have already been solutions, but i still do not understand how different orders of differential terms be added and result in zero."

I can only suggest that you read my worksheet very, very carefully. You will note that the definitions of the functions p() and q() contain terms of different orders, which when combined with the terms in your differential equation ....

@maple 

The attached worksheet should do everything you want. Comments within the worksheet should answer most of your questions - Please read them carefully if you want to understand what is being done at each stage.

In order to execute the complete worksheet succesfully, you will have to change the pathName/fileName for csv-format output to a value which is appropriate for your machine/installation.

I have used

  fname:="J:/Users/TomLeslie/myMaple/expdata.csv":

which works for me, but you will need to change this line.

Output will be in CSV format. I no longer have gnuPlot installed - but it *must* be able to read/plot CSV

plotExp.mw

You define k:=n-i

The last time your outer for loop executes is when i=n-1

So the last iteration of this loop has k=n-i which is n-(n-1)=1, which is what you see when you later query k
Now your problem seems to have nothing to do with the value of k!!

Impossible to diagnose further because no values are giveb for 'AA[]' or 'n'

So what is your problem

Use the big green up-arrow in the MaplePrimes editor( right hand entry on the bottom toolbar) to upload code, saves anyone here from doing any retyping

@Preben Alsholm 

First of all let me say that I admire anyone  who decides that infinity~5 :-)

Been a while since I use gnuPlot, but on the basis that it reads almost anything, then I am assuming that a simple csv file will be no problem. To generate a simple csv file from Maple, you need to add the following to Preben's script

fname:="J:/Users/TomLeslie/myMaple/expdata.csv"
Export( fname,
            Matrix( [seq( [rhs(res(j)[1]), rhs(res(j)[2])], j=0..5, 0.01)] )
         );

Notice that you will need to adjust the string in fname to some value approprite for your machine - but keep the '.csv' extension, because the Export() command use this to determine the storage format for the ouput

Like I said, I no longer have a copy of gnuPlot, around, but using  a text editor to check the file produced by the above command, I am absolutlely certain I could persuade gnuPlot to plot it

With p(t), q(t) as defined in your previous post, the attached shows that both u1(t) and u2(t) are solutions of the supplied differential equation. Note that this does not result in determining the form of u1(t), u2(t). So far as I can tell, these are arbitrary

I suggest you read the attached (including the comments!) very carefully

OddDE.mw

The existence of the unknown functions p(1/t) and q(1/t) in the differential equation

f := diff(u(t), t$2) + (2/t-1/t^2*p(1/t))*diff(u(t),t) + 1/t^4*q(1/t)*u(t) = 0;

means that this equation is equivalent to

f := diff(u(t), t$2) + (arbitrary_unknown_function1_of_t) *diff(u(t),t) + (arbitrary_unknown_function2_of_t)*u(t) = 0;

By appropriate substitution in these arbitrary functions, I'm pretty sure I could transform the above equation into almost any ODE I wanted. Consider for example what happens if I choose the first of these arbtrary functions as

arbitrary_unknown_function1_of_t = ( diff(u(t), t$7)-diff(u(t), t$2) )/ diff( u(t), t)

which would transform your original equation to

f:= diff(u(t), t$7)+ (arbitrary_unknown_function2_of_t)*u(t) = 0

Do you still expect to be able to come up with a general solution which will "work" for any definition of your arbitrary functions p() and q()???

@iman 

The variable extra_bcs, contains the quantities

{(D(g1))(0), (D(g1))(1), ((D@@2)(g3))(0), ((D@@2)(g3))(1), ((D@@3)(g3))(0), ((D@@3)(g3))(1)}

and in the loop performing the solution, each of these is set equal to 10^(-7) in turn to provide the "last" boundary condition. Interestingly if I change the expression {b = 10^(-7)} to {b = 0}, then the loop completes without error.

Do you really need the condition {b = 10^(-7)} ratther than {b = 0}????

 

I found this workshett very difficult to debug because ther is so much code which simply does nothing, assigns quantities which are never used, or is really badly written. Makes debug a nightmare!

I have cleaned it up a lot, by commenting out all the rubbish (with a couple of minor rewrites) - see attached, which contains explanations for the changes

bvProb.mw

This appear to give the same issue as before, in that the dsolve() command works for the first two sets of boundary conditions, but fails on the third (out of 6). Perhaps it is only the third set of boundary conditions which cause a problem? I haven't actually checked whether the final three sets of boundary conditions cause problems for the following reason

I have made so many edits to your original code to make it sensible/legible that I would like you to confirm that the revised code in the attached file is equivalent to your original - you only have to check quantities on entry to the do loop containing dsolve. I have done so, and am pretty sure that all of the edits I have made, do not significantly change your problem, but I would like confirmation before I go any further

BTW. like Preben, I am really surprised in your choice of abserr value: I normally expect to see this with a negative exponent - I mean `e11` - so you are realy happy with errors of the order 1.0e11?????

 

@Carl Love 

The indexing problem only occurs if tables are used - and I can see no reason for using them. See my earlier post

BTW The argument order is incorrect in your polynomialFit command,: it should be

regress:= Statistics:-PolynomialFit(10, t, A, time);

not

regress:= Statistics:-PolynomialFit(10, A, t, time);

'A', 't' oredering looks backwards to me as well, but OP is consistent in both his/her plot/PolynomialFit commands that 't' is the dependent variable

@one man

The only problem I have with RootFinding[Isolate] is the help page, whose first line says

RootFinding[Isolate] - isolate the real roots of a univariate polynomial or polynomial system

Inclusion of the word univariate is very misleading - it certainly fooled me

 

@one man 

When the OP posted the problem, I did the "quick and dirty" check, just substituting the DirectSearch[SolveEquations]() command for fsolve() and it returned a solution.

However at the time I did note that the residuals were relatively large given that the OPs problem did not seem to be obviously ill-conditioned or badly scaled.

I did not really check the form of the OP's equations - so did not even notice that they were (in fact) pure polynomials.

When the OP tthen asked how I had obtained this solution, I explained it to him/her, and decided to have another look at this problem. I didn't even check the worksheet which you posted - I should have, so I apologise for that

When I realsied that the OP's system was purely polynomial, I headed for the RootFinding() package. I actuall considered the Isolate() command, but discarded it without trying, because the first line on its help page says

isolate the real roots of a univariate polynomial or polynomial system

and the OP's system is not univariate.

However the Homotopy() command did not seem to be restricted to univariate polynomials, so I thought I would try this one. This actually returned 1 real solution and 16 complex ones.

I was just about to suggest using RootFinding[Homotopy] with an accompanying worksheet, when I re-read the whole thread and realised that you had in fact posted a solution using RootFinding[Isolate]. This puzzled me, so I went back to the help page for this command and realised that although it states that only works for univariate polynomials, some of the examples are multivariate, and seem to work!!!

The one real solution returned by RootFinding[Homotopy], agrees with one of the two solutions which you obtained using RootFinding[Isolate].

Three lessons from this exercise

  1. In this instance the "solution" returned by DirectSearch[SolveEquations] is nonsense
  2. RootFinding[Homotopy] can "lose" solutions. Although to be fair, it does not claim to find all solutions, and I only tried it on the defaults - maybe if I had played with options it would have found the other one
  3. Someone really ought to rewrite the Maple help page for the RootFinding[Isolate] command, since it obviously works for multivariate polynomials
First 159 160 161 162 163 164 165 Last Page 161 of 207