juliataylor-series

Cannot convert Taylor1{Float64} to series data for plotting Julia


I want to ask how do I get the value from the First-order Taylor Approximation since I want to use its value in the plot.

So I have an array of

jump_value = [-945.0, -287.55589538221216, 19.122751150095354, 113.22912169505338, 96.60890174423561, 39.60661306353262, -14.088053425973683, -42.593904767135726, -40.99191308586612, -16.478882710263225, 16.47888271026317, 40.991913085866095, 42.59390476713573, 14.088053425973682, -39.60661306353257, -96.60890174423555, -113.2291216950534, -19.122751150095276, 287.5558953822114, 945.0]

The elements in the array represents y from x = 0 to x = 10 on 2 dimensions graph.

However, I want to convert the above values to first-order Taylor Approximation.
I tried to use the function TaylorSeries to get the value, but it seems that it only gives the formula function. So how do I get the value of first-order Taylor Approximation from the array above?

using TaylorSeries

first_order = Taylor1(jump_value, 1)
println(first_order)

plot(0:jump_interval:10, first_order , 
    xlabel = "X value", ylabel = "Y value",  title = "Freg we love you!",
    linecolor = :black,
    linewidth = 3,
    legend = :bottomright,
    markershape = :circle,
    label = "Childhood")

Thanks for anyone reply in advance.


Solution

  • Not familiar with this package, but the docs say that Taylor1 instances can be called to calculate values, so try plot(0:jump_interval:10, first_order.(0:jump_interval:10) ,