[SciPy-User] Help coding some math i have little understanding of

David Mikolas david.mikolas1 at gmail.com
Mon Dec 7 00:30:42 EST 2020


@ashwin's advice is excellent! I would say just delete that Stack Overflow
question. That it remains open and not down voted attests to how much nicer
SO is these days than it was in the past! :-)

SciComp SE is a great choice.  In order to encourage helpful and timely
answers keep your question short and limited in scope, You can always ask
more follow-up questions.

This is how I would ask it based on your SO post. It's just a suggestion
and you'll need to check it for errors and use your own words.

Here's a screenshot of what the text below would look like
https://i.stack.imgur.com/S8kRq.png

========

I'm trying to parse the following expression (Eq. 35 in [The Magnetic Field
in the Vicinity of Parallel and Twisted Three-Wire Cable Carrying Balanced
Three-Phased Current](
https://drive.google.com/file/d/1eynEkASX77LlTY5nx3pAWNBb6BPTouOK/view)) in
Python and calculate its sum over indices (...-5, -2, 1, 4, 7...).
 [Relations between Bessel functions](
https://www.johndcook.com/blog/bessel_functions/) explains that these are
the modified Bessel functions of the first and second kind.

**Question:** For $K_m$ I plan to use [scipy.special.kn(n, x)](
https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.kn.html#scipy.special.kn)
but for $I_m$ there does not seem to be a method specific for integer
orders. Should I just use [scipy.special.iv(v, z)](
https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.iv.html#scipy.special.iv)
for real orders with $z=m$?

Here is the expression inside the Sum over $m = (...-5, -2, 1, 4, 7...)$
from Equation 35 from the linked paper:

$$2 m I_m(\eta_m) K_m\left( \eta_m \frac{r}{a’} \right) + \frac{2 \pi r m
q}{p} \left[ I_{m-1}(\eta_m) K_{m-1}\left(\eta_m \frac{r}{a’} \right) +
I_{m+1}(\eta_m) K_{m+1}\left( \eta_m \frac{r}{a} \right) \right]
\exp[jm(\theta - 2 \pi z/p)]$$

with $r$ and $\theta$ as input parameters and likely to be arrays, and $p,
q$ as constant arguments.



On Sun, Dec 6, 2020 at 9:01 PM ashwin .D <winash12 at gmail.com> wrote:

> SO may not be the site you are looking for. You need  a more specific
> site. In the past when I have had questions like that I have preferred to
> go here -
>
> https://scicomp.stackexchange.com/ - Computational Science Stack
> Exchange. That site deals with numerical programming(in a language agnostic
> way) and actually helps by providing a numerical technique that will help
> you.
>
> But to me that question the way it is asked is way too broad and may end
> up being closed. You need to focus and then maybe ask a series of question
> each of which leads to the next.
>
> On Sun, Dec 6, 2020 at 5:54 PM Schuldei, Andreas <
> andreas.schuldei at th-luebeck.de> wrote:
>
>> now i tried to phrase my question in a broad way, detailing some
>> questions that stick out. Here is the link:
>> https://stackoverflow.com/questions/65167847/how-to-use-bessel-functions-when-implementing-math-equations
>> ------------------------------
>> *Von:* Schuldei, Andreas
>> *Gesendet:* Sonntag, 6. Dezember 2020 11:01:12
>> *An:* SciPy Users List
>> *Betreff:* AW: [SciPy-User] Help coding some math i have little
>> understanding of
>>
>>
>> yes, certainly. I have been coding python for a little while now. just to
>> clarify: you start the question on stack exchange? I could start it, too,
>> with my equation as an example (i got the wrong one in my post initally,
>> too). But Stackexchange does prefer general questions that can be
>> re-applied widely over specific ones ("how do i solve *this*?"). I fear if
>> i came with my equations it would be too specific.
>> ------------------------------
>> *Von:* SciPy-User <scipy-user-bounces+andreas.schuldei=
>> th-luebeck.de at python.org> im Auftrag von David Mikolas <
>> david.mikolas1 at gmail.com>
>> *Gesendet:* Sonntag, 6. Dezember 2020 01:40:39
>> *An:* SciPy Users List
>> *Betreff:* Re: [SciPy-User] Help coding some math i have little
>> understanding of
>>
>> Yes, I think this is not a question about SciPy at all, but about how to
>> write a python program using these equations.
>>
>> If you can use some Python then I will find some place in Stack Exchange
>> and get a question started for you, then link back here. Does that sound
>> useful to you?
>>
>> On Sat, Dec 5, 2020 at 5:55 PM Schuldei, Andreas <
>> andreas.schuldei at th-luebeck.de> wrote:
>>
>>> Thank you for looking into this. I am in the process of working thought
>>> the referenced paper by frank Haber from 1974. It is actually good at
>>> mentioning the single steps of the math.
>>>
>>> But apart from the juggling with terms of the bessel functions, I notice
>>> that I need an introduction into *coding* with bessel functions. E.g.: For
>>> infinte sums, do I need to iterate over the orders of the Bessel functions
>>> and add them up until I am satisfied with my accuracy? It seems to be an
>>> unpopular topic and the ones that know might find it obvious and dont blog
>>> or youtube about it. So my problem starts out rather basic. most likely
>>> more come once i understand more - such is the nature of learning 😊
>>> ------------------------------
>>> *Von:* SciPy-User <scipy-user-bounces+andreas.schuldei=
>>> th-luebeck.de at python.org> im Auftrag von David Mikolas <
>>> david.mikolas1 at gmail.com>
>>> *Gesendet:* Samstag, 5. Dezember 2020 04:13:49
>>> *An:* SciPy Users List
>>> *Betreff:* Re: [SciPy-User] Help coding some math i have little
>>> understanding of
>>>
>>> Not the same paper but looks pretty similar, both links seem to show the
>>> same paper.
>>>
>>> https://www.ipen.br/biblioteca/cd/ieee/1999/Proceed/00465.pdf
>>> https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=667734&tag=1
>>>
>>>
>>> It's an infinite series solution and with Br and Bphi one can construct
>>> the whole 3D vector field because Bz is almost the same as Bphi in this
>>> case.
>>>
>>> In addition to here, you could also consider posting an answer in
>>> Electronics Stack Exchange, but have a look around first, questions need to
>>> be supported with all links, you should mention python and explain how far
>>> you've gotten and where you're stuck.
>>>
>>>
>>>
>>>
>>> On Sat, Dec 5, 2020 at 6:17 AM Robert Kern <robert.kern at gmail.com>
>>> wrote:
>>>
>>>> On Wed, Dec 2, 2020 at 4:45 PM Schuldei, Andreas <
>>>> andreas.schuldei at th-luebeck.de> wrote:
>>>>
>>>>> I want to 3d plot the magnetic field of a twisted three phase cable,
>>>>> and found a paper giving the analytical solution of the field like
>>>>> <https://imgur.com/a/WeNuveE>this
>>>>> <https://imgur.com/a/WeNuveE#9aelprK>.
>>>>>
>>>>> There are more details in the paper, of course. Now I dont feel
>>>>> confident with this kind of math. Where can i find someone willing to help
>>>>> me with this? Its research in university, no coorporation involved. I would
>>>>> need help writing code representing these equations in python, calculating
>>>>> the field`s vecors in one point r, phi. I dont ask that you do the work for
>>>>> me, I am not dense either. its just that i dont even know where to start
>>>>> with this math.
>>>>>
>>>>>
>>>>> Who ever wants to have a look at the whole paper for further details,
>>>>> it is
>>>>> <https://drive.google.com/file/d/1CuXA0Elgw1RsjzLpO7YQ9gDgF41_ToHT/view?usp=sharing>
>>>>> <https://drive.google.com/file/d/1CuXA0Elgw1RsjzLpO7YQ9gDgF41_ToHT/view?usp=sharing>
>>>>> .
>>>>>
>>>> Hi Andreas,
>>>>
>>>> The link to the whole paper didn't make it through. We would need to
>>>> see that for enough context to help. Spherical coordinates have an
>>>> overabundance of notational conventions, so we'd need to see the whole text
>>>> to see what they intended.
>>>>
>>>> --
>>>> Robert Kern
>>>> _______________________________________________
>>>> SciPy-User mailing list
>>>> SciPy-User at python.org
>>>> https://mail.python.org/mailman/listinfo/scipy-user
>>>>
>>> _______________________________________________
>>> SciPy-User mailing list
>>> SciPy-User at python.org
>>> https://mail.python.org/mailman/listinfo/scipy-user
>>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at python.org
>> https://mail.python.org/mailman/listinfo/scipy-user
>>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at python.org
> https://mail.python.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/scipy-user/attachments/20201207/d5027a11/attachment.html>


More information about the SciPy-User mailing list