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

@valery12 Your code for 4th-order Runge-Kutta is already correct! You just need to specify the differential equation. That is, you need to set the value of f!

To clarify (possibly for other readers), you want to increase the plot's extent in the second coordinate dimension, which is not quite the same thing as the y-coordinate because you used y as a parameter.

In your Question, you say z/(1+z), but in the attached code, you use z/(1-z). Which is correct?

@valery12 What Mac Dude means is that you didn't set the values of f or _Meth.

@briceM No, you can't use cmaple to run .mw files (Maple worksheets). You need to extract the code from the worksheets into plaintext files first.

That's certainly not C code. I think that it's Fortran-ish. It's not quite Fortran because the comments are not distinguished from the code in any obvious way. Before we try translating this to Maple, could you supply code that's known to work in its source language?

What you describe is possible, but there's likely to be a much better way: saving the entries or the whole Jacobian as procedure code, possibly compiled, which may take much less memory because of the encapsulation of common subexpressions. That encapsulation can be done automatically.

Before we proceed, I need to know what you need to do with the Jacobian afterwards. Will you just use it for numeric evaluation? or will you use it for symbolic analysis?

@Adam Ledger SCR = Software Change Request

@fff97 The paper you linked gives some information on how to implement this in purely hardware-float arithmetic, which is what Matlab uses. It'll work for reasonably sized d (the starting digit position). You'd need to implement the modular exponentiation for the expression

16 &^ (d-k) mod (8*k+j),

which'll only take a few lines of code. But this'll only work if d is small enough so that the computation will happen in exact-integer arithmetic. I think that that means that (8*d+6)^2 will need to fit into the 53-bit mantissa of a hardware float, which means (I think) that (8*d+6)^2 < 2^52.

@vv Thank you for the compliment.

Regarding 0 &^ 0: For purely integer arithmetic, I believe that 0^0 should be 1. What are some arguments to make it undefined? We have 0! = 1 and binomial(0,0) = 1. And for the program above, making 0 &^ 0 equal 1 produces the correct result, which allows me to extend the BBP algorithm from the paper (where it's stated that d > 0) to the case d=0.

For real-number and complex-number arithmetic, I have no problem with keeping 0^0 undefined. Unfortunately, Maple's automatic simplification makes it 1.

@Deank1905 Yes, my technique can be directly applied to your situation:

LCM:= 1;
for i from 1 to 10 do
    # Your code that computes an individual r goes here:
    # ...
   LCM:= ilcm(LCM, r)
end do; 
LCM;

 

This technique doesn't "get all of the values of r out of the loop" because that's not necessary to compute their lowest common multiple. But if you still do want to get the values of r out of the loop for some other reason, then I can show you how to do that.

@Bosco Emmanuel The weird thing about what you say is that the error message that you received is precisely what it would've been had you not included the ~s in your input. You could do this instead:

M2:= map(rhs, Matrix(map(convert, [solution], list)));

The ~ is (essentially) just an abbreviation for map. (There are a few technical differences; it's not a purely syntactic abbreviation.) What Maple version are you using? This use of ~ was introduced in Maple 13 I believe.

@Bosco Emmanuel You didn't transcribe Tom's solution correctly. You wrote

M2 := rhs(Matrix(convert([solution], list)));

whereas he wrote

M2 := rhs~(Matrix(convert~([solution], list)));

@Bosco Emmanuel The number of rows is nops([solution]).

@Muhammad Usman You never say what the contents (or entries) of the matrices named A are supposed to be. I don't see how your specific question

A[n]:= ?

can be answered without that information.

Nowhere do you say what goes into the matrices A. You only say what the As go into.

First 342 343 344 345 346 347 348 Last Page 344 of 709