# Functions with two variables

Is there any way I can easily plot this function with two variables in Julia? I need some guidance, please.

Are you looking for a 3D plot? Here’s how to do it in Plots.jl:

https://docs.juliaplots.org/stable/gallery/gr/generated/gr-ref24/#gr_demo_24

Basically just define some ranges x and y for which you want to evaluate your function, and then do f.(x, y) to get the function outputs then you can plot(x, y, f.(x, y)

How do I write the code so that the Right hand sides will multiply each other?. Thus the term in the square root will multiply the term by it. Could you please give me a sample? I will appreciate it if you could please help me code this also using any range of values of x and y. Thank you.

Sorry I don’t understand the question. What do you mean by “Right hand sides will multiply each other”?

I actually was going to include an example of plotting your function initially but then realised I didn’t actually understand what your notation means. If the \binom{x}{y} at the end is supposed to indicate a binomial coefficient, your function might be

∂f(x, y) = √( x^2 + y^2 ) * binomial(x, y)


here I’ve omitted the minus signs in front of x and y, given the numbers are squared anyway).

I suppose that your notation doesn’t actually reference binomial coefficients though given they are only defined for positive integers and you are subtracting decimal numbers in your second equation, which tells me I don’t know what your notation means.

Ranges in Julia can be created with the colon operator. 1:10 will create a range of integers from 1 to 10, while 1:0.1:5 will create the set of numbers 1, 1.1, 1.2, …, 4.9, 5.

This is a function multiplying a vector, correct? Not a binomial.
\partial f(x,y) = (x^2 + y^2) * [x;y] should give you the function you’re looking for.
the
plot(x,y,f.(x,y) as mentioned above and in the link