# Question:How do I use this procedure in odeplot?

## Question:How do I use this procedure in odeplot?

Maple

I want to use a variant of the arctangent function in odeplot but I run into various problems. Here is the variant called at
> at := proc (x::realcons, yy)

if 0 < x then arctan(yy/x) elif x < 0 then Pi+arctan(yy/x) elif x = 0 then (1/2)*Pi end if end proc;

It would be nice to know if this is really what I want so I try to plot at  values for which I know the answer
> plot(at(-cos(-t), sin(t)), t = 0 .. 3.14);

Error, invalid input: at expects its 1st argument, x, to be of type realcons, but received -cos(t)

I have seen this problem before so I use single quotes with success:
plot('at(-cos(-t), sin(t))', t = 0 .. 3.14);

I get the desired plot;

Now I want to use this procedure in a plot of a numerical solution to an ODE.
The ODE is quite complicated but returns a procedure ,nans, that i use to visualize solutions via commands such as

> odeplot(nans, [[y, f(y)]], y = 0 .. 6);
No problem with any of that,

The problem arise when I define theta below
> theta := at(f(y)-(1/2)*Pi, diff(f(y), y));
and try to use it in odeplot, for example,
> odeplot(nans, [[y, theta]], y = 0 .. 6);
or
> theta1:=y->at(f(y)-Pi/(2),diff(f(y),y));

> odeplot(nans, [[y, theta1(y) ]], y = 0 .. 6);

Maple's complains about theta and theta1 and all of my attempts to fix the problem:

Error, (in plots/odeplot) curve 1 is not fully specified in terms of the ODE solution, found additional unknowns {Theta1}
or
Error, (in Theta1) invalid input: at expects its 1st argument, xx, to be of type realcons, but received f1(y)-(1/2)*Pi  or

Error, (in Theta1) invalid input: diff received HFloat(0.001), which is not valid for its 2nd argument

I supect there is an easy fix. If I give up on at and just use arctan I get an ugly jump in my plot but otherwise everything works.

I am looking for a high accuracy plot, however, and the jump obscures important features.