Docsity

coding example using Mathematica, Exercícios de Física para Ensino Médio

Toggle sidebar
bg1
In[266]:=
ClearAll["Global`*"]
Clear[a, e, γ,ω0, ω1, m, ε0, n]
(*Define χ3*)
χ
3= (2*n*a^2 *e ^4 * (- 3*ω0^2+8*ω1* (I*γ+ω1))) /
(m^3*ω0^2 *ε0* (ω0^2 + (- 2*I*γ-ω1)*ω1)^3 *
(ω0^2+ (2*I*γ-ω1) * ω1)*(ω0^2 -4*I*γ*ω1-4*ω1^2));
(*Substitute numerical values*)
NumSub2 = {ω010^15, a 3*10^39, γ (10^15)/20,
e1.6 *10^-19, m 10^-30, ε08.85 *10^-12, n 10^27};
(*Substitute into χ3*)
χ
3Substituted =χ3/. NumSub2;
(*Display χ3 with substituted values to verify it*)
χ
3Substituted // FullSimplify
(*Now try to evaluate χ3 for specific values of ω1*)
testValue =χ3Substituted /.ω110^14;
Print["Test value of χ3atω1=10^14: ", testValue];
(*Plot real part of χ3 to check the curve*)
Plot[Re[χ3Substituted],{ω1, 3 *10 ^ 13, 1.5 *10^15}, PlotRange All, PlotPoints 1000,
PlotStyle Thick, Frame True, AspectRatio 1/3, ImageSize Large,
FrameLabel {"ω1", "Re[χ3] (m^2/V^2)"}, PlotLegends "Expressions"]
(*Plot imaginary part of χ3*)
Plot[Im[χ3Substituted],{ω1, 3 *10 ^ 13, 1.5 *10^15}, PlotRange All, PlotPoints 1000,
PlotStyle Thick, Frame True, AspectRatio 1/3, ImageSize Large,
FrameLabel {"ω1", "Im[χ3] (m^2/V^2)"}, PlotLegends "Expressions"]
Out[271]= 9.99702 ×10131 +0. -1.33294 ×10116  -2.66587 ×10102 ω1 ω1
-2.5 ×1029 +ω10. +5. ×1013  +ω1
-1. ×1030 +ω10. -1. ×1014  +ω1 -1. ×1030 +ω10. +1. ×1014 +ω13
Test value of χ3atω1=10^14: -4.2177 ×10-18 -1.15315 ×10-19
pf2

Pré-visualização parcial do texto

Baixe coding example using Mathematica e outras Exercícios em PDF para Física para Ensino Médio, somente na Docsity!

In[266]:=

ClearAll [ "Global` ***** " ] Clear [ a, e, γ , ω 0, ω 1, m, ε 0, n ]

(* Define χ 3 ) χ 3 = ( 2 ***** n ***** a ^ 2 ***** e ^ 4 *** (-* 3 *** ω** 0 ^ 2 + 8 *** ω** 1 *** (** I *** γ + ω** 1 ))) / ( m ^ 3 *** ω** 0 ^ 2 *** ε** 0 *** (ω** 0 ^ 2 + (- 2 ***** I *** γ - ω** 1 ) * ω 1 ) ^ 3 *** (ω** 0 ^ 2 + ( 2 ***** I *** γ - ω** 1 ) * ω 1 ) * (ω 0 ^ 2 - 4 ***** I *** γ * ω** 1 - 4 *** ω** 1 ^ 2 )) ;

(* Substitute numerical values *) NumSub2 = {ω 0 10 ^ 15, a 3 ***** 10 ^ 39, γ  ( 10 ^ 15 ) / 20, e 1.6 ***** 10 ^ - 19, m 10 ^ - 30, ε 0 8.85 ***** 10 ^ - 12, n 10 ^ 27 } ;

(* Substitute into χ 3 *) χ 3Substituted = χ 3 /. NumSub2;

(* Display χ 3 with substituted values to verify it *) χ 3Substituted // FullSimplify

(* Now try to evaluate χ 3 for specific values of ω 1 *) testValue = χ 3Substituted /. ω 1 10 ^ 14; Print [ "Test value of χ 3 at ω 1 = 10^14: ", testValue ] ;

(* Plot real part of χ 3 to check the curve *) Plot [ Re [χ 3Substituted ] , {ω 1, 3 ***** 10 ^ 13, 1.5 ***** 10 ^ 15 } , PlotRange All, PlotPoints 1000, PlotStyle Thick, Frame True, AspectRatio 1 / 3, ImageSize Large, FrameLabel  { " ω 1", "Re [χ 3 ] ( m^2 / V^2 ) " } , PlotLegends "Expressions" ]

(* Plot imaginary part of χ 3 *) Plot [ Im [χ 3Substituted ] , {ω 1, 3 ***** 10 ^ 13, 1.5 ***** 10 ^ 15 } , PlotRange All, PlotPoints 1000, PlotStyle Thick, Frame True, AspectRatio 1 / 3, ImageSize Large, FrameLabel  { " ω 1", "Im [χ 3 ] ( m^2 / V^2 ) " } , PlotLegends "Expressions" ]

Out[271]= 9.99702 × 10 131 + 0. - 1.33294 × 10 116  - 2.66587 × 10 102 ω 1  ω 1  

- 2.5 × 10 29 + ω 1 0. + 5. × 10 13  + ω 1  - 1. × 10 30 + ω 1 0. - 1. × 10 14  + ω 1  - 1. × 10 30 + ω 1 0. + 1. × 10 14  + ω 1  3 

Test value of χ3 at ω 1 = 10^14: - 4.2177 × 10 -^18 - 1.15315 × 10 -^19 

Out[274]=

(^0) 2.0 × 10 14 4.0 × 10 14 6.0 × 10 14 8.0 × 10 14 1.0 × 10 15 1.2 × 10 15 1.4 × 10 15

0

  1. × 10 -^15
  2. × 10 -^14

1.5 × 10 -^14

  1. × 10 -^14

ω 1

Re

[χ^3

] (m^

/V^

)

Out[275]=

(^0) 2.0 × 10 14 4.0 × 10 14 6.0 × 10 14 8.0 × 10 14 1.0 × 10 15 1.2 × 10 15 1.4 × 10 15

    1. × 10 -^14
    1. × 10 -^15

0

  1. × 10 -^15
  2. × 10 -^14

ω 1

Im [χ^3

] (m^

/V^

)

2 question2.nb