Quantcast

Math Operation

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Math Operation

cheikh diabang
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
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

Tobias Boege-2
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

cheikh diabang
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 <[hidden email]>
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
[hidden email]
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 ...


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

jsbsan
In reply to this post by Tobias Boege-2
cheikh diabang:

In addition if you are going to return several float values, you should put
float[]...

Function calcul_coefficients(x As Integer, y As Integer, degre As Integer)
As Float[]

....
Dim ArrayABC as new float[]
....
.....
ArrayABC.add(A)
ArrayABC.add(B)
ArrayABC.add(C)

Return ArrayABC



Regards,

Julio

2017-05-04 12:13 GMT+02:00 Tobias Boege <[hidden email]>:

> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

cheikh diabang
Thank you very much Julio Sanchez 😊. Its working fine


________________________________
De : Julio Sanchez <[hidden email]>
Envoyé : jeudi 4 mai 2017 10:30
À : mailing list for gambas users
Objet : Re: [Gambas-user] Math Operation

cheikh diabang:

In addition if you are going to return several float values, you should put
float[]...

Function calcul_coefficients(x As Integer, y As Integer, degre As Integer)
As Float[]

....
Dim ArrayABC as new float[]
....
.....
ArrayABC.add(A)
ArrayABC.add(B)
ArrayABC.add(C)

Return ArrayABC



Regards,

Julio

2017-05-04 12:13 GMT+02:00 Tobias Boege <[hidden email]>:

> 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
> [hidden email]
> 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 ...


>
------------------------------------------------------------------------------
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
[hidden email]
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 ...


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

cheikh diabang
Hi ! i wanna know how recover return value of function in my case.

I do that as below, but he said object expected

 calcul_coefficients(j, iy_v_c_w, 2)
                               coeff_v_c_w_0 = calcul_coefficients[2]
                               coeff_v_c_w_1 = calcul_coefficients[1]
                               coeff_v_c_w_2 = calcul_coefficients[0]

Thank for help.

________________________________
De : cheikh diabang <[hidden email]>
Envoyé : jeudi 4 mai 2017 10:42
À : mailing list for gambas users
Objet : Re: [Gambas-user] Math Operation

Thank you very much Julio Sanchez 😊. Its working fine


________________________________
De : Julio Sanchez <[hidden email]>
Envoyé : jeudi 4 mai 2017 10:30
À : mailing list for gambas users
Objet : Re: [Gambas-user] Math Operation

cheikh diabang:

In addition if you are going to return several float values, you should put
float[]...

Function calcul_coefficients(x As Integer, y As Integer, degre As Integer)
As Float[]

....
Dim ArrayABC as new float[]
....
.....
ArrayABC.add(A)
ArrayABC.add(B)
ArrayABC.add(C)

Return ArrayABC



Regards,

Julio

2017-05-04 12:13 GMT+02:00 Tobias Boege <[hidden email]>:

> 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
> [hidden email]
> 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 ...


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 ...


>
------------------------------------------------------------------------------
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
[hidden email]
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 ...


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 ...


------------------------------------------------------------------------------
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
[hidden email]
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 ...


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

Jussi Lahtinen
Declare the function as:

Function calcul_coefficients(x As Integer, y As Integer, degre As Integer)
As Float[]

Then return the answer as (this is for convenience as copy returns new
object instance):

Return [a, b, c].Copy()




Jussi

On Thu, May 4, 2017 at 5:41 PM, cheikh diabang <[hidden email]>
wrote:

> Hi ! i wanna know how recover return value of function in my case.
>
> I do that as below, but he said object expected
>
>  calcul_coefficients(j, iy_v_c_w, 2)
>                                coeff_v_c_w_0 = calcul_coefficients[2]
>                                coeff_v_c_w_1 = calcul_coefficients[1]
>                                coeff_v_c_w_2 = calcul_coefficients[0]
>
> Thank for help.
>
> ________________________________
> De : cheikh diabang <[hidden email]>
> Envoyé : jeudi 4 mai 2017 10:42
> À : mailing list for gambas users
> Objet : Re: [Gambas-user] Math Operation
>
> Thank you very much Julio Sanchez 😊. Its working fine
>
>
> ________________________________
> De : Julio Sanchez <[hidden email]>
> Envoyé : jeudi 4 mai 2017 10:30
> À : mailing list for gambas users
> Objet : Re: [Gambas-user] Math Operation
>
> cheikh diabang:
>
> In addition if you are going to return several float values, you should put
> float[]...
>
> Function calcul_coefficients(x As Integer, y As Integer, degre As Integer)
> As Float[]
>
> ....
> Dim ArrayABC as new float[]
> ....
> .....
> ArrayABC.add(A)
> ArrayABC.add(B)
> ArrayABC.add(C)
>
> Return ArrayABC
>
>
>
> Regards,
>
> Julio
>
> 2017-05-04 12:13 GMT+02:00 Tobias Boege <[hidden email]>:
>
> > 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
> > [hidden email]
> > 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 ...
>
>
> 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 ...
>
>
> >
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> 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 ...
>
>
> 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 ...
>
>
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> 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 ...
>
>
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

cheikh diabang
I think the copy is not necessary. I want just access in one element on return array. Thank for your help


________________________________
De : Jussi Lahtinen <[hidden email]>
Envoyé : jeudi 4 mai 2017 15:12
À : mailing list for gambas users
Objet : Re: [Gambas-user] Math Operation

Declare the function as:

Function calcul_coefficients(x As Integer, y As Integer, degre As Integer)
As Float[]

Then return the answer as (this is for convenience as copy returns new
object instance):

Return [a, b, c].Copy()




Jussi

On Thu, May 4, 2017 at 5:41 PM, cheikh diabang <[hidden email]>
wrote:

> Hi ! i wanna know how recover return value of function in my case.
>
> I do that as below, but he said object expected
>
>  calcul_coefficients(j, iy_v_c_w, 2)
>                                coeff_v_c_w_0 = calcul_coefficients[2]
>                                coeff_v_c_w_1 = calcul_coefficients[1]
>                                coeff_v_c_w_2 = calcul_coefficients[0]
>
> Thank for help.
>
> ________________________________
> De : cheikh diabang <[hidden email]>
> Envoyé : jeudi 4 mai 2017 10:42
> À : mailing list for gambas users
> Objet : Re: [Gambas-user] Math Operation
>
> Thank you very much Julio Sanchez 😊. Its working fine
>
>
> ________________________________
> De : Julio Sanchez <[hidden email]>
> Envoyé : jeudi 4 mai 2017 10:30
> À : mailing list for gambas users
> Objet : Re: [Gambas-user] Math Operation
>
> cheikh diabang:
>
> In addition if you are going to return several float values, you should put
> float[]...
>
> Function calcul_coefficients(x As Integer, y As Integer, degre As Integer)
> As Float[]
>
> ....
> Dim ArrayABC as new float[]
> ....
> .....
> ArrayABC.add(A)
> ArrayABC.add(B)
> ArrayABC.add(C)
>
> Return ArrayABC
>
>
>
> Regards,
>
> Julio
>
> 2017-05-04 12:13 GMT+02:00 Tobias Boege <[hidden email]>:
>
> > 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
> > [hidden email]
> > 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 ...


> 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 ...
>
>
> 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 ...
>
>
> >
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> 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 ...


> 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 ...
>
>
> 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 ...
>
>
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> 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 ...


> 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 ...
>
>
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> 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 ...


>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

Fabien Bodard-4
yes the copy function is not necessary in this case as [a,b,c] return
a new instance on each call

2017-05-04 17:21 GMT+02:00 cheikh diabang <[hidden email]>:

> I think the copy is not necessary. I want just access in one element on return array. Thank for your help
>
>
> ________________________________
> De : Jussi Lahtinen <[hidden email]>
> Envoyé : jeudi 4 mai 2017 15:12
> À : mailing list for gambas users
> Objet : Re: [Gambas-user] Math Operation
>
> Declare the function as:
>
> Function calcul_coefficients(x As Integer, y As Integer, degre As Integer)
> As Float[]
>
> Then return the answer as (this is for convenience as copy returns new
> object instance):
>
> Return [a, b, c].Copy()
>
>
>
>
> Jussi
>
> On Thu, May 4, 2017 at 5:41 PM, cheikh diabang <[hidden email]>
> wrote:
>
>> Hi ! i wanna know how recover return value of function in my case.
>>
>> I do that as below, but he said object expected
>>
>>  calcul_coefficients(j, iy_v_c_w, 2)
>>                                coeff_v_c_w_0 = calcul_coefficients[2]
>>                                coeff_v_c_w_1 = calcul_coefficients[1]
>>                                coeff_v_c_w_2 = calcul_coefficients[0]
>>
>> Thank for help.
>>
>> ________________________________
>> De : cheikh diabang <[hidden email]>
>> Envoyé : jeudi 4 mai 2017 10:42
>> À : mailing list for gambas users
>> Objet : Re: [Gambas-user] Math Operation
>>
>> Thank you very much Julio Sanchez 😊. Its working fine
>>
>>
>> ________________________________
>> De : Julio Sanchez <[hidden email]>
>> Envoyé : jeudi 4 mai 2017 10:30
>> À : mailing list for gambas users
>> Objet : Re: [Gambas-user] Math Operation
>>
>> cheikh diabang:
>>
>> In addition if you are going to return several float values, you should put
>> float[]...
>>
>> Function calcul_coefficients(x As Integer, y As Integer, degre As Integer)
>> As Float[]
>>
>> ....
>> Dim ArrayABC as new float[]
>> ....
>> .....
>> ArrayABC.add(A)
>> ArrayABC.add(B)
>> ArrayABC.add(C)
>>
>> Return ArrayABC
>>
>>
>>
>> Regards,
>>
>> Julio
>>
>> 2017-05-04 12:13 GMT+02:00 Tobias Boege <[hidden email]>:
>>
>> > 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
>> > [hidden email]
>> > 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 ...
>
>
>> 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 ...
>>
>>
>> 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 ...
>>
>>
>> >
>> ------------------------------------------------------------
>> ------------------
>> 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
>> [hidden email]
>> 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 ...
>
>
>> 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 ...
>>
>>
>> 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 ...
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> 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
>> [hidden email]
>> 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 ...
>
>
>> 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 ...
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> 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
>> [hidden email]
>> 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 ...
>
>
>>
> ------------------------------------------------------------------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> ------------------------------------------------------------------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user



