# Using interpolated curve on parametric plot

Hi,

my skills in numerics are very limited, thus maybe this is a silly question. Is it possible, in sage or python, to interpolate a numerical solution of a differential equation and use it as a symbolic expression? Let me explain my problem. I have the following differential equation and numerical solution

z = function('z')(x)
de = diff(z,x) == sqrt(-36*(2*x/sqrt(x^2 + 5) - (x^2 - 1)*x/(x^2 + 5)^(3/2))^2 + (x^2 + 5)/(x^2 - 1)^2)
var('nz')
de_sol = desolve_rk4(de.rhs(),dvar=nz,ics=[0,0],ivar=x,end_points=.93, step=.01)


I would like to use the above solution as z(x) and (at first) plot a parametric surface. For illustrating, I will use z = -log(1-x), that has a similar shape.

th = var('theta')
z = -log(1-x)
r = -6*(x^2 - 1)/sqrt(x^2 + 5)
parametric_plot3d([r*cos(th),r*sin(th),z],(th,0,2*pi), (x,0,.93))


I tried:

• spline: it fits greatly, but the output cannot be used as symbolic. Parametric plot is not allowed.
• lagrange_polynomial: it gives me a polynomial fit that can be used for parametric plot, but the interpolation fails "close" to the divergence at x=1.
• I've tried to follow this post, but 1) I didn't find out how to pass my de_sol to maxima (maxima('p:de_sol') doesn't work) and 2) I don't know how to turn the maxima charfun into sage piecewise. Maxima documentation doesn't help that much.

Any idea?

edit retag close merge delete
{"ft_lang_label":"__label__en","ft_lang_prob":0.82904553,"math_prob":0.99665105,"size":1371,"snap":"2021-04-2021-17","text_gpt3_token_len":427,"char_repetition_ratio":0.095098756,"word_repetition_ratio":0.0,"special_character_ratio":0.32166302,"punctuation_ratio":0.14238411,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9998871,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-04-17T14:40:03Z\",\"WARC-Record-ID\":\"<urn:uuid:134921f6-7dfc-4988-af53-555f466f1955>\",\"Content-Length\":\"49425\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e793135d-e992-44f7-a7f6-7519185bc21d>\",\"WARC-Concurrent-To\":\"<urn:uuid:086eb408-a5dc-4332-8c61-f58fef9293ab>\",\"WARC-IP-Address\":\"194.254.163.53\",\"WARC-Target-URI\":\"http://ask.sagemath.org/question/55581/using-interpolated-curve-on-parametric-plot/\",\"WARC-Payload-Digest\":\"sha1:4UQCG7DZFBXTBQU3PQ6NVZ4G47HKU7TA\",\"WARC-Block-Digest\":\"sha1:6FO5VVORAPYLSN6HGDOKR6LGMHKP4XGW\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-17/CC-MAIN-2021-17_segments_1618038460648.48_warc_CC-MAIN-20210417132441-20210417162441-00299.warc.gz\"}"}