# how to draw exponential line

I have to draw a Vivaldi antenna, with a surface with exponentially tapered edge. If I have an exponential curve then I can draw a line along that curve to make the exponential edge. Can anyone suggest how to enter the equation of an exponential curve in sim4Life?

Here is a piece of code that creates a coil wrapped onto a torus, using lines defined from 3D parametric equations.

It makes use of `Law()`, `Curve()`, `CreateWireBody()` and `SweepAlongPath()` from the `XCoreModeling` package.

``````import numpy as np
import s4l_v1.document as document
import s4l_v1.model as model
import XCoreModeling

def create_toroidal_coil(R, r, m, n=1, i=1, name="Toroid"):
"""
Create a spline model object with a spiral shape.
The shape is defined from a 3D parametric equation.
"""

# equation
b = 2. * np.pi * float(i) / float(m)

x_component = "({R}-{r}*cos({b} + {n}*t)) * cos(t)".format(R=str(R), r=str(r), b=str(b), n=str(n))
y_component = "({R}-{r}*cos({b} + {n}*t)) * sin(t)".format(R=str(R), r=str(r), b=str(b), n=str(n))
z_component = "{r}*sin({b}+{n}*t)".format(r=str(r), b=str(b), n=str(n))

path = XCoreModeling.Law("vec({}, {}, {})".format(x_component, y_component, z_component))

curve = XCoreModeling.Curve(path, 0.0, 2.*np.pi)

# Create a spline wire body to visualize
wire = XCoreModeling.CreateWireBody( curve )
wire.Name = name

torus_centerline  = model.CreateCircle(model.Vec3(0,0,0), model.Vec3(0,0,1), 10)
torus_centerline.Name = 'Centerline'
torus = model.CreateSolidCylinder(model.Vec3(10,0,0),model.Vec3(10,0,0), 3)
torus.ApplyTransform(model.Rotation(model.Vec3(1,0,0), np.pi/2))
XCoreModeling.SweepAlongPath(torus, torus_centerline, make_solid=True, cut_off_end=True)

# Theoretical self-inductance:
area = np.pi * (r*1e-3)**2
L_theoretical = 4.0e-7 * np.pi * n * n * area/ (2.0* np.pi *R * 1e-3)
print(L_theoretical * 40)

return wire, torus

if __name__=="__main__":
wire, torus = create_toroidal_coil(10,3,1, n=100)``````