# Polynomial problem-help me please

**URL:** <https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195>\
**Category:** New to Julia\
**Tags:** question, homework\
**Created:** [October 19, 2023, 6:10pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195 "2023-10-19T18:10:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![condor98](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/condor98/32/202607_2.png) [@condor98](https://discourse.julialang.org/u/condor98)\
**Post date:** [October 19, 2023, 6:10pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195/1 "2023-10-19T18:10:09Z")

</div>

this post is deleted for nother topic

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [October 19, 2023, 6:21pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195/2 "2023-10-19T18:21:48Z")

</div>

You probably want to use either Interpolations.jl or Data Interpolations.jl here. Maybe even BSplineKit.jl

It would be helpful to show us what your student has tried up to now.

---

<div class="post-metadata">

**Author:** ![condor98](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/condor98/32/202607_2.png) [@condor98](https://discourse.julialang.org/u/condor98)\
**Post date:** [October 19, 2023, 6:29pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195/3 "2023-10-19T18:29:03Z")

</div>

this post is deleted for another topic

---

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [October 19, 2023, 6:33pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195/4 "2023-10-19T18:33:47Z")

</div>

I would recommend your student come here directly - he or she will find the community here very helpful and welcoming. Here’s one solution with Polynomials.jl:

```julia
using Plots
using Polynomials

M = [148 61
151 58
150 64
168 65
160 55
162 57
188 100
193 91
141 46
184 85
192 112
176 77
183 83
172 64
178 100
181 92
181 86
175 88
194 88];

xs = Float64.(M[:, 1])
ys = Float64.(M[:, 2])
fits = [fit(xs, ys, o) for o ∈ (2,4,6,8,12,18)]
o2 = scatter(xs, ys)
plot!(o2, fits[1], extrema(xs)..., legend=false, title="Order 2")
o4 = scatter(xs, ys)
plot!(o4, fits[2], extrema(xs)..., legend=false, title="Order 4")
o6 = scatter(xs, ys)
plot!(o6, fits[3], extrema(xs)..., legend=false, title="Order 6")
o8 = scatter(xs, ys)
plot!(o8, fits[4], extrema(xs)..., legend=false, title="Order 8")
o12 = scatter(xs, ys)
plot!(o12, fits[5], extrema(xs)..., legend=false, title="Order 12")
o18 = scatter(xs, ys)
plot!(o18, fits[6], extrema(xs)..., legend=false, title="Order 18")
plot(o2,o4,o6,o8,o12,o18)

```

![image](https://global.discourse-cdn.com/julialang/original/3X/7/9/797bb224921fab9f24cd4522833b541e2dc6897f.png)

I’m not sure what’s going on with the last one…I’m getting NaNs in the result of the fitted polynomial…that would be something to explore further and potentially seek help here on Discourse for.

---

<div class="post-metadata">

**Author:** ![condor98](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/condor98/32/202607_2.png) [@condor98](https://discourse.julialang.org/u/condor98)\
**Post date:** [October 19, 2023, 6:55pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195/5 "2023-10-19T18:55:43Z")

</div>

the teacher want the code how i write.

what i need fix for do the line how i send you the picture before.

 ![Screenshot 2023-10-19 alle 21.54.30](https://global.discourse-cdn.com/julialang/original/3X/f/b/fb6688d3ec289dd6662fbf00ca0483cd2a116ef8.jpeg)  
.

---

<div class="post-metadata">

**Author:** ![ElOceanografo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eloceanografo/32/624_2.png) [@ElOceanografo](https://discourse.julialang.org/u/ElOceanografo)\
**Post date:** [October 19, 2023, 7:16pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195/6 "2023-10-19T19:16:02Z")

</div>

I count 19 datapoints, so 18 polynomial terms plus one intercept means no more degrees of freedom?

---

<div class="post-metadata">

**Author:** ![gvdr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gvdr/32/6387_2.png) [@gvdr](https://discourse.julialang.org/u/gvdr)\
**Post date:** [October 19, 2023, 7:51pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195/7 "2023-10-19T19:51:26Z")

</div>

Just out of curiosity, as an Italian academic living abroad: who’s using Julia in university teaching in Italy? Would like to connect

---

<div class="post-metadata">

**Author:** ![condor98](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/condor98/32/202607_2.png) [@condor98](https://discourse.julialang.org/u/condor98)\
**Post date:** [October 19, 2023, 7:55pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195/8 "2023-10-19T19:55:07Z")

</div>

University of Pisa

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [October 19, 2023, 9:43pm UTC](https://discourse.julialang.org/t/polynomial-problem-help-me-please/105195/9 "2023-10-19T21:43:44Z")

</div>

You may also want to check with your mentee if the prof or institution have a policy about asking for help online — it’s not uncommon for professors to be active here (anyone wanna find the post from the time that a prof dropped in on a student’s thread? :)).

We don’t explicitly prohibit asking for homework help here, but we do ask that you take time to format your posts and present what you’ve tried in a readable manner:

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …
