[Gambas-user] Math Operation

cheikh diabang cheikhdiabang at ...67...
Thu May 4 12:24:34 CEST 2017


Thank Tobias its working well. But Return the tree values have problem whit mark","

The last change is below

Function calcul_coefficients(x As Integer, y As Integer, degre As Integer) As Float
  'Dim ak As Float
  Dim a As Float
  Dim b As Float
  Dim c As Float
  Dim nbr_coef As Integer
  Dim k As Integer

  nbr_coef = degre + 1
  For k = 0 To degre
    If k == 0
    'ak = (nbr_coef ^ k * ((x ^ (2(1 / (k + 1)))) * y) - (x * (y * (x ^ (- (k - 1)))))) / ((nbr_coef * x ^ 2) - ((x) ^ 2))
      c = (nbr_coef ^ k * ((x ^ (2 * (1 / (k + 1)))) * y) - (x * (y * (x ^ (- (k - 1)))))) / ((nbr_coef * x ^ 2) - (x ^ 2))
    Else If k == 1
      b = ((nbr_coef ^ k) * ((x ^ (2 * (1 / (k + 1)))) * y) - (x * (y * (x ^ (- (k - 1)))))) / ((nbr_coef * x ^ 2) - (x ^ 2))
    Else If k == 2
      a = ((nbr_coef ^ k) * ((x ^ (2 * (1 / (k + 1)))) * y) - (x * (y * (x ^ (- (k - 1)))))) / ((nbr_coef * x ^ 2) - (x ^ 2))
    Else
     Message.Info("unavalaible coefficients")
    Endif
  Next
   Return a, b, c;
End



________________________________
De : Tobias Boege <taboege at ...626...>
Envoyé : jeudi 4 mai 2017 10:13
À : mailing list for gambas users
Objet : Re: [Gambas-user] Math Operation

On Thu, 04 May 2017, cheikh diabang wrote:
> hello. i have write this code below on gambas 3.9.2 and when i run that, he indique syntaxe error
>
>
> Function calcul_coefficients(x As Integer, y As Integer, degre As Integer) As Float
>   'Dim ak As Float
>   Dim a As Float
>   Dim b As Float
>   Dim c As Float
>   Dim nbr_coef As Integer
>   Dim k As Integer
>
>   nbr_coef = degre + 1
>    For k = 0 To degre
>     If k == 0
>     'ak = (nbr_coef ^ k * ((x ^ (2(1 / (k + 1)))) * y) - (x * (y * (x ^ (- (k - 1)))))) / ((nbr_coef * x ^ 2) - ((x) ^ 2))
>       c = (nbr_coef ^ k * ((x ^ (2(1 / (k + 1)))) * y) - (x * (y * (x ^ (- (k - 1)))))) / ((nbr_coef * x ^ 2) - ((x) ^ 2))
>     Else If k == 1
>       b = ((nbr_coef ^ k) * ((x ^ (2(1 / (k + 1)))) * y) - (x * (y * (x ^ (- (k - 1)))))) / ((nbr_coef * x ^ 2) - ((x) ^ 2))
>     Else If k == 2
>       a = ((nbr_coef ^ k) * ((x ^ (2(1 / (k + 1)))) * y) - (x * (y * (x ^ (- (k - 1)))))) / ((nbr_coef * x ^ 2) - ((x) ^ 2))
>     Else
>       Message.Info("unavalaible coefficients")
>    Next
>    Return a, b, c
> End
>
>
> But i see nothing as error. I need help please

Look closer:

>       a = ((nbr_coef ^ k) * ((x ^ (2(1 / (k + 1)))) * y) - (x * (y * (x ^ (- (k - 1)))))) / ((nbr_coef * x ^ 2) - ((x) ^ 2))
>       2(1 / (k + 1))

Since "2" is not a function, you have to write

  2*(1 / (k + 1))

Regards,
Tobi

--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
Gambas-user Info Page - lists.sourceforge.net<https://lists.sourceforge.net/lists/listinfo/gambas-user>
lists.sourceforge.net
To see the collection of prior postings to the list, visit the Gambas-user Archives. Using Gambas-user: To post a message to all the list members ...





More information about the User mailing list