--
Fabien Bodard

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

Jussi Lahtinen
Ah, of course...


Jussi

On Fri, May 5, 2017 at 9:57 AM, Fabien Bodard <[hidden email]> wrote:

> yes the copy function is not necessary in this case as [a,b,c] return
> a new instance on each call
>
> 2017-05-04 17:21 GMT+02:00 cheikh diabang <[hidden email]>:
> > I think the copy is not necessary. I want just access in one element on
> return array. Thank for your help
> >
> >
> > ________________________________
> > De : Jussi Lahtinen <[hidden email]>
> > Envoyé : jeudi 4 mai 2017 15:12
> > À : mailing list for gambas users
> > Objet : Re: [Gambas-user] Math Operation
> >
> > Declare the function as:
> >
> > Function calcul_coefficients(x As Integer, y As Integer, degre As
> Integer)
> > As Float[]
> >
> > Then return the answer as (this is for convenience as copy returns new
> > object instance):
> >
> > Return [a, b, c].Copy()
> >
> >
> >
> >
> > Jussi
> >
> > On Thu, May 4, 2017 at 5:41 PM, cheikh diabang <
> [hidden email]>
> > wrote:
> >
> >> Hi ! i wanna know how recover return value of function in my case.
> >>
> >> I do that as below, but he said object expected
> >>
> >>  calcul_coefficients(j, iy_v_c_w, 2)
> >>                                coeff_v_c_w_0 = calcul_coefficients[2]
> >>                                coeff_v_c_w_1 = calcul_coefficients[1]
> >>                                coeff_v_c_w_2 = calcul_coefficients[0]
> >>
> >> Thank for help.
> >>
> >> ________________________________
> >> De : cheikh diabang <[hidden email]>
> >> Envoyé : jeudi 4 mai 2017 10:42
> >> À : mailing list for gambas users
> >> Objet : Re: [Gambas-user] Math Operation
> >>
> >> Thank you very much Julio Sanchez 😊. Its working fine
> >>
> >>
> >> ________________________________
> >> De : Julio Sanchez <[hidden email]>
> >> Envoyé : jeudi 4 mai 2017 10:30
> >> À : mailing list for gambas users
> >> Objet : Re: [Gambas-user] Math Operation
> >>
> >> cheikh diabang:
> >>
> >> In addition if you are going to return several float values, you should
> put
> >> float[]...
> >>
> >> Function calcul_coefficients(x As Integer, y As Integer, degre As
> Integer)
> >> As Float[]
> >>
> >> ....
> >> Dim ArrayABC as new float[]
> >> ....
> >> .....
> >> ArrayABC.add(A)
> >> ArrayABC.add(B)
> >> ArrayABC.add(C)
> >>
> >> Return ArrayABC
> >>
> >>
> >>
> >> Regards,
> >>
> >> Julio
> >>
> >> 2017-05-04 12:13 GMT+02:00 Tobias Boege <[hidden email]>:
> >>
> >> > 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
> >> > [hidden email]
> >> > 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 ...
> >
> >
> >> 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
> ...
> >>
> >>
> >> 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
> ...
> >>
> >>
> >> >
> >> ------------------------------------------------------------
> >> ------------------
> >> 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
> >> [hidden email]
> >> 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 ...
> >
> >
> >> 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
> ...
> >>
> >>
> >> 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
> ...
> >>
> >>
> >> ------------------------------------------------------------
> >> ------------------
> >> 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
> >> [hidden email]
> >> 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 ...
> >
> >
> >> 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
> ...
> >>
> >>
> >> ------------------------------------------------------------
> >> ------------------
> >> 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
> >> [hidden email]
> >> 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 ...
> >
> >
> >>
> > ------------------------------------------------------------
> ------------------
> > 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
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > ------------------------------------------------------------
> ------------------
> > 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
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard
>
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math Operation

cheikh diabang
okey, thank you. i have found how to do that. look at below.


 Dim get_coef As Float[]


 get_coef = calcul_coefficients(j, iy_v_c_w, 2)

                               coeff_v_c_w_0 = get_coef[2]
                               coeff_v_c_w_1 = get_coef[1]
                               coeff_v_c_w_2 = get_coef[0]

Thank you very much 😊😊 😊


________________________________
De : Jussi Lahtinen <[hidden email]>
Envoyé : vendredi 5 mai 2017 12:43
À : mailing list for gambas users
Objet : Re: [Gambas-user] Math Operation

Ah, of course...


Jussi

On Fri, May 5, 2017 at 9:57 AM, Fabien Bodard <[hidden email]> wrote:

> yes the copy function is not necessary in this case as [a,b,c] return
> a new instance on each call
>
> 2017-05-04 17:21 GMT+02:00 cheikh diabang <[hidden email]>:
> > I think the copy is not necessary. I want just access in one element on
> return array. Thank for your help
> >
> >
> > ________________________________
> > De : Jussi Lahtinen <[hidden email]>
> > Envoyé : jeudi 4 mai 2017 15:12
> > À : mailing list for gambas users
> > Objet : Re: [Gambas-user] Math Operation
> >
> > Declare the function as:
> >
> > Function calcul_coefficients(x As Integer, y As Integer, degre As
> Integer)
> > As Float[]
> >
> > Then return the answer as (this is for convenience as copy returns new
> > object instance):
> >
> > Return [a, b, c].Copy()
> >
> >
> >
> >
> > Jussi
> >
> > On Thu, May 4, 2017 at 5:41 PM, cheikh diabang <
> [hidden email]>
> > wrote:
> >
> >> Hi ! i wanna know how recover return value of function in my case.
> >>
> >> I do that as below, but he said object expected
> >>
> >>  calcul_coefficients(j, iy_v_c_w, 2)
> >>                                coeff_v_c_w_0 = calcul_coefficients[2]
> >>                                coeff_v_c_w_1 = calcul_coefficients[1]
> >>                                coeff_v_c_w_2 = calcul_coefficients[0]
> >>
> >> Thank for help.
> >>
> >> ________________________________
> >> De : cheikh diabang <[hidden email]>
> >> Envoyé : jeudi 4 mai 2017 10:42
> >> À : mailing list for gambas users
> >> Objet : Re: [Gambas-user] Math Operation
> >>
> >> Thank you very much Julio Sanchez 😊. Its working fine
> >>
> >>
> >> ________________________________
> >> De : Julio Sanchez <[hidden email]>
> >> Envoyé : jeudi 4 mai 2017 10:30
> >> À : mailing list for gambas users
> >> Objet : Re: [Gambas-user] Math Operation
> >>
> >> cheikh diabang:
> >>
> >> In addition if you are going to return several float values, you should
> put
> >> float[]...
> >>
> >> Function calcul_coefficients(x As Integer, y As Integer, degre As
> Integer)
> >> As Float[]
> >>
> >> ....
> >> Dim ArrayABC as new float[]
> >> ....
> >> .....
> >> ArrayABC.add(A)
> >> ArrayABC.add(B)
> >> ArrayABC.add(C)
> >>
> >> Return ArrayABC
> >>
> >>
> >>
> >> Regards,
> >>
> >> Julio
> >>
> >> 2017-05-04 12:13 GMT+02:00 Tobias Boege <[hidden email]>:
> >>
> >> > 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
> >> > [hidden email]
> >> > 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 ...


> > 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 ...
> >
> >
> >> 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
> ...
> >>
> >>
> >> 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
> ...
> >>
> >>
> >> >
> >> ------------------------------------------------------------
> >> ------------------
> >> 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
> >> [hidden email]
> >> 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 ...


> > 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 ...
> >
> >
> >> 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
> ...
> >>
> >>
> >> 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
> ...
> >>
> >>
> >> ------------------------------------------------------------
> >> ------------------
> >> 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
> >> [hidden email]
> >> 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 ...


> > 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 ...
> >
> >
> >> 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
> ...
> >>
> >>
> >> ------------------------------------------------------------
> >> ------------------
> >> 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
> >> [hidden email]
> >> 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 ...


> > 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 ...
> >
> >
> >>
> > ------------------------------------------------------------
> ------------------
> > 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
> > [hidden email]
> > 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 ...


> > ------------------------------------------------------------
> ------------------
> > 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
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard
>
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...