0
$\begingroup$

I would like to plot the percentage difference between the following functions:

Q5[x_] := Abs[Re[(1 - x)^(5/2) Hypergeometric2F1[-5/2, 1/2, 3/2, 3 x/(x - 1)]]]
q5[x_] := Series[Q5[x], {x, 0, 3}]

I simply do the following:

error[x_] := Abs[Q5[x] - q5[x]]
Plot[error[x], {x, 0, 2}]

I was hoping to obtain the plot:

enter image description here

$\endgroup$

1 Answer 1

3
$\begingroup$

Since Re and Abs are not differentiable, it is better to find the series expansion before using them. So:

iQ5[x_] := (1 - x)^(5/2) Hypergeometric2F1[-5/2, 1/2, 3/2, 3 x/(x - 1)]
Q5[x_] := Abs @ Re @ iQ5[x]
q5[x_] = Abs @ Re @ Normal @ Series[iQ5[x], {x, 0, 3}]

Abs[1 + Re[(3 x^2)/2 + x^3/7]]

To get the percentage error you need to divide the difference by the expected value and multiply by 100:

percentError[x_] := 100 Abs[Q5[x] - q5[x]]/Q5[x]

Visualization:

Plot[percentError[x], {x, 0, 2}, Exclusions->1]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.