Simultaneous equation using PIC assembly


Closed Thread
Results 1 to 3 of 3
  1. #1
    mankan's Avatar
    mankan Guest

    Default Simultaneous equation using PIC assembly

    Hello,

    I am looking for a sample code to solve Simultaneous equation using PIC assembly.

    I looking for solving x,y,z unknowns with 3 different sets of equcations.

    Any help is appreciated.

    Thanks,
    Mankan

  2. #2
    mankan's Avatar
    mankan Guest


    Did you find this post helpful? Yes | No

    Default

    Hello PIC Gurus,

    Any help regarding above topic is greatly appreciated.

    TIA,
    Mankan

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Mankan,

    I have done this (3 equ and 3 unkns) with brute force using Cramer's rule (which is "plug and chug" systematic). However, because we are working with integers, have variable size limits, and no easy way to track negative signs, you need to be careful not to "lose" your answer or get the wrong answer. Beyond Cramer's, you can search online for some form of "Gauss Elimination" for bucket loads of information on numerically solving simultaneous equations.

    A quick 2eq and 2unkns example follows using Cramer's Method

    Solve:
    5x+3y=13
    x+y=3
    (answer: x = 2, y = 1)
    Code:
    'declare variables accrodingly - I did not
    x1=5
    y1=3
    a1=13
    x2=1
    y2=1
    a2=3
    
    D = (x1*y2)-(x2*y1)
    x = ((a1*y2)-(a2*y1))/D 'x=2 yeah!
    y = ((x1*a2)-(x2*a1))/D 'y=1 yeah!
    However, negatives and fractions must be dealt with or you will get a surprise answer and not the correct answer - this example had none. (3 equ and 3 unkns is similar but with lots more terms, which would means lots more checking for negative signs.)

    Good and lots lots lots of Luck,
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  3. assembly in Pic
    By lerameur in forum Off Topic
    Replies: 11
    Last Post: - 1st May 2008, 20:06
  4. decoding PIC assembly -- need help
    By uchiprox in forum General
    Replies: 1
    Last Post: - 12th February 2007, 04:19
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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