Thank you for your helpful comments.
> If you declare("-",alphabetic), you can avoid problems by writing a space before and after the minus sign, e.g., - a and a - b rather than -a and a-b.
I subsequently “respelled” the variable “semi-major_axis” as “semi‐major_axis”, replacing the ASCII hyphen-minus character (U+002D) with the Unicode hyphen character (U+2010), and changed the declare() statement to make U+2010 alphabetic rather than U+002D. This avoids problems with the “-” operator.
> It's better practice to write bigfloat numbers in bigfloat notation directly, e.g., 1.234b-3, or to convert exact numbers, e.g., bfloat(1234 * 10^ - 6), instead of converting floating-point numbers, e.g., bfloat(1.234e-3). In your particular example, though, float precision is enough, so it doesn't matter.
I was unfamiliar with bigfloat notation—thanks for bringing it to my attention! (As I’d noted in my first message, I’m an absolute beginner with Maxima.) I’d hoped that there wouldn’t be a problem with converting the float in first_flattening to a bigfloat.
> I don't understand why you're writing S as a memoizing function.
My goal was to avoid reperforming the calculations of S() if I called S() with a particular set of a, n, φ, j_maximum multiple times, which is why I went with a memoizing S[] instead.
It looks like the ::= operator isn’t what I’d thought of as a macro creator:
(%i1) s(i, i_min, i_max, expr) ::= sum(expr, i, i_min, i_max)$
(%i2) sum(j*2, j, 1, 3);
(%o2) 12
(%i3) s(j, 1, 3, j*2);
(%o3) 6 j
In the s() macro, the use of the index in the expression seems to be entirely independent of the index itself.
Would some combination of quoting and ev() calls be needed in the definition of s() to make “s(j, 1, 3, j*2);” also return 12? (I have a strong preference for the expression to be specified last rather than first.) Or would I have to essentially write my own version of a sum() function to be able to specify the expression last?
_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.