Message Boards Message Boards

0
|
1219 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

FourierTrigSeries with Python wolframclient

Posted 1 year ago

Hi all,

I'm using Mathematica 12 and when executing the following argument:

FourierTrigSeries [ Piecewise [{{0.2823325901610266(x+3.1415926535)-0.007838187200000001,-3.1415926535<x<-3.102078087386194}
,{0.0628402439455588(x+3.1415926535)+0.0008349576260055147,-3.102078087386194<x<-3.0666257663874075}     
,{-0.03744122572444862(x+3.1415926535)+0.008352747242241837,-3.0666257663874075<x<-3.028957675327048}    
,{0.030608772625269575(x+3.1415926535)+0.000687937163451913,-3.028957675327048<x<-2.9562065582776302}    
,{-0.25481408302765957(x+3.1415926535)+0.053601365860166506,-2.9562065582776302<x<-2.916322697153295}    
,{0.03985738682927886(x+3.1415926535)-0.01277926329112538,-2.916322697153295<x<-2.8457873501662516}      
,{0.000356417817170588(x+3.1415926535)-0.0010946671705216982,-2.8457873501662516<x<-1.181374738279144}   
,{-0.0019224554710383199(x+3.1415926535)+0.0033724210755436647,-1.181374738279144<x<-0.587179066541148}  
,{-0.003682958995518699(x+3.1415926535)+0.00786947519836529,-0.587179066541148<x<-0.039883861122734565}  
,{-0.04173714262210999(x+3.1415926535)+0.1259024711397025,-0.039883861122734565<x<0.0}
,{0.2823325901610266x-0.007838187200000001,0.0<x<0.03951456611380608}
,{0.0628402439455588x+0.0008349576260055147,0.03951456611380608<x<0.07496688711259257}
,{-0.03744122572444862x+0.008352747242241837,0.07496688711259257<x<0.11263497817295193}
,{0.030608772625269575x+0.000687937163451913,0.11263497817295193<x<0.18538609522236965}
,{-0.25481408302765957x+0.053601365860166506,0.18538609522236965<x<0.22526995634670488}
,{0.03985738682927886x-0.01277926329112538,0.22526995634670488<x<0.2958053033337483}
,{0.000356417817170588x-0.0010946671705216982,0.2958053033337483<x<1.960217915220856}
,{-0.0019224554710383199x+0.0033724210755436647,1.960217915220856<x<2.554413586958852}
,{-0.003682958995518699x+0.00786947519836529,2.554413586958852<x<3.1017087923772655}
,{-0.04173714262210999x+0.1259024711397025,3.1017087923772655<x<3.1415926535}
} ], x, 20]

I get the following coeficcients :

-0.00088546 - 4.62365*10^-14 Cos[x] - 0.000301949 Cos[2 x] - 
 1.05198*10^-13 Cos[3 x] + 0.000242117 Cos[4 x] - 
 7.53864*10^-14 Cos[5 x] + 0.000312349 Cos[6 x] - 
 1.43367*10^-14 Cos[7 x] + 0.000231459 Cos[8 x] + 
 3.60492*10^-14 Cos[9 x] + 0.000179265 Cos[10 x] + 
 1.15006*10^-13 Cos[11 x] + 0.0000472483 Cos[12 x] + 
 1.70582*10^-13 Cos[13 x] - 0.0000891797 Cos[14 x] + 
 1.94554*10^-13 Cos[15 x] - 0.000200138 Cos[16 x] + 
 1.98895*10^-13 Cos[17 x] - 0.000307983 Cos[18 x] + 
 1.56689*10^-13 Cos[19 x] - 0.000374201 Cos[20 x] - 
 5.26803*10^-14 Sin[x] + 0.000436771 Sin[2 x] - 
 1.23898*10^-13 Sin[3 x] + 0.000691178 Sin[4 x] - 
 1.1987*10^-13 Sin[5 x] + 0.000598914 Sin[6 x] - 
 1.41078*10^-13 Sin[7 x] + 0.000652154 Sin[8 x] - 
 1.2311*10^-13 Sin[9 x] + 0.000669536 Sin[10 x] - 
 7.83321*10^-14 Sin[11 x] + 0.000644052 Sin[12 x] - 
 3.04492*10^-14 Sin[13 x] + 0.000636818 Sin[14 x] + 
 5.63316*10^-14 Sin[15 x] + 0.000581963 Sin[16 x] + 
 1.52886*10^-13 Sin[17 x] + 0.000497983 Sin[18 x] + 
 2.48331*10^-13 Sin[19 x] + 0.00039503 Sin[20 x]

My problem is that when I pass the same function FourierTrigSeries using Mathematicas python's client only the first coeficient is listed, the code I'm using is the follow

from wolframclient.evaluation import WolframLanguageSession
from wolframclient.language import wl, wlexpr
session = WolframLanguageSession('E:\\12.1\\WolframKernel.exe')

print(session.evaluate(String_containing_theFourierTrigSeries_expression))

Which outputs only the first terms

Plus[-0.0008854595915293, Times[-4.6236412537584223e-14, Cos[Global`x]], << 37 >>, Times[2.483313936181973e-13, Sin[Times[19, Global`x]]], Times[0.0003950302204760295, Sin[Times[20, Global`x]]]]

Do I need to add an additional argument to the wolframclient ?

Thanks!

POSTED BY: Victor Vargas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract