0

The argument of the spherical bessel function is a product of a complex number and a real number,i.e.,'p'. I want to find Psi(p)=p*Series[SphericalBesselJ[1.5,p],{p,0,5}]. Please follow the following program:

Subscript[ω, L] = 2*π*570;
Subscript[ω, T] = 2*π*240; 
Subscript[γ, 1] = 2*π*2.5;
Subscript[ϵ, ∞] = 17; 
Subscript[ϵ, 1] = 
 Subscript[ϵ, ∞]*(1 + ((Subscript[ω, L]^2 - 
        Subscript[ω, T]^2)/(Subscript[ω, T]^2 - ω^2 - ω*
         Subscript[γ, 1]))); Subscript[ω, p] = 2*π*134; 
Subscript[γ, 2] = Subscript[ω, p]/60; 
Subscript[ϵ, 2] = 1 - (Subscript[ω, p]^2/(ω^2 + I*ω*Subscript[γ, 2])); 
Subscript[n, 1] = Sqrt[Subscript[ϵ, 1]]; 
Subscript[n, 2] = Sqrt[Subscript[ϵ, 2]];
Subscript[ϵ, 3] = 2; 
Subscript[n, 3] = Sqrt[Subscript[ϵ, 3]]; 
Subscript[m, 1] = Subscript[n, 1]/Subscript[n, 3]; 
Subscript[m, 2] = Subscript[n, 2]/Subscript[n, 3];
c = 3;
Subscript[k, 3] = ω/c; 
Subscript[r, 1] = 0.13;
x = Subscript[k, 3]*Subscript[r, 1];
p = Subscript[m, 2]*x;
ψ[p] = p*Series[SphericalBesselJ[1.5, p], {p, 0, 5}]

The following is the error:

General::ivar: 3.06413 ([Pi]:300 [Pi]) Sqrt[1-(71824 [Pi]^2)/(1340/3 I [Pi] Pattern[<<2>>]+10000 Power[<<2>>])] is not a valid variable. >>

Rule::rhs: Pattern [Pi]:300 [Pi] appears on the right-hand side of rule Sqrt[(53868 I [Pi]^2+335 [Pi] ([Pi]:300 [Pi])-7500 I ([Pi]:Times[<<2>>])^2)/((67 [Pi]-1500 I ([Pi]:Times[<<2>>])) ([Pi]:300 [Pi]))]->Sqrt[5] Sqrt[1-(71824 [Pi]^2)/(Times[<<3>>]+Times[<<2>>])]. >>

Rule::rhs: Pattern [Pi]:300 [Pi] appears on the right-hand side of rule Sqrt[(53868 I [Pi]^2+335 [Pi] ([Pi]:300 [Pi])-7500 I ([Pi]:Times[<<2>>])^2)/((67 [Pi]-1500 I ([Pi]:Times[<<2>>])) ([Pi]:300 [Pi]))]->Sqrt[5] Sqrt[1-(71824 [Pi]^2)/(Times[<<3>>]+Times[<<2>>])]. >>

Rule::rhs: Pattern [Pi]:300 [Pi] appears on the right-hand side of rule Sqrt[(53868 I [Pi]^2+335 [Pi] ([Pi]:300 [Pi])-7500 I ([Pi]:Times[<<2>>])^2)/((67 [Pi]-1500 I ([Pi]:Times[<<2>>])) ([Pi]:300 [Pi]))]->Sqrt[5] Sqrt[1-(71824 [Pi]^2)/(Times[<<3>>]+Times[<<2>>])]. >>

General::stop: Further output of Rule::rhs will be suppressed during this calculation. >>

General::ivar: 3.06413 ([Pi]:300 [Pi]) Sqrt[1-(71824 [Pi]^2)/(1340/3 I [Pi] Pattern[<<2>>]+10000 Power[<<2>>])] is not a valid variable. >>

General::ivar: 3.06413 ([Pi]:300 [Pi]) Sqrt[1-(71824 [Pi]^2)/(1340/3 I [Pi] Pattern[<<2>>]+10000 Power[<<2>>])] is not a valid variable. >>

General::stop: Further output of General::ivar will be suppressed during this calculation. >>

user3914003
  • 1
  • 1
  • 2

1 Answers1

0

First of all, I'm going to advise against subscripts. It's not the source of your problem, but they tend to be atrocious in my experience. Regardless, there are two issues and they both come from your last line.

First of all, ψ[p] is a function, right? You have to define it as ψ[p_] then.

Secondly, you already have assigned a value to p. You can't use it later, or it will try to use the existing definition, and since it's being used as a variable for your Series command, it goes haywire. That would be like trying to do this:

x = 3+7/2-11/5;
Series[Sin[x],{x,0,5}]

(* Output: General::ivar: 43/10 is not a valid variable. >> Series[Sin[43/10], {43/10, 0, 5}] *)

If you want to actually define this function and then plug in your p value, try this:

ψ[q_] = q*Normal[Series[SphericalBesselJ[1.5, q], {q, 0, 5}]];
ψ[p]

This will define your function and then plug in the value.

Kellen Myers
  • 362
  • 1
  • 6