Skip to content

Computing a modified equation with BigInt #283

@ketch

Description

@ketch

I'm posting this issue on behalf of Rob Corless, who wrote to me about it. I don't have time to look into it right now but perhaps @ranocha can see immediately what the problem is.

This works:

using BSeries
using Latexify
import SymPyPythonCall; sp = SymPyPythonCall;
α = sp.symbols("α", real = true)
s = sp.symbols("s", real=true )
As = [0 0; α 0]; bs = [s - s^2/(2*α), s^2/(2*α)]; cs = [0, α]
coeffss = bseries(As, bs, cs, 4)
latexify(coeffss, cdot=false)
huh = modified_equation(coeffss)
latexify(huh)

I can even get a modified equation for that, which tells me how the residual behaves asymptotically.

But the one that I want to do, which even has fewer symbols, fails. Since I am a Julia novice this isn't very surprising. This is the continuous extension of the ode45 code from Matlab. Probably Rational{Int128} is enough, but currently I'm trying BigInt.

bcext = [s - 183//64 * s ^ 2 + 37//12 * s ^ 3 - 145//128 * s ^ 4,0,1500//371 * s ^ 2 - 1000//159 * s ^ 3 + 1000//371 * s ^ 4,-125//32 * s ^ 2 + 125//12 * s ^ 3 - 375//64 * s ^ 4,9477//3392 * s ^ 2 - 729//106 * s ^ 3 + 25515//6784 * s ^ 4,-11//7 * s ^ 2 + 11//3 * s ^ 3 - 55//28 * s ^ 4,3//2 * s ^ 2 - 4 * s ^ 3 + 5//2 * s ^ 4]
A7 = Rational{BigInt}[0 0 0 0 0 0 0; 1//5 0 0 0 0 0 0; 3//40 9//40 0 0 0 0 0; 44//45 -56//15 32//9 0 0 0 0; 19372//6561 -25360//2187 64448//6561 -212//729 0 0 0; 9017//3168 -355//33 46732//5247 49//176 -5103//18656 0 0; 35//384 0 500//1113 125//192 -2187//6784 11//84 0];
c7 = Rational{BigInt}[0, 1//5, 3//10, 4//5, 8//9,1,1];
coeffs7 = bseries(A7, bcext, c7, 6);
latexify( coeffs7, cdot=false )

yields an error message:

MethodError: Cannot convert an object of type Rational{BigInt} to an object of type PythonCall.Py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions