Sha256: edab07c4d4935ebf835d29e41c555dd01f9fea1067e697184bc0cb351a704e4b

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# danica
A tool for math formulation on docs

## How to use
Add the gem to your project or just install the gem

```
gem 'danica'
```

```console
bundle install danica
```

Now you can use in your project


```ruby
class MyFunction < Danica::Function
  def to_f
    #implement to float method
  end

  def to_tex
    #implement to tex method
  end
end
```


### Sample

```ruby
class Danica::Function
  class Spatial < Danica::Function
    attr_accessor :time, :acceleration, :initial_space, :initial_velocity
    delegate :to_tex, to: :sum

    private

    def sum
      @sum ||= Sum.new(variables: parcels)
    end

    def parcels
      [
        initial_space,
        spatial_velocity,
        spatial_acceleration
      ]
    end

    def spatial_velocity
      Product.new(variables: [ initial_velocity, time ])
    end

    def spatial_acceleration
      Division.new(numerator: Product.new(variables: [ acceleration, time, time ]), denominator: 2)
    end
  end
end
```

returns
```string
S_0 + V_0 \cdot t + \frac{a \cdot t \cdot t}{2}
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danica-0.1.0 README.md