Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Formula transform

Formula transform

Scheduled Pinned Locked Moved C / C++ / MFC
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ivex
    wrote on last edited by
    #1

    Are there any algorithms or source codes could transforms formulas like these: from: a=b*(c-d) to: c=a/b-d or b=a/(c-d)

    R 1 Reply Last reply
    0
    • I ivex

      Are there any algorithms or source codes could transforms formulas like these: from: a=b*(c-d) to: c=a/b-d or b=a/(c-d)

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      Hi ! Well, the usual way is to parse the string to create a tree, with parameters as leaves (* + / =) and standard operations as nodes, such as : * / \ b - which is equal to a / \ c d and with some recursive operations, reverse the tree to get c. That´s less complicated that it seems, but requires a little bit time for debugging =) RaGe

      I 1 Reply Last reply
      0
      • R Rage

        Hi ! Well, the usual way is to parse the string to create a tree, with parameters as leaves (* + / =) and standard operations as nodes, such as : * / \ b - which is equal to a / \ c d and with some recursive operations, reverse the tree to get c. That´s less complicated that it seems, but requires a little bit time for debugging =) RaGe

        I Offline
        I Offline
        ivex
        wrote on last edited by
        #3

        Are there any examples in source code?

        R 1 Reply Last reply
        0
        • I ivex

          Are there any examples in source code?

          R Offline
          R Offline
          Rage
          wrote on last edited by
          #4

          I actually coded such a thing a couple of years ago, but i do not have the source anymore (that was a project at school), sorry. RaGe Unfortunately, brute-force solutions tend to be slow even when performed by modern-day microcomputers, which are capable of several MIPS except when I'm late for an appointment and want to finish a compile and run just one more test before I leave, in which case the crystal in my computer is apparently designed to automatically revert to 1 Hz. -- Michael Abrash

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups