I'm trying to get the Taylor series for this function
Which should be similar to this, considering that d is centered or around rs
However when I try to take the example of @Saullo for my problem,
As you can see the result is eliminating "d" from the series of Taylor, which should not be my goal.
Another additional info about the function in fact is:
I'm doing something wrong ??, is there a way to get my result without deleting "d" ??
Any help is appreciated
The code
Thank you for your response and interest in helping me, here is my code until nowdays @asmeurer
import sympy as sy
#import numpy as np
from sympy import init_printing
init_printing(use_latex=True)
# Define the variable and the function to approximate
z, d, r_s, N_e, r_t, r_s, r_b = sy.symbols('z d r_s N_e r_t r_s r_b')
# Define W_model
def W_model(r_t=r_t, r_b=r_b, r_s=r_s, z=z):
s_model = sy.sqrt(pow(r_t, 2) - pow(r_s*sy.sin(z), 2)) - sy.sqrt(pow(r_b, 2) - pow(r_s*sy.sin(z), 2))
d_model = r_t - r_b
STEC_approx = N_e * s_model
VTEC_approx = N_e * d_model
return STEC_approx/VTEC_approx
f = W_model()
# printing Standard model
f
# Some considerations for modify Standard model
rb = r_s - d/2
rt = r_s + d/2
f = W_model(r_b=rb, r_t=rt, r_s=r_s, z=z)
# printing My model
f
## Finding taylor series aproximmation for W_model
num_of_terms = 2
# creates a generator
taylor_series = f.series(x=d, n=None)
# takes the number of terms desired for your generator
taylor_series = sum([next(taylor_series) for i in range(num_of_terms)])
taylor_series