Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add prettier printing for duals #193

Closed
wants to merge 2 commits into from
Closed

add prettier printing for duals #193

wants to merge 2 commits into from

Conversation

KristofferC
Copy link
Collaborator

With inspiration taking from the complex pretty printing in base:

julia> ForwardDiff.Dual(3, 1, 2)
3 + 1ɛ₁ + 2ɛ₂

julia> ForwardDiff.Dual(3, 1)
3 + 1ɛ

julia> ForwardDiff.Dual(3, -1)
3 - 1ɛ

julia> ForwardDiff.Dual(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2)
3 + 1ɛ₁ + 2ɛ₂ + 3ɛ₃ + 4ɛ₄ + 5ɛ₅ + 6ɛ₆ + 7ɛ₇ + 8ɛ₈ + 9ɛ₉ + 1ɛ₁₀ + 2ɛ₁₁

Will add tests after obligatory bikeshedding :)

@KristofferC
Copy link
Collaborator Author

Perhaps better to implement show for the partials instead.

@jrevels
Copy link
Member

jrevels commented Feb 12, 2017

I actually had something similar to this at one point, except it would parenthesize epsilon components for nested dual numbers. I got rid of it in favor of the existing behavior, which I now find much more legible for actual work. I really don't want to go back to drowning in epsilon soup...

I appreciate your work here, so sorry to be a downer, but it's probably going to get a 👎 from me unless there are clearer examples of where this pretty printing is more legible than the current pretty printing.

@KristofferC
Copy link
Collaborator Author

Sounds reasonable. I'm just procrastinating here anyway ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants