0% found this document useful (0 votes)
10 views1 page

Ejemplo Shell Julia Latex

The document shows examples of code cells in Julia. It contains cells that print output, define and call a function, and solve and plot the solution to a differential equation problem.

Uploaded by

Erick Negrete
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Ejemplo Shell Julia Latex

The document shows examples of code cells in Julia. It contains cells that print output, define and call a function, and solve and plot the solution to a differential equation problem.

Uploaded by

Erick Negrete
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

 

In [1]: print("Hello world")


 
 
Hello world
 
And here we also have a return value in the last line of the input cell.
 
In [2]: def twicify(arg):
print("Received:", arg, "- Will double now...")
return 2 * arg
twicify(1)
 
 
Received: 1 - Will double now...
 
 
Out[2]: 2
 
You can also reference the labeled input [2].
 
In [3]: "and the counter will automatically do the right thing :)"
 
 
Out[3]: 'and the counter will automatically do the right thing :)'
 
Ejemplos en Julia
 
In [1]: ## Programando con Julia

using DifferentialEquations
f(u, p, t) = 0.98u
u0 = 1.0
tspan = (0.0, 1.0)
prob = ODEProblem(f, u0, tspan)
sol=solve(prob,abstol=1e-8,reltol=1e-8)
solpre=solve(prob)

using Plots, LaTeXStrings; gr()

plot(sol,linewidth=3,title="Solution to the linear ODE with a thick line",


xaxis="Time (t)", yaxis="u(t) (in µm )",label="My ODE solution with
reltol & abstol")

plot!(solpre.t, t->1.0*exp(0.98t),lw=3,ls=:dash,label="True Solution")

plot!(solpre,lw=3,ls=:dot,label="My ODE solution")


 
 
Out[1]: 'and the counter will automatically do the right thing :)'
 

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy