## 222 Reputation

18 years, 169 days

## How does one insert unusual Math symbols...

Maple

Hello:

I have created a simple plot and labelled a line as follows

Lbl:=plots[textplot]([600,-Pi*floor(R)*ln(R)-0.01,typeset(-pi*floor(r)*ln(r)),font=[Helvitica,bold,10]],labels=[T," "]):

where R is a number, so the label appears near where I want it to be:

But part of the formula is floor(r) and I can't make that appear as the 2D mathematical symbol for floor(r) in the typeset;

If I make the typeset part of an axis label or a legend, I can cut and paste the math2 expression for floor(r) just before I export the plot and that works, but how do I do that for a textplot that is sitting in the middle of a plot?

Thank you.

## How does one insert a superscript number...

Maple

Hi:

In a plot title, I want  A^(1)(x) to appear - that is, the first derivative of the function A(x) with the "1" enclosed in brackets because that is the standard notation for derivatives of the special function A.

Alternatively, I'll be happy to use A'(x) - and I know that there are calculus characters on the pallet that are supposed to do that, but they all just become Diff and that is no good for other reasons.

So, here is the closest I've come:

Test:=plots[textplot]([3,3,typeset(A^[1],"(x)")]);

and that almost works, except if I change the [1] to (1), Maple tries to evaluate it as an expression and it disappears. If I change 1 to 2 it works fine, except I want the first derivative.

I've tried quotes, uneval, backquotes and all I get is an error or the quotes showing up as text.

Does anyone know how to do this?

Thank you.

## How to reset a default variable name?...

Maple 2023

Hi:

I am using solve(...,allsolutions)

and Maple is giving me the default "_Z1~" as part of the solution. No problem.

But when I go back and run the same statement again without a restart, it gives me "_Z2~" and my program fails because it is looking to substitute a value for "_Z1".

How do I reset the naming convention without restarting so I can get the same output each time I run the same statement. (BTW: The same thing happens with Veil where it increments the indices of the Veil symbol each time you run the same statement)..

Thank you.

## How to extract numerical values from an ...

Maple

I have an expression of the form X=a/f^b where a and b are both numeric. How do I elegantly extract the numerical values of "a" and "b" given X? See below for my kludge solution.

Problem: extract two numerical values from an expression. Surely there is a more elegant way?
Here is the form of the expression.

 > restart; X:=a/f^b;
 (1)

Find a and b when they are numbers.
X1:=subs(a=1.234,b=6.789,X);

 (2)
 > indets(X1); fterm:=op(2,%); log(fterm);This sometimes works and yields 6.789*log(f) but I've never been able to figure out when it is going to work and when it won't work. #log(fterm,f);This never works
 (3)
 > b:=-op(2,fterm);
 (4)
 > a:=X1*f^b;
 (5)

Isn't there a better way? This requires that the "op" indices won't ever change and that is asking a lot if this is embedded in a larger program.

## Why do two wrongs make a right?...

Maple

In Hansen's book "A table of Series and Products" there is an unsourced listed identity 43.6.1:

S1 := Sum(2^k*tanh(2^k*x), k = 0 .. n - 1) = 2^n*coth(2^n*x) -   coth(x)

It appears to be to be numerically correct, and can be obtained from a second identity

S6:=Sum(2^(-k)*tanh(2^(-k)*x), k = 1 .. n) =- 2^(-n)*coth(2^(-n)*x) + coth(x)

by "summing in reverse order". S6 is also numerically correct.

Starting from S1 and reversing the order, gives

S2 := Sum(2^(n - k - 1)*tanh(2^(n - k - 1)*x), k = 0 .. n - 1) = 2^n*coth(2^n*x) - coth(x)

Then shifting the index gives

S3 := Sum(2^(-k)*tanh(2^(-k)*x), k = -n + 1 .. 0) =  2^n*coth(2^n*x) - coth(x)

both of which test OK numerically since n>0. Now it begins to get strange.

In S3, let n->-n (highly illegal) to obtain

S4 := Sum(2^(-k)*tanh(2^(-k)*x), k = n + 1 .. 0) = 2^(-n)*coth(2^(-n)*x) - coth(x)

and, surprisingly Maple tests S4 to be correct numerically.

Here's how that happened. The lower limit of the S4 sum exceeds the upper limit, so there are three possible ways to interpret this:

1. In standard mathematical usage, this is usually set to zero by caveat;

2. In a practical sense, one might expect the order of summation to be irrelevant so S4 is the same as

S5:= Sum(2^(-k)*tanh(2^(-k)*x), k = 0 .. n + 1) = 2^(-n)*coth(2^(-n)*x) - coth(x)

but that fails numerically.

3. Maple has a built-in algorithm (see the help page on "Sum") that interprets

Sum(f(k), k = m .. n) = -Sum(f(k), k = n + 1 .. m - 1)

when m exceeds n and that is why S4 works numerically and, when applied to S4 gives the result S6.

So where did Maple's prescription come from, and what is it's justification?

Thank you

 1 2 3 4 5 6 7 Page 1 of 8
﻿