CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2014
    Posts
    21

    Symbolic transformations

    Which is method to symbolic transformations of equations?
    For example: I must find equation of line passing through two points (x0,y0) and (x1,y) in form Ax + By + C = 0
    this equation is (y-y0)*(x1-x0) = (x-x0)*(y1-y0)
    algorithm must change it to (y1-y0)x + (x0-x1)y + y0(x1-x0) + x0(y0-y1)

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Symbolic transformations

    To convert your eqn 1 to eqn 2 is simply a matter of basic algebraic manipulation which can be done on paper in a couple of lines. So the method is just using algebraic manipulation.

    Note that your eqn 2 can be further simplified to

    Code:
    x(y1 - y0) + y(x0 -x1) + (x1y0 - x0y1) = 0
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Jun 2014
    Posts
    21

    Re: Symbolic transformations

    Algebraic programs prefers Lisp. If is possible code it with Java?

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Symbolic transformations

    Quote Originally Posted by Borneq View Post
    Algebraic programs prefers Lisp. If is possible code it with Java?
    Code what?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #5
    Join Date
    Jul 2013
    Posts
    576

    Re: Symbolic transformations

    Quote Originally Posted by Borneq View Post
    Which is method to symbolic transformations of equations?
    The method is simple in principle.

    You build a tree representing the equations. Then you transform the tree to conform to your wanted representation of the equations.

    Usually the transformations are a set of replacement rules. Each such rule consists of a pattern and what that pattern is supposed to be replace by when the pattern is identified in the tree. It's a language really.

    The set of rule patterns are let loose on the tree and the tree becomes modified accordingly until no pattern applies anymore. Then the tree has reached it's fully transformed state and if the transformation language was well designed the equations are now in the form you expected.

    This is for example how compilers transform expressions in the optimization phase.
    Last edited by razzle; July 18th, 2014 at 04:35 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured