## work around for a problem in dsolve, numeric?...

Of course, there are big differences in dsolve and dsolve numeric. But also there is a difference that is subtle. It would be nice if this subtle one were not there. It may be that there is an easy work-around. Of course, the complication that is at the root of the problem may not be subtle at all. Look at the results of these two situations. First situation. > restart; > h:=t->(1+t)*t^2*cos(t): > sol1:=dsolve({diff(y(t),t)=-h(t-1),y(0)=h(0)},y(t)): > h:=unapply(rhs(sol1),t): > sol2:=dsolve({diff(y(t),t)=-h(t-1),y(1)=h(1)},y(t)): > h:=unapply(rhs(sol2),t): > plot([[t,h(t),t=-1..0],[t,h(t),t=0..1], [t,h(t),t=1..2]],color=blue); Second situation

## strange behaviour of evalhf...

Entering

Tst0:= 0.5, 27.1, 0.1, 0.2, 24.0;
tst0:= beta=Tst0, lambda=Tst0, sigma=Tst0, P=Tst0, M=Tst0;

someFct([1/2*P, 1/lambda*beta],[(lambda+beta)/lambda],-sigma*(1+z)^lambda);
eval(%,evalf([tst0])); subs(z=0.1, %);

myTerm:=subs(someFct=hypergeom,%);

and using evalf(myTerm) I get .9981665521 while evalhf(myTerm) gives me

Error, remember tables are not supported in evalhf

What happens here?

## Octal Arithmetic

Maple
Similarly to Binary Arithmetic, Octal Arithmetic can be done using following module,

## Binary Arithmetic

Maple
Silvexil announced in his blog a Binary Arithmetic package. Here is my version of it.

## Catching an error...

I'm trying to trap the exception generated when the member operator (:-) is used with a variable that is not a module. I thought the following would work:
```restart;
proc()
try
NotAModule:-mem();
catch "`NotAModule` does not evaluate to a module":
print("it worked")
catch:
print("it failed");
print(StringTools:-FormatMessage(lastexception[2..-1]));
end try
end proc();
"it failed"

"`NotAModule` does not evaluate to a module"
```
Any ideas how to fix this? The generated exception string should match the first catch statement.

## solve an ordinary differential equation with impli...

Hi, All, I am trying to solve numerically an ordernary differential equation like this diff(y(x),x) = f(y(x),ya,x) (where ya = y(x=xa), xa a known value) g(y(x=0),ya)=0 The trouble is that the initial value y(x=0) is determined by the second equation which is an implicit equation that has no analytical solution (no explicit expression), and it also depends on the solution at x=xa. Kindly let me know how to write the code to solve it! Thanks. David

## The Eratosthenes Sieve

Maple
Here is the simplest program for obtaining the set of prime numbers less than or equal to `n`,
`f:=n->select(isprime,{\$1..n}):`
It is not Eratosthenes Sieve though. The program ES below implements the Eratosthenes Sieve,

## help about Sieve of Eratosthenes...

Please, i need the code for an implementation of Eratosthenes Sieve, i need a program that calculate primes less or equal than "n", thanks and sorry for my english(i'm from Spain).

## Different cmaple faces

Maple
Yesterday I posted few screenshots of Maple 10. Here I am adding few different cmaple looks in Windows.      ## round to a certain number of digits after the deci...

How do I round to a certain number of digits after the decimal point? Is there an easier way than the one shown below? > number:=12.3678918; > before:=trunc(number); > after:=number-before; > afterrounded:=evalf(after); > roundednumber:=before+afterrounded;

## format a string consisting of numbers and and anot...

How do I format a set of strings consisting of numbers and normal text strings. I want to label a color bar like it is shown below. Each last digit of a number should be below the last digit of the number in the string above. Is used the following command to create the label of the color bar: c:=textplot([seq([2.42,0.05+i/5*0.95,Join([convert(2*100*i/10,string), "*(max(energy)-min(energy))"])],i=0..5)],align={RIGHT}) P.S.: What is the maximum file size of an attachment to a post? I couldn't attach an image that's 8kb big.

## calculate the local maximum of a procedure...

How do I calculate the maximum value of a procedure within a defined region. I want to calculate the maximum value of the procedure p for Ia_IaLGmax=0..2, Ua_Ue=0..1. How can this be done in maple?

restart;
with(plots):
Ue:=75;
L:=5*10^(-6);
f:=80*10^3;
T:=1/f;
factor:=1000;
E_con:=1/2*L*(Ia_IaLGmax*Ue/(8*L)*T+1/2*Ua_Ue*Ue/L*(1-Ua_Ue)*T)^2;
E_dis:=1/2*L*((Ue-Ua_Ue*Ue)/L*(1/2/(Ua_Ue-1)*(-(Ua_Ue-1)*Ua_Ue*Ia_IaLGmax)^(1/2))*T)^2;
helpvariable:=Ua_Ue=(Ua_Ue)^2/((Ua_Ue)^2+1/4*Ia_IaLGmax);
boundary:=solve(helpvariable, Ia_IaLGmax);
p:=proc(Ia_IaLGmax,Ua_Ue)
if Ia_IaLGmax<=(-4*Ua_Ue^2+4*Ua_Ue) then factor*1/2*L*((Ue-Ua_Ue*Ue)/L*(1/2/(Ua_Ue-1)*(-(Ua_Ue-1)*Ua_Ue*Ia_IaLGmax)^(1/2))*T)^2 else factor*1/2*L*(Ia_IaLGmax*Ue/(8*L)*T+1/2*Ua_Ue*Ue/L*(1-Ua_Ue)*T)^2 end if end proc;

## How to modify a compiler flag?...

Compiler:-Compile uses a preset set of compiler flags. But for example I would like to replace -O2 by -fast, which is a special flag for the Mac G5. Is there any way to do this? I would even be willing to dig into the Maple code responsible, if I knew where to dig.

Bob.

## density plot with color gradient and corresponding...

I've looked at Alec Mihailov's interesting web page describing how to use the Microsoft assembler (MASM) to create a DLL that can be called by a Maple procedure. I'm attempting to rewrite the code using the GNU assembler (as) and have a few questions. Page 331, section 6.2 of the Maple 10 Advanced Programming Guide states that, to create a DLL, "the external library functions must be compiled by using the `_stdcall` calling convention, which is the default under UNIX but must be specified when using most Windows compilers." This leaves me somewhat confused. My limited understanding is that the stdcall calling convention has two effects: