Thank you for the reply, I answered to Robert Dodier earlier, but it seems that in my noviceness in using mailing lists, it didn't show up there. I'll be sending it again, this time properly(?). Here's the body text as it appears in my sent mail:
------------------------------------------------------------
> > First, I tried the direct approach, with
> solve(k=elliptic_kc(t2_)/elliptic_kc(t2),ws),
> > but I got this in return:
> elliptic_kc((ws^2-1)/ws^2)=elliptic_kc(1/ws^2)*k
> > -- not helpful.
>
> Maxima's solve function is pretty weak. In particular it
> can't solve
> equations with elliptic functions.
>
> My advice on this point is to approximate the function to
> be solved
> and then solve k = (approximate function).
> Or perhaps approximate the inverse of the function and
> evaluate it
> at k.
>
> elliptic_kc(t2_)/elliptic_kc(t2) seems to be pretty
> well-behaved.
> Maybe you can approximate it with a rational function.
> I don't know much about that. You could probably try a
> Taylor
> series if you can stay away from the edges.
>
> > The results were the expected ones _except_ one:
> K1_=157.445 (result
> > of integration) instead of 5.99391 (value given by
> elliptic_kc(t1_)).
> > I then thought to install Scilab and make a
> comparison. I use Ubuntu
> > 10.04 x86_64, installed, ran this:
> >
> >
> K1_=integrate('1/sqrt(1-t1_^2*sin(phi)^2)','phi',0,%pi/2)
> > K1_=5.9939133
> >
> > Then I thought I would verify the error and did this:
> >
> > K1_=integrate('1/sqrt(1-t1_^2)','phi',0,%pi/2)
> > K1_=157.44518
> >
> > which is a confirmation to me.
>
> I;m kind of confused about this. If you can clarify and
> simplify the
> erroneous output and post a bug report about, that would be
> helpful.
> See: http://sourceforge.net/projects/maxima/bugs
>
> Sorry I can't be more helpful.
>
> Robert Dodier
>
Thank you for the reply. I was going to write that I managed to find the solution last night, the way you just said: with the nome q and approximations:
q1:%e^(-%pi*K1_/K1);
q:(q1^(1/N));
ws:1/4/( sum( q^((i+1/2)^2),i,0,n )/(1+2*sum( q^(j^2),j,1,n )) )^2$
where n can be 2 for at least 5 digits precision. Sold! Also, Taylor expansion works on elliptic functions, but not always, for example elliptic_f(%i/x,k) only works nicely around x for x=/=1, which results in the first term an being elliptic integral; if I want to set x=0, it can't be done, unless I am related to Mr. Norris. But, the important thing is that it worked.
As for the solving of the integral, that was a horrible beginner's mistake, replacing sin(x) with sin(%pi/2), like that. However, in the meantime, I found out that there is a "quad_qags", which works like a charm. Test the following to see what I mean (if you don't, already):
k:0.5$
float(integrate(1/sqrt(1-k^2*sin(x)^2),x,0,%pi/2));
float(quad_qags(1/sqrt(1-k^2*sin(x)^2),x,0,%pi/2));
Also, "quad_qags" gives the same result as scilab, which is expected.
Thank you again,
Vlad.
-------------------------------------------------------------------