library(reticulate)
use_python("C:\\Users\\POSTO09\\Gerardo\\Programas\\miniconda3")Pythonin RStudio
Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.
Running Code
When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
You can add options to executable code like this
The echo: false option disables the printing of code (only output is displayed).
#!pip install PyQt5==5.15.9
#!pip install numpy matplotlib
#!set MPLBACKEND=qtagg
import numpy as np
import matplotlib
matplotlib.use('qtagg')
import matplotlib.pyplot as plt
N = 200
start =-1.0
stop= 1.0
xList= np.tile(0.0,N)
yList= np.tile(0.0,N)
zList= np.tile(0.0,N)
zList2= np.tile(0.0,N)
step = ( stop - start)/N
print ("step = " , step)step = 0.01
for i in range( N):
xList[i] = start + i* step
yList [i] = start + step*i
def exP_( a, b, x):
return abs (x**a * (1-x)**b)
sumX=0.0
sumY=0.0
for j in range(N-1,0, -1):
sumX += exP_( 3,9, abs(xList[j]) )
sumY += exP_( 3,9, abs(yList[j]) )
fig = plt.figure()
for i in range(N):
zList[i]= exP_ (3,9,abs(xList[i]))/sumX
plt.scatter (xList, zList)
#fig.show()Now the simplest case
for i in range(N):
for j in range(N):
zList[i]= (exP_ (3,9,abs(xList[i]))/sumX)+ (exP_(3,9, abs(yList[j]))/sumY)
ax = plt.axes(projection='3d')
ax.scatter3D( xList, yList, zList)Complicating!
zMatrix=[]
for i in range(N):
zMatrix.append([])
for j in range(N):
zMatrix[i].append ((exP_ (3,9,abs(xList[i]))/sumX)+ (exP_(3,9, abs(yList[j]))/sumY))
#zList[i]= (exP_ (3,9,abs(xList[i]))/sumX)+ (exP_(3,9, abs(yList[i]))/sumY)
ax = plt.axes(projection='3d')
for i in range(N):
ax.scatter3D( xList, yList, zMatrix[i])