Comments (8)
Hi. The code as you type will have no chance of working because the HypergeometricFunctions
is not a defined function within MathLink. What would be the corresponding Mathematica code that you would run in this instance?
Or is there some other Julia library also at work in this example?
from mathlink.jl.
Hi. The code as you type will have no chance of working because the
HypergeometricFunctions
is not a defined function within MathLink. What would be the corresponding Mathematica code that you would run in this instance?Or is there some other Julia library also at work in this example?
I also used HypergeometricFunctions in Julia
the Full code is
using MathLink
using HypergeometricFunctions
a=weval(W"Series"(HypergeometricFunctions.pFq((2,), (0.2,),W"z"),(W"z",-1,50)))
from mathlink.jl.
Hi. Your problem is that the HypergeometricFunctions
package does no accept MathLink arguments.
using MathLink
using HypergeometricFunctions
julia> HypergeometricFunctions.pFq((2,), (0.2,),1)
35.11151422002346
julia> HypergeometricFunctions.pFq((2,), (0.2,),W"z")
ERROR: MethodError: no method matching AbstractFloat(::MathLink.WSymbol)
If you want to use the Mathematica hypergeoemtric functions your need to use the HypergeometricPFQ function wich is builtin to Mathematica.
from mathlink.jl.
How can I define HypergeometirvPFQ in julia,while I see connection between Julia and mathematic through a char "W"
from mathlink.jl.
The syntac change is usually simple. Replace any Matematica function <fun>
with W"<fun>"
and the [<arg>]
with (<arg>)
. If you are unsure what it should look like you can always use the ' construction as
W`<fun>`
Here follows a series of eamples of how to works figures out the correct syntax
Test that numerics values work
julia> weval(W`HypergeometricPFQ[{1, 1}, {3, 3, 3}, 2.]`)
1.0789344020671878
Test that algebraic expressions work
julia> weval(W`HypergeometricPFQ[{1, 1}, {3, 3, 3}, z]`)
W"HypergeometricPFQ"(W"List"(1, 1), W"List"(3, 3, 3), W"z")
Note that the weval
is not nencarry. Mathlink does the translation anyway:
julia> W`HypergeometricPFQ[{1, 1}, {3, 3, 3}, z]`
W"HypergeometricPFQ"(W"List"(1, 1), W"List"(3, 3, 3), W"z")
Here the same thing with weval
julia> weval(W"HypergeometricPFQ"([1, 1],[3, 3, 3], W"z"))
W"HypergeometricPFQ"(W"List"(1, 1), W"List"(3, 3, 3), W"z")
And if you run the series you will get more data back:
julia> weval(W"Series"(W"HypergeometricPFQ"([1, 1],[3, 3, 3], W"z"),(W"z",-1,2)))
W"SeriesData"(W"z", -1, W"List"(W"HypergeometricPFQ"(W"List"(1, 1), W"List"(3, 3, 3), -1), W"Plus"(-8, W"Times"(8, W"HypergeometricPFQ"(W"List"(1, 1), W"List"(2, 2, 2), -1)), W"HypergeometricPFQ"(W"List"(1, 1), W"List"(3, 3, 3), -1)), W"Plus"(-16, W"Times"(4, W"BesselJ"(0, 2)), W"Times"(16, W"HypergeometricPFQ"(W"List"(1, 1), W"List"(2, 2, 2), -1)), W"HypergeometricPFQ"(W"List"(1, 1), W"List"(3, 3, 3), -1))), 0, 3, 1)
I hope this clarifies things.
from mathlink.jl.
Thanks! That helps a lot,I am not familiar with MathLink,I tried the method above and successfully get the result.
My goal is get the TaylorSeries coefficients, how can I access W"List"(-2.0401353687919177, 1.6538235838749207, 0.9454567962158056, 0.33340658574157367, 0.08626703289712206, 0.017680673659342557) the coefficient as I understand it?here is my code
a=weval(W"Series"(W"Hypergeometric1F1"(0.1,0.02, W"z"),(W"z",-1,5)))
W"SeriesData"(W"z", -1, W"List"(-2.0401353687919177, 1.6538235838749207, 0.9454567962158056, 0.33340658574157367, 0.08626703289712206, 0.017680673659342557), 0, 6, 1)
from mathlink.jl.
Hi @Li-shiyue, you can access the series data by looking at the args
of a
. The trick is to access the third argument which i a W"List"
. We then access the arguments of the list to get the coefficients we want.
julia> a=weval(W"Series"(W"Hypergeometric1F1"(0.1,0.02, W"z"),(W"z",-1,5)))
W`SeriesData[z, -1, List[-2.0401353687919177, 1.6538235838749207, 0.9454567962158056, 0.33340658574157367, 0.08626703289712206, 0.017680673659342557], 0, 6, 1]`
julia> series =a.args[3].args
6-element Vector{Float64}:
-2.0401353687919177
1.6538235838749207
0.9454567962158056
0.33340658574157367
0.08626703289712206
0.017680673659342557
from mathlink.jl.
I think that this solves the original question, and I will close this ticket.
from mathlink.jl.
Related Issues (20)
- `==` dosen't work for WExpr generated by `@W_cmd` HOT 1
- Including overloading of basic algebra HOT 10
- Bug: Julia Mathlink installation on Windows 10 HOT 4
- TagBot trigger issue HOT 9
- Possibility of allocation-free from julia via MathLink HOT 2
- Problem : UndefVarError: set_texOutput not defined HOT 2
- ParseError: KaTeX parse error HOT 2
- MathLink package can't find file "dep.jl" & fail to precompiling pkg. HOT 5
- Finding paths
- Wishlist from Wolfram HOT 2
- Symbolics to MathLink translation of expressions HOT 4
- Passing arrays to MathLink HOT 2
- Extracting values from arbitrary MathLink.WExpr HOT 8
- W"List"(0.02) -> 0.02? HOT 1
- precision may be lost HOT 3
- MathLink not working on Julia 1.10? HOT 2
- Wrong path delimiter on Windows
- Mathematica arm64 version needed on M1 MacBook? HOT 8
- W2Julia expects an Expr, not a WExpr. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathlink.jl.