Size: a a a

Язык программирования Julia / Julia programming language

2020 December 09

A

ABC in Язык программирования Julia / Julia programming language
Andrey Malakhov
Also you redefined x and y in the loop
there are conditions for x and y but the range is between -1 and 1
источник

A

ABC in Язык программирования Julia / Julia programming language
Andrey Malakhov
Your function f returns nothing. What do you want to calculate in fun2?
I should calculate fun2 when x  and y equal 1, the result should be (1+k-j) and I want to put this in the fun2 and so on for other conditions
источник

A

ABC in Язык программирования Julia / Julia programming language
ABC
example:
function f(x,y)
for x =-1:1, y=-1:1, k in 1, j in 0
      if x==1 && y==1
       println("1+$k-$j")
      elseif x==1 && y==-1
       println("1-$k+$j")
end
end
end

How I can put "f(x,y)" into " fun2 = sum(3*fun(x,y))
I should calculate "fun2"

it has error now
Is there any way to calculate this program? I mean, another way to write function and put into sum.
@skoffer
источник

AM

Andrey Malakhov in Язык программирования Julia / Julia programming language
And k and j are always fixed?
источник

A

ABC in Язык программирования Julia / Julia programming language
Andrey Malakhov
And k and j are always fixed?
yea
источник

AM

Andrey Malakhov in Язык программирования Julia / Julia programming language
Or these are parameters?
источник

A

ABC in Язык программирования Julia / Julia programming language
Andrey Malakhov
Or these are parameters?
they have value
источник

AM

Andrey Malakhov in Язык программирования Julia / Julia programming language
So if  x=1 and y=1 then the answer is 1
источник

AM

Andrey Malakhov in Язык программирования Julia / Julia programming language
If x =1 and y = -1 the answer is 0
источник

AM

Andrey Malakhov in Язык программирования Julia / Julia programming language
For any other cases what should it return?
источник

A

ABC in Язык программирования Julia / Julia programming language
Andrey Malakhov
So if  x=1 and y=1 then the answer is 1
just forget this code, that was a typical example. for me is long formula
источник

A

ABC in Язык программирования Julia / Julia programming language
Andrey Malakhov
For any other cases what should it return?
nothing
источник

A

ABC in Язык программирования Julia / Julia programming language
Andrey Malakhov
For any other cases what should it return?
there are no other cases. I just have 1 and -1
источник

АО

Андрей Оськин... in Язык программирования Julia / Julia programming language
Ok, lets start from the beginning.

We have some function f(x, y) which returns some results for different values of x, y is it correct?
источник

A

ABC in Язык программирования Julia / Julia programming language
Андрей Оськин
Ok, lets start from the beginning.

We have some function f(x, y) which returns some results for different values of x, y is it correct?
yeah
источник

АО

Андрей Оськин... in Язык программирования Julia / Julia programming language
Are there any other parameters which can influence the result? Or f(1, 1) is always some fixed value, for example 1?
источник

A

ABC in Язык программирования Julia / Julia programming language
Андрей Оськин
Are there any other parameters which can influence the result? Or f(1, 1) is always some fixed value, for example 1?
I just have x and y that is between -1 and 1
источник

АО

Андрей Оськин... in Язык программирования Julia / Julia programming language
Ok.
Now, you want to sum f(x, y) over some values of x and y, presumably (-1, 1)?
источник

АО

Андрей Оськин... in Язык программирования Julia / Julia programming language
If that is correct, sum(f(x, y) for x in (-1, 1), y in (-1, 1)) can solve the problem?
источник

АО

Андрей Оськин... in Язык программирования Julia / Julia programming language
I am using (-1, 1) here, because -1:1 == [-1, 0, 1] and you said "I just have 1 and -1"
источник