Carl Love

Carl Love

28110 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

First, please format your code so that it is readable by a human. Something like this
printf("No           root                   x[i+1]                 abs(x[i+1]-x[i])\n");
for i to n do
     y[i] := evalf(x[i]+(-D1(x[i])+sqrt(D1(x[i])^2-2*f(x[i])*D2(x[i])))/D2(x[i]));
     x[i+1] := evalf(y[i]-f(y[i])/sqrt(D1(x[i])^2-2*f(x[i])*D2(x[i])));
     printf("%d         %10.10f     %10.10f       %10.10e \n",
             i+1,       x[i+1],    f(x[i+1]), abs(x[i+1]-x[i])
     );
     if abs(x[i+1]-x[i]) < tol then
          print("approximate solution" = x[i+1]);
          print("No of iterations" = i+1);
          break
     end if
end do;

What is y[i]? What are D1 and D2? Did you intend for n to represent the maximum allowed number of iterations? n and tol and f need to be specified. Your formula for x[i+1] looks weird---too complicated. What function are trying to find the root of?

This is the kind of error message that a programmer puts into code to indicate that a serious bug has occured. This error message in particular occurs in the short procedure DynamicSystems:-TF_Matrix.

@jelmew I tested this on the uploaded worksheet:

evalindets(combine(Mcross, symbolic), sqrt, expand);

Maybe there are no solutions. It would be nice to have some evidence that a solution exists (such as a plot) before fine tuning fsolve with options.

There are complex solutions that fsolve will find if you give it the option complex.

@Adri van der Meer Regarding your point (1): It is not necessary to declare the dimensions of an Array. See my Answer for an example of this.

@Preben Alsholm These links cover the univariate case only.

@john125 Can you post a worksheet with the actual equations, please?

@john125 Sorry, I meant

select(y-> is(y>0), [Sols]);

@toandhsp Cut and pate Kitonum's code directly from the Post.

@acer Why are your exponents off by 4 decimal places compared to the OP's?

@toandhsp Did you get no result, or did you get a RootOf result? If the latter, add the explicit option to the command:

solve({30+1144*r^4-832*r^2=0, r>0}, explicit);

@ctnaz I know that *F means multiply by F, but you have "*F" not *F. What is the purpose of the quotation marks?

@Preben Alsholm

Saying the same thing differently, in a way that seems clearer to me: Reading the file with read is equivalent to executing b:= 2*z at the global level, regardless of where the read statement is placed.

I recall reading this in a help file, but I can't find it at ?read or ?parse. Preben, can you find it in help?

I also believe that reading a text file (as opposed to a .m file) with read is equivalent to applying parse to the file's contents, but I can't find this in help.

Indeed, MaplePrimes should have a rule that you need a certain level of reputation in order to Edit Questions after they have Answers!

@Markiyan Hirnyk It can't be a comment to your Answer because I wrote it before reading your Answer.

First 581 582 583 584 585 586 587 Last Page 583 of 710