Coder Social home page Coder Social logo

solve4x's People

Contributors

nateowami avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

solve4x's Issues

Name and logo

I'm happy with Solve4x as a name, but I really can't come up with any good logo ideas. Almost every idea is a variation of Solve written smallish and 4x front-n-center. Very bland. If you have better ideas say on.

I'm considering two other options.

  • Stick with Solve4x and have a sorta-mascot puppy named Epsilon (see my profile photo and you'll know I like puppies). This opens up a lot of possibilities, e.g., an I cans do maths? call-out with a puppy. You'll see I've already put Epsilon in the README. I've also thought a doghouse could be used for the website's home button, an ASCII dog for a link to the code on GitHub, etc. A bone would be perfect for a "donate" button, if donations are accepted.
  • Go the full nine yards and dump the Solve4x name. Call it "Epsilon Algebra Solver" or something (hey, even Eclipse is actually Eclipse IDE). Just the name Epsilon won't be unique, but a variation of it (like the above, or something else entirely) would be fine.

Even with those ideas there's no great logo. I was thinking of using a paw print, possibly constructed from lower-case epsilon. Rachel came up with a way to draw a dog face with epsilon in it, by turning them sideways (similar to how Google does doodles). It worked much better than my idea to use them to make a paw print (--> fail).

Thoughts? Suggestions? I'm open to sticking to exactly what we already have, or something different altogether.

UI Mockup (Swing/Synth)

Using the image you sent as the base, I've created a basic custom LAF and GUI Mockup. that attempts to follow it as closely as possible. All the controls are usable, and the yellow panel can be drawn on.

screenshot from 2014-01-08 15 18 04

Do you think that idea will work?
Btw, I used the Unicode gear character instead of a wrench image, sorry!

Syntax tree for algebra

I won't do a lot of explaining because I want to keep this as an open-ended question. This is purely a theoretical question, but I may use it in Solve4x, since it is inspired by a real problem I am having. What would you say is the proper syntax tree for some of these expressions?

  • 2x+3(4y2+6)
  • ((45)/(y3))2
  • 5(x+y)2

BTW, the 2 on the end of the second two expressions are powers.
Any ideas? This isn't a quiz, it's "How would you logically think to represent these?"

Travis CI Build Fail

Knowing you've gotten Travis CI to work I was wondering what you did. It compiles on my end but it fails every time with Travis CI.

EDIT: Now my local repo has conflicts because I tried to update .travis.yml and it REFUSED to notice edits. So I did it on GitHub and pulled and THEN (oh of course THEN it noticed). It wouldn't let me pull (even with --force) or push (even with --force). Now the repo state is "conflicsts" and it can't do ANYTHING. And this is because I did what git said to do... (commit changes to continue).

Alpha 0.1.0 checklist

Previously the 0.1.0 milestone had a nice markdown checklist. Then GitHub changed how they render milestones and the list broke. Hence I have copied milestone 0.1.0 verbatim below:


Basic solving functionality with a basic GUI. Needs to be able to solve and explain most first degree equations, and simplify and factor first degree expressions.

  • Solver with basic support for first degree equations and expressions [underway]
    • Core parser/solver
      • Equations
      • Expressions
      • Terms
      • Mixed numbers
      • Fractions
      • Numbers
      • Roots
      • Variables
    • Set of solving algorithms [underway]
      • Add, subtract, multiply, and divide
        • Add/subtract (combine like terms)
        • Multiply
        • Divide by canceling factors
      • Undo addition, subtraction, multiplication, and division
        • Undo addition/subtraction (add/subtract from both sides)
        • Undo multiplication (divide both sides)
        • Undo division (multiply both sides)
      • Work with fractions
        • Find LCD for fractions (prepare to add/subtract them)
        • Multiply fractions
        • Divide fractions (invert and multiply)
      • Distributive property [underway]
        • Distribute expressions (e.g. 2(x+6))
        • Factor expressions
      • Ending operations (those that are avoided until the end of solving for accuracy reasons)
        • Raise to a power (exponents)
        • Take nth root (square root, cube root, etc.)
        • Divide decimals
        • Convert improper fractions to mixed numbers
    • Equation validator
  • UI
    • Basic GUI for solving equations [started]
    • Simple CLI
  • Basic equation renderer

This issue will be used to tracker further progress on the milestone, due to better Markdown support.

Validating the equation

I'm just opening this as an issue. We've already discussed it some. Our main two options seem to be:

  1. Use regexes to make sure the expression is valid.
  2. Call a method to ask where the expression needs to diced up (return -1 if not applicable). Then have a general all-purpose dicing method to cut it in two and recursively validate both sides.

Conclusion:
If the regexes you're using can tell us if the expression is valid, then it's definitely the better option. Otherwise I think using the later option would not be too difficult.

What it boils down to: Can regexes tell us if this is valid:
45(45< 6x2>/< mt>)

Solver's Status

I've been working on the solver lately. It should be done in a couple of days (depending on how things go). After that I intend to write a wiki article explaining how to define a solving strategy. We'll need lots of those in order to power the solver.
More updates to come.

Managing Cubic and Higher Roots

Currently the way I've been handling square roots is like this:
√5^ Means the square root of 5
But what about cubic and higher roots? For example, we could use ∛ and ∜, but then we're limited from going higher than four. These symbols are certainly useful, but I think they're a temporary solution at best. You might think we could just use 5√, but how do you differentiate between that and this: (4)√? Ideas?

Precedence of Exponents

This has been an issue ever since I rewrote the parser. The problem is when AlgebraicParticle.getInstance() or AlgebraicParticle.parseable() are called. The parser thinks things like 2x² mean the whole term is raised to the second power, when in reality only x should be raised to the second power. Here's the current implementation (at least what I think it is) compared with what it should be:

String to parse Type parsed Correct Exponent Parsed Exponent
2x+6² Expression 1* 2
(2x+6)² Expression 2 error
(2x+6²) Expression 1* 2
2x² Term 1* 2
(2x)² Term 2 error
(2x²) Term 1* 2
Number 2 2
(2)/(4)² Fraction error or 2** 2
2(3)/(6)² Mixed number error or 2** 2
√(3)² Root error or 2** 2
Variable 2 2

* Any number raised to the first power is itself, hence, a power of 1 is the same as not raising it to any power.
** Could be an error because really it doesn't seem like this should be allowed (because for the fractions it would look like it raises the bottom to a power, when in reality it would raise the whole fraction to the power). It should be written as ((3)/(4))² instead. Same goes for the root.
It should be clear that anything in the form of (<some expression here>)² is the whole expression raised to the power of 2, while <some expression here>² may be the whole expression, or just the last part (such as the last term, or last variable in a term), depending on context.

Currently the sign is removed first (-2x² becomes 2x² and the sign is set to negative), then any parentheses are removed ((3x+4) becomes 3x+4), and finally any superscripts are removed (2x² becomes 2x and the power is set to 2). Obviously this is a problem because the whole term is not supposed to be raised to a power, just the x. This is also a problem if we have (2x+3)². Parentheses won't be removed, and the power will be set to 2, and then (2x+3) isn't parseable because the parentheses are there but they shouldn't be.

We should remove superscripts first, then remove parentheses ((2x)² becomes (2x), then 2x). This doesn't solve everything though. 2x² will still be seen as raising the whole term to the second power. Somehow we have to ignore the exponent, only if it's a term or expression and the power isn't on the outside of parentheses.

Looks like I've got my work cut out for me.

If you're wondering why I'm writing this issue, well, it makes me think things out much more clearly. My head is still half spinning, but I think I know an ugly solution for something that's really ugly to begin with.

GUI Resources Fail to Load

Introduced in 0b24351 when the tests got moved. The directory structure changed, which was important for the sake of the unit tests, but now it can no longer load the GUI resources. I've tried modifying the URL a bit, but so far haven't figured out what works (haven't put a lot of effort into it). This is a reminder to look into it sometime. The code that needs to change is in com.github.nateowami.solve4x.ui/gui.java.

Recursive Signs and Exponents

The problem is how to represent expressions like ((2x)²)² or -(-(2x)). The first is a term raised to the second power, raised to the second power. The current parser would crash over either of these, because it expects everything to be expression, term, number, fraction, mixed number, root, or variable. What it would do is remove the exponent and sign, and then the parentheses, giving it (2x)² for the first (actually due to #23 it doesn't, but that's irrelevant), and -(2x) for the second. When it tries to make one of the above mentioned types (expresion, term, etc.) parse it, none of them can, because they expect the sign and exponent to be handled by the superclass. This wouldn't be an issue for something like (2x²)², because after you remove the superscript and the parentheses, you get 2x², which is a valid term (without the 2 in there it would be a variable, and Variable would complain about having to parse ).

Here's a little insight into how the expressions are represented:

Value toString()
2x² Term [parts=[Number [integer=2, sign()=true, exponent()=1], Variable [var=x, sign()=true, exponent()=1]], exponent()=2]
(2x)²+4 Expression [parts=[Term [parts=[Number [integer=2, sign()=true, exponent()=1], Variable [var=x, sign()=true, exponent()=1]], exponent()=2], Number [integer=4, decimal=0]]]

To be clear, this is not just an issue with the parser, this is an incompatibility with the internal representation.

Possible solution: Create yet another subclass of AlgebraicParticle called "Parentheses" or something, that only holds a sign and exponent, plus an inner AlgebraicParticle.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.