# Starting Julia with a few tasks

**URL:** <https://discourse.julialang.org/t/starting-julia-with-a-few-tasks/95583>\
**Category:** New to Julia\
**Created:** [March 5, 2023, 6:16pm UTC](https://discourse.julialang.org/t/starting-julia-with-a-few-tasks/95583 "2023-03-05T18:16:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GuyFromBosnia](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@GuyFromBosnia](https://discourse.julialang.org/u/GuyFromBosnia)\
**Post date:** [March 5, 2023, 6:16pm UTC](https://discourse.julialang.org/t/starting-julia-with-a-few-tasks/95583/1 "2023-03-05T18:16:36Z")

</div>

I need to do two tasks in Julia but I am so new that I can barely open Julia. I am using Julia in the numerical analysis course on my collage so I was hoping that I can get some help here. Here are the tasks:

 ![Numerical](https://global.discourse-cdn.com/julialang/original/3X/4/5/4572ca3d6b517fd30472d33ed2a66cbaed284534.jpeg)

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [March 5, 2023, 6:27pm UTC](https://discourse.julialang.org/t/starting-julia-with-a-few-tasks/95583/2 "2023-03-05T18:27:21Z")

</div>

I am certain that you can get some help, but this post is much closer to asking someone to do your homework for you.

You are much more likely to get the help you need if you show that you’ve put in some work and show where you’re stuck. Have a look at [this post](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757).

What have you tried? What are you encountering that’s different than you expect?

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [March 6, 2023, 2:02am UTC](https://discourse.julialang.org/t/starting-julia-with-a-few-tasks/95583/3 "2023-03-06T02:02:59Z")

</div>

How about telling us some basic Information

- What computer are you using? PC or Mac
- What Operating System are you using? Windows, Macos or Linux
- Where is Julia located? On PC or in a different web site
- What version of Julia are you using?

---

<div class="post-metadata">

**Author:** ![GuyFromBosnia](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@GuyFromBosnia](https://discourse.julialang.org/u/GuyFromBosnia)\
**Post date:** [March 8, 2023, 4:06pm UTC](https://discourse.julialang.org/t/starting-julia-with-a-few-tasks/95583/4 "2023-03-08T16:06:39Z")

</div>

function f(u)  
x, y, z, λ = u[1], u[2], u[3], u[4]  
return [(x^2)/25 + (y^2)/16 + (z^2)/9 - 1,z - 3 - (λ_z)/9,y - 4 - (λ_y)/16,x - 5 - (λ\*x)/25] #input vector u  
end

function find\_jacobian\_matrix(f, x, epsilon)  
n = length(x) # stores the length of input vector (4)  
J = zeros(n, n) # create the n_n matrix  
for j in 1:n # iterate over each column (4 times)  
ei = zeros(n) # create a vector of zeroes  
ei[j] = 1 # set the ei vector to 1  
J[:, j] = (f(x + epsilon_ei) - f(x)) / epsilon #assign the partial derivative of equations to jth column using the formula  
end  
return J  
end

# initial guess

x0 = [1.0, 1.0, 1.0, 1.0]

# set the inital value for epsilon

epsilon = 1e-6

# call the function

J = find\_jacobian\_matrix(f, x0, epsilon)  
so this is my code for now I managed to do the Jacobian matrix but for some reason I am struggling with Newton’s method to find the root of the system. I am getting an error norm not defined.This is my newton method:

function newton(F, J, u0, tol=1e-8, maxiter=100)  
u = copy(u0)  
for i = 1:maxiter  
du = - J \ F(u)  
u += du  
if norm(du) \< tol  
return u  
end  
end  
error(“newton: maximum number of iterations exceeded”)  
end

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [March 8, 2023, 4:13pm UTC](https://discourse.julialang.org/t/starting-julia-with-a-few-tasks/95583/5 "2023-03-08T16:13:26Z")

</div>

Make sure to format your code with triple backticks ````` to make it legible.

`norm` is defined in the `LinearAlgebra` standard library, so you need `using LinearAlgebra` before you call it.

```julia
julia> norm(rand(5))
ERROR: UndefVarError: norm not defined
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1      

julia> using LinearAlgebra; norm(rand(5))
1.4760888195235669

```

---

<div class="post-metadata">

**Author:** ![GuyFromBosnia](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@GuyFromBosnia](https://discourse.julialang.org/u/GuyFromBosnia)\
**Post date:** [March 8, 2023, 6:05pm UTC](https://discourse.julialang.org/t/starting-julia-with-a-few-tasks/95583/6 "2023-03-08T18:05:09Z")

</div>

Got it it works now thank you
