Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@erik10 Have you tried name quotes: `f '`[0]? Note that I place an extra space after f purely for typographical reasons.

@pimp88z Sorry, the part of my Answer mentioning Vectors was wrong. This particular command only takes data in list form. This is very unusual, especially for a command in a LinearAlgebra package, which is why I made the mistake. So, just use lists, as in

Student:-LinearAlgebra:-LeastSquaresPlot([1,2,3], [4,5,6]);

@GPY Use the restart command, then execute the above code again. Your error message indicates that at least one of y, x, or y(x) has an assigned value from some earlier code. The restart will remove that assigned value.

Note that you originally said the error message said "y(x) is expected to be of the form..."; this time you said yx. Only the latter makes sense. It is also important to report the last part of the error message, the part that begins "but received....". It was only seeing that part that led me to conclude that your error was due to inappropriately assigned values.

Your expression has no Laplace transform parameter, which is usually denoted by s.

@taro 

Thank you for inquiring about my code. For you, I am happy to explain it all.

Let M be a Maple Matrix. Then op([1,1], M) is the number of rows of M, and op([1,2], M) is the number of columns. The transpose of M is M^%T. The transpose is needed in this context because convert(M, list) lists M in column-major order, unless the Matrix has option order= C_order, which is not the default. (It seems strange that convert(Matrix(2,2, [1,2,3,4]), list) produces [1,3,2,4], but it is nonetheless true.)

In this context, $ is the repetition and sequencing operator. So, "X" $ 4 is "X", "X", "X", "X", and cat("X" $ 4) is "XXXX".

My code can be extended to an arbitrary number of columns (like Kitonum did)---and the extra comma at the end of each parenthetical grouping can be avoided---like this:

string1:= sprintf(
     ((m,n)-> cat(cat("(","%a,"$n-1,"%a)==")$m))(op(1,pt3)), convert(pt3^%T, list)[]
)[1..-3];

I find it difficult to produce code that is both brief and elegant when converting a sequence to a string. One big stumbling block is that the number of separators is one less than the number of sequenced items. You can see above that I avoided the extra comma by never including it, but that I avoided the extra "==" by including it and then removing it with [1..-3] at the very end.

Let me know if you need any more explanations.

@Preben Alsholm I get that the overall integral is divergent even if y=0, and setting y=0 is an easy way for the OP to clearly see that it is divergent.

Float(infinity) indicates that you were doing a floating-point operation such as evalf and the answer was infinity. Your integral's leading term has order 1/u^3, and int(1/u^3, u= 0..10) clearly diverges to infinity. You will easily see this if you set y=0.

@wo0olf 

Don't you think that it would be helpful for someone trying to answer your Question to see your PDE?

Please show the commands that you entered into Maple. It should be something like

diff(ln(x^2+1), x);

diff(2*x, x);

 

@Kitonum 

It is possible with plot by using both the adaptive= false and sample options. It is not possible with implicitplot. The grid option defines the size of rectangles in the xy-plane, but neither x nor y can be individually specified within those rectangles.

@Kitonum I am not sure that I understand your question. Are you asking whether you can extract data from an existing plot structure using a specified step? No, not unless the step was specified or was inherent to the original plot command. All programmatically accessible plot structures contain specific numeric point data; they are not dynamic. There are a few dynamic plot features implemented in the Standard GUI, such as zooming and 3d fly through; however, these features are not programmatically accessible.

The data matrix extracted from a plot can be passed to CurveFitting:-ArrayInterpolation. (It may need to be sorted first.) Then evenly spaced ordinates can be specified. This is not exactly the same thing as points on the curve, but they are likely to very close to points on the plot itself, assuming that the graphics drivers use a similar interpolation algorithm.

I am currently working on a timewise and accuracywise comparison of the fsolve and implicitplot-plus-ArrayInterpolation approach. I have no doubt that fsolve will win for accuracy. But I think that the latter will win for time when then number of points is large.

I cannot duplicate your problem. I get realistic timings when I use large numbers. Also, for large numbers you'll need to reduce the number of iterations or not use the iterations parameter (equivalent to setting iterations= 1). Would you please post a worksheet that shows the phenomenon that you describe?

@jonlg I do not know much about the Gillespsie algorithm, but it strikes as odd the way that mu is computed in your code, and also that it is computed for every loop iteration. Certainly, the number of iterations of the algorithm is inversely (and stochastically) proportional to mu.

@wolfman29 

While Re itself is not a long computation, it is not differentiable. Since fsolve uses derivative-based methods (I believe), Re may lead to extra cases for fsolve to consider. I am not saying that this is the cause of the problem, but it is something to consider.

I've done a few experiments with your code, and it seems that the integration is not the cause of the hangup (although I am not sure of this). I put print statements surrounding the Int in your procedure RP1 so that I could see when integrations begin and end.

@jonlg 

The sequence of pseudorandom numbers always starts off the same after a restart. This leads to reproducibility of results, which is important for debugging. In order to get different pseudorandom numbers, include than command

randomize();

right after your restart.

 

First 510 511 512 513 514 515 516 Last Page 512 of 709