README.md in danica-2.6.4 vs README.md in danica-2.7.1
- old
+ new
@@ -248,12 +248,12 @@
end
fx = Danica::Function::Spatial.new(
time: :t,
acceleration: 'a',
- initial_space: { name: :S0, latex: 'S_0', gnu: 'S0' },
- initial_velocity: { name: :V0, latex: 'V_0', gnu: 'V0' }
+ initial_space: { name: :S0, latex: 'S_0', gnuplot: 'S0' },
+ initial_velocity: { name: :V0, latex: 'V_0', gnuplot: 'V0' }
)
```
##### to_tex
```ruby
@@ -509,20 +509,20 @@
Variables can also behave differently when converting to tex or gnu
```ruby
Danica::DSL.build do
- variable(name: :frequency, latex: '\lambda', gnu: :f)
+ variable(name: :frequency, latex: '\lambda', gnuplot: :f)
end
```
would produce different ```#to_tex``` and ```#to_gnu``` results (```\lambda``` and ```f``` respectvly)
Also, valued variables will always use their value on string representation
```ruby
Danica::DSL.build do
- variable(name: :frequency, latex: '\lambda', gnu: :f, value: 2)
+ variable(name: :frequency, latex: '\lambda', gnuplot: :f, value: 2)
end
```
will always return ```2``` for both ```to(:tex)``` and ```to(:gnu)``` calls
@@ -599,16 +599,59 @@
While variables with value have a numeric string representation, constants will always
be represented by their string attribute
```ruby
-Danica::Wrapper::Constant.new(gnu: 'pi', latex: '\pi', value: 3.141592)
+Danica::Wrapper::Constant.new(gnuplot: 'pi', latex: '\pi', value: 3.141592)
```
which will have the returns of ```#to(format)``` obeying the following
```ruby
{
tex: '\pi',
- gnu: 'pi',
+ gnuplot: 'pi',
f: 3.141592
}
```
+
+###Formatting
+When generating the output, you can choose options or even
+create a formatted object
+
+#### decimals
+define the float decimals
+
+```ruby
+value = 1 / 3.0
+expression = Danica.build(:x) do
+ x + value
+end
+
+expression.to_tex(decimals: 3)
+```
+
+returns
+
+```string
+x + 0.333
+```
+
+#### Formatted
+Any Danica object can be formatted previously returning a pre-formatted object
+
+
+```ruby
+value = 1 / 3.0
+expression = Danica.build(:x) do
+ x + value
+end
+
+formatted = expression.tex(decimals: 3)
+formatted.to_s
+```
+
+returns
+
+```string
+x + 0.333
+```
+