Author Topic: solving equations  (Read 2833 times)

venkat0249

  • Newbie
  • *
  • Posts: 22
solving equations
« on: September 16, 2011, 05:13:15 AM »
Is it possible to solve equations using hypernext? If not can we solve using Rb script?
 For example: x+y=10, x+2y=13 then find x and y values.
answer : x=7 and y=3

tigabyte

  • Administrator
  • Newbie
  • *****
  • Posts: 54
Re: solving equations
« Reply #1 on: September 16, 2011, 05:59:04 AM »
Is it possible to solve equations using hypernext? If not can we solve using Rb script?
 For example: x+y=10, x+2y=13 then find x and y values.
answer : x=7 and y=3

Yes you can use either but of course RBscript is much faster that HyperNext but HyperNext script is much easier to use

Here is a link with an algorithm:-

http://www.justanswer.com/computer-programming/3ml4s-write-program-qbasic-solve-simultaneous-equations.html

venkat0249

  • Newbie
  • *
  • Posts: 22
Re: solving equations
« Reply #2 on: September 16, 2011, 01:03:22 PM »
Thank you for the answer. Unfortunately the link is not working  :( can you give me any other link?

tigabyte

  • Administrator
  • Newbie
  • *****
  • Posts: 54
Re: solving equations
« Reply #3 on: September 16, 2011, 01:36:48 PM »
Thank you for the answer. Unfortunately the link is not working  :( can you give me any other link?

Their site is very slow to respond.

Here is the HyperNext based on their text - it gives the same answer for their problem.
Sorry I don't have time to tidy it up etc but their page should clarify it.
The script goes into a button and the answers for x and y appear in fields 1 and 2 respectively.

Code: [Select]
Local a,b,c,d,e,f,x,y
Local t1,t2,t3,t4

@'ax+by=c equation format will be like this
@'dx+ey=f

@x = (c * e - b * f) / (a * e - b * d)
@y = (a * f - c * d) / (a * e - b * d)

Put 1 into a
Put 1 into b
Put 3 into c
Put 2 into d
Put 3 into e
Put 8 into f

@ calc c
@x = (c * e - b * f) / (a * e - b * d)
Put c into  t1
Multiply t1 by e
Put b into t2
Multiply t2 by f
Subtract t2 from t1

Put a into t3
Multiply t3 by e
Put b into t4
Multiply t4 by d
Subtract t4 from t3

Put t1 into x
Divide x by t3

@ calc y
@y = (a * f - c * d) / (a * e - b * d)
Put a into t1
Multiply t1 by f
Put c into t2
Multiply t2 by d
Subtract t2 from t1

Put a into t3
Multiply t3 by e
Put b into t4
Multiply t4 by d
Subtract t4 from t3

Put t1 into y
Divide y by t3

Put x into field 1
Put y into field 2



venkat0249

  • Newbie
  • *
  • Posts: 22
Re: solving equations
« Reply #4 on: September 16, 2011, 03:47:40 PM »
Thank you soooo much.... :)

 

anything