PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label wolfram-mathematica. Show all posts
Showing posts with label wolfram-mathematica. Show all posts

Wednesday, August 24, 2022

[FIXED] How to plot function embedded in module in Mathematica

 August 24, 2022     module, visualization, wolfram-mathematica     No comments   

Issue

I want to plot a 2D graph for this function. Efficiency of a SS topology resonant circuit I am new to Mathematica. This is what I have tried, I would appreciate it if someone could help me troubleshoot it and post a working version.

Eff [d_,f_]:=Module[{C1,C2,L1,L2,R1,R2,Rs,Ro,a,b,w,mu,RL,M,eff,fr,Vi,N1,N2},
w = 2 Pi f;
C1 = 1/(L1*w^2);
C2= 1/(L2*w^2);
L1 = L2 = 14 10^-6;fr=270 10^3;
Ro=R1=R2=Rs=0.2;
a = b = 0.5; mu = 4 Pi*10^-7; Vi = 100;N1=N2=100;
M[d]=  N1 N2 Block[{k = Sqrt[(4 a b)/((a + b)^2 + d^2)]}, mu Sqrt[a b]  2/k ((1 - k^2/2) EllipticK[k^2] - EllipticE[k^2])];
eff =(C2^2*M[d]^2*Ro*w^4)/(R1 + Rs + C2*(-2*L2 + C2*(R2 + RL)^2)*(R1 + Rs)*w^2 + C22*(M [d]2*(R2 + RL) + L2^2*(R1 + Rs))*w^4)
]
Plot[Eff [0.1,f] ,{f,100 10^3,100 10^6}]

The values are test values. Please I will appreciate any help to make this work.


Solution

Well, here is a version showing that Mathematica code does not need to look awful. :)

Eff[d_, f_] := Module[
  {
   L1 = 14 10^(-6),
   L2 = 14 10^(-6),
   R1 = 0.2,
   R2 = 0.2,
   Rs = 0.2,
   Ro = 0.2,
   a = 0.5,
   b = 0.5,
   w = 2 Pi f,
   mu = 4 Pi 10^(-7),
   RL = 1,
   N1 = 100,
   N2 = 100,
   C1, C2, M, k
  },
  C1 = 1 / (L1*w^2);
  C2 = 1 / (L2*w^2);
  k = Sqrt[
    (4 a b)/
     ((a + b)^2 + d^2)
    ];
  M = N1 N2 mu Sqrt[a b] 2 / k 
    ((1 - k^2 / 2) EllipticK[k^2] - EllipticE[k^2]);
  Return[
   (C2^2 M^2 Ro w^4) /
    (
     R1 + Rs
      + C2 (-2 L2 + C2 (R2 + RL)^2) (R1 + Rs) w^2
      + C2^2 (M^2 (R2 + RL) + L2^2 (R1 + Rs)) w^4 
     )
   ]
  ]

and

LogLinearPlot[
 Evaluate[
  Table[
   Eff[d, f], {d, 0.1, 1.1, 0.1}
   ]
  ], {f, 10^3, 10^8},
 Frame -> True,
 GridLines -> Automatic,
 PlotLegends -> Table[d, {d, 0.1, 1.1, 0.1}]
 ]

or

Plot3D[
 Eff[d, f], {d, 0.1, 1.1}, {f, 10^3, 10^8},
 ScalingFunctions -> {Identity, "Log", Identity},
 PlotRange -> All
 ]


Answered By - mikuszefski
Answer Checked By - Robin (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, May 18, 2022

[FIXED] What "boundary conditions" can make a rectangle "look" like a circle?

 May 18, 2022     boundary, differential-equations, partial, wolfram-mathematica     No comments   

Issue

I am solving a fourth order non-linear partial differential equation in time and space (t, x) on a square domain with periodic or free boundary conditions with MATHEMATICA.

WITHOUT using conformal mapping, what boundary conditions at the edge or corner could I use to make the square domain "seem" like a circular domain for my non-linear partial differential equation which is cartesian?

The options I would NOT like to use are:

  • Conformal mapping
  • changing my equation to polar/cylindrical coordinates?

This is something I am pursuing purely out of interest just in case someone screams bloody murder if misconstrued as a homework problem! :P


Solution

That question was asked on the time people found out that the world was spherical. They wanted to make rectangular maps of the surface of the world...

It is not possible.

The reason why is not possible is because the sphere has an intrinsic curvature, while the cube/parallelepiped has not. It can be shown that for two elements with different intrinsic curvatures, their surfaces cannot be mapped while either keeping constant infinitesimal distances, either the distance between two points is given by the euclidean distance.

The easiest way to understand this problem is to pick some rectangular piece of paper and try to make a sphere of it without locally stretch it or compress it (you can fold). You can't. On the other hand, you can make a cylinder surface, because the cylinder has also no intrinsic curvature.

In maps, normally people use one of the two options:

  1. approximate the local surface of the sphere by a tangent plane and make a rectangle out of it. (a local map of some region)

  2. make world maps but implement some curved lines everywhere identifying that the measuring distances must be made according to those lines.

This is also the main reason why when traveling from Europe to North America the airplanes seems to make a curve always trying to pass near canada. If we measured the distance from the rectangular map, we see that they should go on a strait line to minimize the distance. However, because we are mapping two different intrinsic curvatures, the real distance must be measured in a different way (and not via a strait line).

For 2D (in fact for nD) the same reasoning applies.



Answered By - Jorge Leitao
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing