RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • acos
    • acosh
    • asin
    • asinh
    • atan
    • atan2
    • atanh
    • cos
    • cosd
    • cosh
    • cospi
    • deg2rad
    • pol2cart
    • rad2deg
    • sin
    • sind
    • sinh
    • sinpi
    • tan
    • tand
    • tanh

atan — Element-wise inverse tangent in MATLAB and RunMat.

Y = atan(X) computes the inverse tangent (in radians) of each element in X. The additional atan(X, "like", P) output-template form is a RunMat-only extension.

Syntax

Y = atan(X)
Y = atan(X, "like", P)

Inputs

NameTypeRequiredDefaultDescription
XAnyYes—Single/double real or complex input; integer, logical, and character forms are RunMat-only extensions.
likeStringScalarYes"like"RunMat-only output template selector keyword.
PLikePrototypeYes—RunMat-only prototype determining host/gpu residency and real/complex output class.

Returns

NameTypeDescription
YAnyElement-wise inverse tangent result.

Errors

IdentifierWhenMessage
RunMat:atan:InvalidInputInput cannot be interpreted as supported numeric/char/complex data.atan: invalid input
RunMat:atan:InvalidOptionOptional arguments after X are malformed or unsupported.atan: invalid option
RunMat:atan:ArgCountToo many input arguments were supplied.atan: too many input arguments
RunMat:atan:LikePrototypeThe "like" prototype or requested output class is unsupported.atan: invalid "like" prototype
RunMat:atan:GpuUnavailableGPU output was requested via "like" but no active provider is available.atan: GPU provider unavailable
RunMat:atan:InternalInternal gather/conversion/allocation/provider flow failed.atan: internal error
RunMat:atan:TooManyOutputsMore than one output is requested.atan: too many output arguments

How atan works

  • Documented single and complex-single inputs preserve native single storage; double and complex-double inputs preserve double storage.
  • The documented table and timetable overloads are not yet implemented in RunMat.
  • Typed-integer, logical, and character inputs are RunMat-only extensions. They enter an explicit double computation boundary and preserve input shape.
  • Complex inputs follow MATLAB's analytic extension atan(z) = (1/(2i)) * (log(1 + i z) - log(1 - i z)), ensuring identical branch behavior and NaN/Inf propagation.
  • Returns results in radians for real inputs and complex numbers for complex inputs.
  • Empty arrays and already scalar values pass straight through while preserving shape.

Does RunMat run atan on the GPU?

When RunMat Accelerate is active and the selected provider implements unary_atan, the runtime keeps tensors on the GPU and executes the kernel entirely on-device.

If the provider lacks unary_atan or declines the request, RunMat gathers the data, computes the result with the reference implementation, and restores it to the input handle's owning provider.

Fusion planning groups neighboring elementwise operations so downstream kernels can stay on the GPU even if atan itself fell back to the CPU.

GPU memory and residency

When a provider exposes unary_atan, the runtime keeps data on the GPU. If the hook is missing, RunMat gathers, computes, and restores the result to the input handle's owning provider. RunMat mode can independently override placement with the gated 'like' output-template extension.

Examples

Arctangent of a scalar

y = atan(1)

Expected output:

y = 0.7854

Element-wise arctangent of a vector

x = linspace(-2, 2, 5);
angles = atan(x)

Expected output:

angles = [-1.1071  -0.7854         0    0.7854    1.1071]

Computing inverse tangent of every entry in a matrix

A = [-2 -1 0; 1 2 3];
Y = atan(A)

Expected output:

Y =
   -1.1071   -0.7854         0
    0.7854    1.1071    1.2490

Evaluating atan on a complex number

z = 1 + 2i;
w = atan(z)

Expected output:

w = 1.3390 + 0.4024i

Matching output storage to a prototype

proto = gpuArray.zeros(1, 1);
G = gpuArray([-3 -1 0 1 3]);
deviceResult = atan(G, 'like', proto);
result = gather(deviceResult)

Expected output:

result =
   -1.2490   -0.7854         0    0.7854    1.2490

Computing arctangent values from character codes

codes = atan('RUN')

Expected output:

codes =
    1.5586    1.5590    1.5580

Using atan with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how atan changes the result.

Run a small atan example, explain the result, then change one input and compare the output.

FAQ

When should I use atan?⌄

Use atan whenever you need the element-wise inverse tangent of data expressed in radians—common in signal processing, control systems, and geometric computations.

How is atan different from atan2?⌄

atan accepts a single input and returns results in (-π/2, π/2). atan2(y, x) takes two inputs, uses the signs of both arguments to determine the correct quadrant, and returns values in (-π, π].

Does atan support complex numbers?⌄

Yes. Complex floating inputs follow the principal analytic continuation; real floating inputs remain real.

Can I keep results on the GPU?⌄

Documented resident input stays on-device when possible and uses owner-preserving fallback otherwise. RunMat mode additionally offers the 'like' output-template extension for explicit host/GPU placement.

What happens with NaN or Inf inputs?⌄

NaNs propagate, and infinities map to the appropriate asymptotic limits (atan(±Inf) = ±π/2), matching MATLAB's IEEE behavior.

Related Math functions

Trigonometry

acos · acosh · asin · asinh · atan2 · atanh · cos · cosd · cosh · cospi · deg2rad · pol2cart · rad2deg · sin · sind · sinh · sinpi · tan · tand · tanh

Elementwise

abs · angle · bsxfun · complex · conj · double · erf · erfcinv · exp · expm1 · factorial · flintmax · gamma · gammaln · heaviside · hypot · idivide · imag · intmax · intmin · ldivide · log · log10 · log1p · log2 · minus · nextpow2 · plus · pow2 · power · rdivide · real · realmax · realmin · realsqrt · rescale · sign · single · sqrt · swapbytes · times · typecast · uint16 · uint32 · uint8

Reduction

all · any · bounds · cummax · cummin · cumprod · cumsum · cumtrapz · diff · gradient · max · maxk · mean · median · min · mink · movmax · movmean · movmedian · movmin · movprod · movstd · movsum · movvar · nnz · prod · rms · std · sum · trapz · var

Structure

bandwidth · isdiag · ishermitian · issymmetric · istril · istriu · symrcm

Signal

blackman · butter · buttord · cheb2ord · conv · conv2 · deconv · downsample · envelope · filter · filtfilt · fir1 · freqz · gauspuls · hamming · hann · hilbert · periodogram · pulstran · pwelch · rectpuls · resample · sawtooth · sinc · spectrogram · square · tripuls · unwrap · upsample · zplane

Rounding

ceil · fix · floor · mod · rem · round

Factor

chol · decomposition · eig · eigs · lu · qr · svd

Solve

cond · det · inv · linsolve · norm · null · pinv · rank · rcond · rref · vecnorm

Optim

coneprog · fminbnd · fminunc · fsolve · fzero · integral · linprog · lsqcurvefit · lsqnonlin · optimoptions · optimset · quad · secondordercone

Ops

cross · ctranspose · dot · mldivide · mpower · mrdivide · mtimes · pagemtimes · pagetranspose · trace · transpose

Symbolic

digits · int · limit · piecewise · sym · syms · vpa

Fft

fft · fft2 · fftn · fftshift · ifft · ifft2 · ifftn · ifftshift

Interpolation

griddedInterpolant · interp1 · interp1q · interp2 · pchip · ppval · spline

Discrete

lcm · primes

Ode

ode15s · ode23 · ode45

Poly

polyder · polyfit · polyint · polyval · roots

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how atan is executed, line by line, in Rust.

  • View the source for atan in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How atan works
  • Does RunMat run atan on the GPU?
  • GPU memory and residency
  • Examples
  • Arctangent of a scalar
  • Element-wise arctangent of a vector
  • Computing inverse tangent of every entry in a matrix
  • Evaluating atan on a complex number
  • Matching output storage to a prototype
  • Computing arctangent values from character codes
  • Using atan with coding agents
  • FAQ
  • Related Math functions
  • Trigonometry
  • Elementwise
  • Reduction
  • Structure
  • Signal
  • Rounding
  • Factor
  • Solve
  • Optim
  • Ops
  • Symbolic
  • Fft
  • Interpolation
  • Discrete
  • Ode
  • Poly
  • Open-source implementation
  • About RunMat